xoops forums

jbaudin

Just popping in
Posted on: 2004/2/18 7:52
jbaudin
jbaudin (Show more)
Just popping in
Posts: 42
Since: 2004/1/22
#1

Get the user group !

I want to know how can i see if a user is in a specified group ?

I want to display one html link (no block or module) if user is in one group not other.

Thank you for your help !


Sorry, i am french and i don't speak english very well !

Mithrandir

XOOPS is my life!
Posted on: 2004/2/18 14:16
Mithrandir
Mithrandir (Show more)
XOOPS is my life!
Posts: 6320
Since: 2003/6/21
#2

Re: Get the user group !

You can use $xoopsUser->getGroups() to get an array with the groups, a user belongs to and then see if the desired group is in that array.

If you only have the name of the group and not the ID, you'll have to look into the XoopsGroupHandler::getObjects() method.

jbaudin

Just popping in
Posted on: 2004/2/18 14:45
jbaudin
jbaudin (Show more)
Just popping in
Posts: 42
Since: 2004/1/22
#3

Re: Get the user group !

Thank you, but i'm not superman with PHP.

I want to disable link in theme.html
For cutomise my page when a user is connected or not, i use thise code :

<{if $xoops_isuser}>
<tr id="headerlogo_connect">
<{else}>
<tr id="headerlogo">
<{/if}>

How can i do the same thing with group ?
Like this :
<{if $xoops_usergrp='1'}>
<tr id="headerlogo_connect">
<{else}>
<tr id="headerlogo">
<{/if}>

I think i must modified header.php, but i don't know how to do that.
It's just for one group, i want to disable a link.

Thank you !