i am creating a customer dashboard component in joomla 3.2, so i want to display user profile fields to my view and able to edit fields as well, i am displaying them manually using
$this->user = JFactory::getUser();
and <?php echo $this->user->name; ?>
now i have to add the functionality to edit as well, like password, profile image etc.
how could i implement this functionality to my custom component.
1 Answer
Just an idea for a quick implementation: You could add a modal link to the com_users edit profile view in your component's view.
At the top of your view add:
JHTML::_('behavior.modal');
Then link like below:
<a class="modal" href="index.php?option=com_users&view=profile&layout=edit&tmpl=component?" rel="{handler: 'iframe', size: {x: 640, y: 540}}"> Edit Login Details</a>
This will open the edit profile layout in a modal window, without leaving your current page and have the com_users do the job, instead of re-creating the same functionality.
-
Thanks! @FFrewin, for now being im doing like this way only, displaying in popup modal. Additional, i have to remove basic settings fields from the com_user -> user profile as well. Commented Oct 16, 2014 at 7:05
-
though i am just calling that functionality here in my component, but for later use what method would be better so that i will be completely free to edit as i want in user profile section. Commented Oct 16, 2014 at 7:11
-
Note: To only retreive the profile values you can use: $profile = JUserHelper::getProfile($userid); Commented Mar 3, 2015 at 7:51
com_users
does it ;)