1
jordi_rc
Show the groups of the user in profile
  • 2006/11/15 10:56

  • jordi_rc

  • Not too shy to talk

  • Posts: 114

  • Since: 2006/8/21


Hello to all.

I have added the groups of the user to the userinfo, so they are displayed in his/her profile.
It is nice for projects like mine, that all members (not only the admin) need to know when a member is part of a special group.

I developed this hack from a post of bluescreen, who did something similar to point 2, but for another purpose. Sorry I can't find that post.

The hack is this way:

1) in the file /language/english/user.php add this line:

Quote:


// hack jordi user groups displaying
define('_US_GRUPOS','Community Status');
// end of hack jordi




----------------------------------
2) In the file userinfo.php look where it says this:

Quote:


if ( is_object($xoopsUser) && $isAdmin ) {

$xoopsTpl->assign('lang_editprofile', _US_EDITPROFILE);

$xoopsTpl->assign('lang_deleteaccount', _US_DELACCOUNT);

$xoopsTpl->assign('user_uid', $thisUser->getVar('uid'));

}



and add this after it:

Quote:


// hack display user groups

$verGrupos = $thisUser->getGroups();
$susGrupos='';

//group number 1 is allways admin
if ( in_array("1", $verGrupos) ) { $susGrupos = 'Administrator'; }

//group 4 is a group you may have created
// remove this line if you didn't
// you can also add more lines, checking numbers from 4 to X
// for the groups you created

elseif ( in_array("4", $verGrupos) ) { $susGrupos .= 'A group you created'; }
//group 2 is the registered users. All people belong to this group if they are registered.
elseif ( in_array("2", $verGrupos) ) { $susGrupos .= 'Proud Member'; }

// this asigns values to variables in system_userinfo

$xoopsTpl->assign('lang_grupos', _US_GRUPOS);
$xoopsTpl->assign('user_grupos', $susGrupos);

// fin hack mostrar grupos



-------------------------------------------
3) Finally go to modules/system/templates/system_userinfo.html where it says:

Quote:




<{$lang_avatar}>
Avatar





And add this after it:

Quote:




<{$lang_grupos}>
<{$user_grupos}>






Now you got it!
You don't need to create any database or nothing, just do these 3 steps.

Jordi.
"Battles are fought by those with the courage to believe. They are won by those who find the heart to share." -MANOWAR

2
hervet
Re: Show the groups of the user in profile
  • 2006/11/22 12:30

  • hervet

  • Friend of XOOPS

  • Posts: 2267

  • Since: 2003/11/4


This could be a good article too ...

3
jordi_rc
Re: Show the groups of the user in profile
  • 2006/11/22 19:28

  • jordi_rc

  • Not too shy to talk

  • Posts: 114

  • Since: 2006/8/21


Hi Hervé!

What do you mean with :

Quote:

This could be a good article too ...


Do you mean placing this hack in a howto or what?

Many of the modules I finally selected for my XOOPS site are yours, Hervé. They are nice!

As you are a XOOPS core developer maybe you may consider adding something like this to the core of Xoops.

I think maybe add an option when one adds a custom group that choses between "compatible-- yes or not" (a checkbox). If one group is compatible, then mention it regardless if the user belongs to another group. If it is not, display only the group with higher number (later in the list). Maybe also add a number for importance of the group like in the modules, to make a jerarchy.
The compatible groups will use a if bucle, the others a elseif bucle.

This is just an idea, maybe some of you could add this well done, as you know well php and the XOOPS core.

Salut and keep your great work Hervé, I really like your modules.

Jordi
"Battles are fought by those with the courage to believe. They are won by those who find the heart to share." -MANOWAR

4
hervet
Re: Show the groups of the user in profile
  • 2006/11/22 20:00

  • hervet

  • Friend of XOOPS

  • Posts: 2267

  • Since: 2003/11/4


I just mean that you could write an article and submit it here.

5
jordi_rc
Re: Show the groups of the user in profile
  • 2006/11/22 21:18

  • jordi_rc

  • Not too shy to talk

  • Posts: 114

  • Since: 2006/8/21


I am thinking in starting a blog about xubuntu XOOPS and other things that work well together and I am using.

Write an article here adding what?
Explaining the hack more deeply?

Jordi
"Battles are fought by those with the courage to believe. They are won by those who find the heart to share." -MANOWAR

6
Shine
Re: Show the groups of the user in profile
  • 2006/11/22 21:50

  • Shine

  • Just can't stay away

  • Posts: 822

  • Since: 2002/7/22


I am quit sure Hervet meant to place this writing also within the XOOPS FAQ of this site.

7
jordi_rc
Re: Show the groups of the user in profile
  • 2006/11/22 22:23

  • jordi_rc

  • Not too shy to talk

  • Posts: 114

  • Since: 2006/8/21


That would be a great honor. Thanks Hervé.

Jordi
"Battles are fought by those with the courage to believe. They are won by those who find the heart to share." -MANOWAR

8
hervet
Re: Show the groups of the user in profile
  • 2006/11/23 7:05

  • hervet

  • Friend of XOOPS

  • Posts: 2267

  • Since: 2003/11/4


Quote:

Shine wrote:
I am quit sure Hervet meant to place this writing also within the XOOPS FAQ of this site.

Exact, or in an article.

9
jensclas
Re: Show the groups of the user in profile

or in additional respurces in the workspce at the docs site.

10
jordi_rc
Re: Show the groups of the user in profile
  • 2006/11/23 22:08

  • jordi_rc

  • Not too shy to talk

  • Posts: 114

  • Since: 2006/8/21


If you like the hack it would be an honour to have it added to any section you like.

Feel free to add this text or make any adittions, or tell me how to post it and to where, or if I need to explain something more deeply.

Many people try to get the group shown in the profiles, so maybe it would be nice to add this to the XOOPS core in a better way, not so hard coded.

Thanks a lot again to both, Herve and Jensclas.

Jordi
"Battles are fought by those with the courage to believe. They are won by those who find the heart to share." -MANOWAR

Login

Who's Online

502 user(s) are online (102 user(s) are browsing Support Forums)


Members: 0


Guests: 502


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Oct 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits