Display User Group on Profile Page
Permalink
Hi all,
does anyone know how I could display the group(s) a User is in on his/her Profile Page?
[ I'm not a PHP wizard, but I know how to copy and paste ;-) ]
Thanx, Maureen
does anyone know how I could display the group(s) a User is in on his/her Profile Page?
[ I'm not a PHP wizard, but I know how to copy and paste ;-) ]
Thanx, Maureen
Hello!
On view.php this works fine.
On members.php I get this error:
Fatal error: Call to a member function getUserObject() on a non-object in /home2/conceptu/public_html/iebpv/single_pages/members.php on line 24
Any idea?
Thanks!
On view.php this works fine.
On members.php I get this error:
Fatal error: Call to a member function getUserObject() on a non-object in /home2/conceptu/public_html/iebpv/single_pages/members.php on line 24
Any idea?
Thanks!
> On members.php I get this error:
Of course, because the $profile variable is undefined in that context. Are you trying to get the groups for the user viewing the page - i.e. the website visitor - or for each user in the list that's displayed on that page?
-Steve
Of course, because the $profile variable is undefined in that context. Are you trying to get the groups for the user viewing the page - i.e. the website visitor - or for each user in the list that's displayed on that page?
-Steve
Hello!
Both profiles and members list are only viewable to the administrators. I would like to display the groups each member belongs to, both on profile view (already done) and on members list page.
I don't know enough coding to sort this out. Is there a way to define the variable profile in the context of the members.php page?
Both profiles and members list are only viewable to the administrators. I would like to display the groups each member belongs to, both on profile view (already done) and on members list page.
I don't know enough coding to sort this out. Is there a way to define the variable profile in the context of the members.php page?
Try just changing $profile to $user like this instead:
Make sure you put this inside the "foreach($users as $user) {" loop that starts at line 24
$groups = $user->getUserObject()->getUserGroups(); echo '<ul>'; foreach ($groups as $group) { echo '<li>'.htmlentities($group).'</li>'; } echo '</ul>';
Make sure you put this inside the "foreach($users as $user) {" loop that starts at line 24
Hello!
Mhawke, thank you so much! Works perfectly!
Thanks again!
Mhawke, thank you so much! Works perfectly!
Thanks again!
No problem, glad I could help.
Yeah, in that case, what mhawke said.
:-)
-Steve
:-)
-Steve
You'll need to modify the view template for the profile single page. Copy the following core file...
/concrete/single_pages/profile/view.php
...to the following location...
/single_pages/profile/view.php
...and then edit the copy to include the following PHP code:
That should get you close to what you're after.
-Steve