[support] How can I tell if a user if a user is a member of an OG group?

Neil: esl-lounge.com neil at esl-lounge.com
Mon May 26 22:06:59 UTC 2008


Hmm, it doesn't seem to exist. When I print out $user, this is what I see on 
a group node I'm a member of:

[og_groups] => Array ( [217] => Array ( [title] => Test Group 1 [type] => 
group [status] => 1 [nid] => 217 [og_role] => 0 [is_active] => 1 [is_admin] 
=> 1 [uid] => 2 [mail_type] => [created] => 1210943771 [changed] => 
1211236434 ) [229] => Array ( [title] => Test Group 2 [type] => group 
[status] => 1 [nid] => 229 [og_role] => 0 [is_active] => 1 [is_admin] => 1 
[uid] => 2 [mail_type] => [created] => 1211457708 [changed] => 
1211457721 ) )

so the is_active part of that array seems important. I could use the 
$node->nid (217) to access this info. Does that sound possible? It's a 
nested array (217 inside og_groups). So the code I would need would be: if 
is_active equals 1 inside 217 inside og_groups. More or less?? :-)

Neil

----- Original Message ----- 
From: "Earnie Boyd" <earnie at users.sourceforge.net>
To: <support at drupal.org>
Sent: Monday, May 26, 2008 5:22 PM
Subject: Re: [support] How can I tell if a user if a user is a member ofan 
OG group?


> Quoting "Neil: esl-lounge.com" <neil at esl-lounge.com>:
>
>> I would like to show a link on a group node if a user is a member and
>> another link if they are not. I looked through og.module and found
>> the $subscription variable. I tried both the following without any
>> success:
>>
>> <?php if($subscription == 'active') : ?>
>> already a member!
>> <?php else: ?>
>> Join Today!
>> <?php endif; ?>
>>
>> <?php if($subscription) : ?>
>> already a member!
>> <?php else: ?>
>> Join Today!
>> <?php endif; ?>
>>
>> But I'm getting "Join Today" showing whether the user is a member or
>> not. I imagine this means the $subscription variable isn't available
>> in this context.
>>
>> does anyone know how to find out if a user is a member of an OG group?
>>
>
> I'm guessing you need a global $subscription; added to the code.
>
> Earnie -- http://for-my-kids.com/
> -- http://give-me-an-offer.com/
>
> -- 
> [ Drupal support list | http://lists.drupal.org/ ]
> 



More information about the support mailing list