Joomla 5 Mitteilung

Wir freuen uns mitteilen zu können, dass seit dem 29. Januar 2024 alle unsere Joomla Erweiterungen mit Joomla 5 kompatible sind.

Für alle die gerade noch von Joomla 3 auf 4 aktualisieren: Anleitungen für die Joomla 4 Migration gibt es hier:

Es gibt nun auch eine eigenständige Dokumentation für Visforms für Joomla 4 und für Visforms auf Joomla 5

Forum

Visforms Subscription Inhaber können in unserem Forum Fragen stellen. Bitte mit dem entsprechenden Benutzer anmelden.
Jeder kann lesend auf das Forum zugreifen.

Bitte stellen Sie nur 1 Frage pro Thema.

Access to logged on user's data

Mehr
8 Jahre 6 Monate her - 8 Jahre 6 Monate her #2151 von robinhair
Access to logged on user's data wurde erstellt von robinhair
I downloaded VisForms and got it working well. Congratulation on a very useful and well documented Joomla extension!

I've created an input form which is only accessible to logged on users. VisForms lets me access their Name, Username, and Email Address, but I'd like to access other 'standard' information contained in their user data. Is there anyway to do this in the latest version (I have the Beta version installed)?

Thanks
Robin
Letzte Änderung: 8 Jahre 6 Monate her von robinhair. Begründung: Typos!

Mehr
8 Jahre 6 Monate her #2153 von Administrator AV
Administrator AV antwortete auf Access to logged on user's data
Hi Robin,

thanks, you're welcome.

Sorry, but even in the current latest beta only username, name and user email address are accessible.
Which other fields would you define as "standard" information?

Regards,
Aicha

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).

Mehr
8 Jahre 6 Monate her #2158 von robinhair
robinhair antwortete auf Access to logged on user's data
Hi Aicha,

Thanks for your prompt reply. When I said 'standard', I was thinking about the fields that can be included in the Joomla User Registration page, and might therefore be available in the same way as Name, Username and Email. Specifically my intended use concerns the delivery of auction goods, so I was after extracting the user's Postal Address and Telephone Number.

Thanks
Robin

Mehr
8 Jahre 6 Monate her #2160 von Administrator AV
Administrator AV antwortete auf Access to logged on user's data
Hi Robin,

ok, you are talking about the field of the user profile. (Added through user profile plugin).
I can set this on my todo list.
But I don't know, when I will be able to implement it.

Regards,
Aicha

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).

Mehr
8 Jahre 6 Monate her #2162 von robinhair
robinhair antwortete auf Access to logged on user's data
Hi Aicha,

Understood about adding to your todo list, thanks. In the meantime I found the following on the internet and wonder if I could insert this code somewhere to achieve the same effect as the Name/email. I'm afraid I wouldn't have a clue where such code would have to go within VisForms, but am happy to try something out if you would kindly supply detailed instructions as to exactly which file and where it should be located.

The extract came from:
joomla.stackexchange.com/questions/899/h...-profile-information

To access the User Profile Data:

jimport( 'joomla.user.helper' );
$user = JFactory::getUser();
$userId = $user->id;
$userProfile = JUserHelper::getProfile( $userId );

echo "Main Address :" . $userProfile->profile;

Would there be some way to pre-fill the address box with address1, address2 etc using the above method?

Many thanks
Robin

Mehr
8 Jahre 6 Monate her #2163 von Administrator AV
Administrator AV antwortete auf Access to logged on user's data
Hi Robin,

this is the code to get the profile information from the database. This in only one step in the right direction.
You have to change at least the following two Visforms core files
adminstrator/components/com_visforms/models/forms/visfield.xml
components/com_visforms/lib/field/text.php

In the xml file you have to add an Option for each profile information you want to use in the xml node "field" with the name attribute "f_text_fillwith".
Code:
<field name="f_text_fillwith" type="list" label="COM_VISFORMS_FILL_FIELD_WITH" description="COM_VISFORMS_FILL_FIELD_WITH_DESC" class="inputbox" default="0"> <option value="0">COM_VISFORMS_INITIAL_VALUE</option> <option value="1">COM_VISFORMS_CONNECTED_USER_NAME</option> <option value="2">COM_VISFORMS_CONNECTED_USER_USERNAME</option> </field>

Like
Code:
<option value="3">Addr1</option>

In the php file you have to adapt the function setFieldDefaultValue()
Basically you have to add a new if statement in the following part of the code for each option which you have added to the xml file.
Code:
if ((isset($field->fillwith) && $field->fillwith != "")) { $user = JFactory::getUser(); $userId = $user->get('id'); if($userId != 0) { if($field->fillwith == 1) { $this->field->attribute_value = $user->get('name'); return; } if($field->fillwith == 2) { $this->field->attribute_value = $user->get('username'); return; } } }

Like
Code:
if($field->fillwith == 3) { //get addr1 from profile return; }
I think this should do the trick, but this is absolutely untested and without any guarantee.

Regards,
Aicha

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).

Moderatoren: Administrator AVAdministrator IV
Powered by Kunena Forum