1
daviddu54
hack to post the groups
  • 2006/8/1 20:37

  • daviddu54

  • Just popping in

  • Posts: 22

  • Since: 2006/8/1 2


hi all

first forgive me for my bad English

So , i try to see the user groups in profil on XOOPS 2.0.13.2 (userinfo.php), i have writting variable so

$usergroups = array(XOOPS_GROUP_USERS);
$xoopsTpl->assign('user_groups', $usergroups);

but don't work,please help me to build this variable.
the variable must display content of groups=>name table ou groups=>group_type

thanks
regard

2
birdseed
Re: hack to post the groups
  • 2006/8/1 23:26

  • birdseed

  • Just popping in

  • Posts: 59

  • Since: 2005/2/26


//Gruppen ermitteln
    
$user_groups = array();
    
$member_handler =& xoops_gethandler('member');
    
$group_list $member_handler->getGroupList();
    foreach(
$thisUser->getGroups() as $group_index)
      
$user_groups[] = $group_list[$group_index];

    
$xoopsTpl->assign('groups'$user_groups);


we did the same thing on our site. this is the code.

greetings
birdseed

3
daviddu54
Re: hack to post the groups
  • 2006/8/1 23:59

  • daviddu54

  • Just popping in

  • Posts: 22

  • Since: 2006/8/1 2


thx birdseed

but,he doesn't work ,only "array" display ,i seek right variable more at 1 week ,look by you self at this adress HERE

at lign "Vous etes: (you are)"

Maybe i must call groups data base with sql command for thats work no?

regard

4
daviddu54
Re: hack to post the groups
  • 2006/8/2 0:13

  • daviddu54

  • Just popping in

  • Posts: 22

  • Since: 2006/8/1 2


this is my data base ,look ,maybe it not same as english data base


--
-- Structure de la table `xoops_groups`
--

CREATE TABLE `xoops_groups` (
`groupid` smallint(5) unsigned NOT NULL auto_increment,
`name` varchar(50) NOT NULL default '',
`description` text NOT NULL,
`group_type` varchar(10) NOT NULL default '',
PRIMARY KEY (`groupid`),
KEY `group_type` (`group_type`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ;

--
-- Contenu de la table `xoops_groups`
--

INSERT INTO `xoops_groups` VALUES (1, 'Webmestres', 'Webmestres de ce site', 'Admin');
INSERT INTO `xoops_groups` VALUES (2, 'Utilisateurs enregistrés', 'Groupe des utilisateurs enregistrés', 'User');
INSERT INTO `xoops_groups` VALUES (3, 'Utilisateurs anonymes', 'Groupe des utilisateurs anonymes', 'Anonymous');
INSERT INTO `xoops_groups` VALUES (4, 'Hommes', 'Groupes des hommes', 'Hommes');
INSERT INTO `xoops_groups` VALUES (5, 'Femmes', 'Groupes des femmes', 'Femmes');
INSERT INTO `xoops_groups` VALUES (6, 'Couples', 'Groupe des couples', 'Couples');

5
daviddu54
Re: hack to post the groups
  • 2006/8/2 21:33

  • daviddu54

  • Just popping in

  • Posts: 22

  • Since: 2006/8/1 2


Nobody for help me to displays groups name in userinfo?

6
jordi_rc
Re: hack to post the groups
  • 2006/11/14 22:33

  • jordi_rc

  • Not too shy to talk

  • Posts: 114

  • Since: 2006/8/21


Hello daviddu54.

I have added the groups of the user to the userinfo.
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:

<tr valign="top">

<td class="head" width="25%"><{$lang_avatar}></td>

<td align="center" class="even"><img src="<{$user_avatarurl}>" alt="Avatar" /></td>

</tr>


And add this after it:

Quote:

<!-- jordi: hack user groups display -->
<tr>
<td class="head" width="25%"><{$lang_grupos}></td>
<td class="odd"><{$user_grupos}></td>
</tr>

<!-- jordi: end of hack user groups display -->



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

I give this hack to all people to adapt this their way, it's GPL!

By the way daviddu54 thanks for your hack of user votes!


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

7
daviddu54
Re: hack to post the groups
  • 2006/11/15 21:55

  • daviddu54

  • Just popping in

  • Posts: 22

  • Since: 2006/8/1 2


hi jordi


thanks, your hack work fine and it very simple

8
jordi_rc
Re: hack to post the groups
  • 2006/11/15 22:24

  • jordi_rc

  • Not too shy to talk

  • Posts: 114

  • Since: 2006/8/21


I am happy you liked and it works for you.

I also posted this to the hacks forum.

Au revoir

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

167 user(s) are online (88 user(s) are browsing Support Forums)


Members: 0


Guests: 167


more...

Donat-O-Meter

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

Latest GitHub Commits