xoops forums

daviddu54

Just popping in
Posted on: 2006/8/1 20:37
daviddu54
daviddu54 (Show more)
Just popping in
Posts: 22
Since: 2006/8/1 2
#1

hack to post the groups

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

birdseed

Just popping in
Posted on: 2006/8/1 23:26
birdseed
birdseed (Show more)
Just popping in
Posts: 59
Since: 2005/2/26
#2

Re: hack to post the groups

//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

daviddu54

Just popping in
Posted on: 2006/8/1 23:59
daviddu54
daviddu54 (Show more)
Just popping in
Posts: 22
Since: 2006/8/1 2
#3

Re: hack to post the groups

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

daviddu54

Just popping in
Posted on: 2006/8/2 0:13
daviddu54
daviddu54 (Show more)
Just popping in
Posts: 22
Since: 2006/8/1 2
#4

Re: hack to post the groups

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');

daviddu54

Just popping in
Posted on: 2006/8/2 21:33
daviddu54
daviddu54 (Show more)
Just popping in
Posts: 22
Since: 2006/8/1 2
#5

Re: hack to post the groups

Nobody for help me to displays groups name in userinfo?

jordi_rc

Not too shy to talk
Posted on: 2006/11/14 22:33
jordi_rc
jordi_rc (Show more)
Not too shy to talk
Posts: 114
Since: 2006/8/21
#6

Re: hack to post the groups

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

daviddu54

Just popping in
Posted on: 2006/11/15 21:55
daviddu54
daviddu54 (Show more)
Just popping in
Posts: 22
Since: 2006/8/1 2
#7

Re: hack to post the groups

hi jordi


thanks, your hack work fine and it very simple

jordi_rc

Not too shy to talk
Posted on: 2006/11/15 22:24
jordi_rc
jordi_rc (Show more)
Not too shy to talk
Posts: 114
Since: 2006/8/21
#8

Re: hack to post the groups

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