By elLoco on
Hi!
I would like to post messages in an Organic Group (in php) and that the message should look different if the user has subscribed to the Group or not. How can I find out if the logged in user has subscribed to a Group or not?
This is roughly the post I want to do in e.g. a group called 'groupX':
If logged in user != member of the groupX {
print 'click here to subscribe'; }
else if logged in user == member of the groupX {
print 'click here to see other user in this group'; }
I don't know how to get the statements in: '== member of the groupX'. How do I know if a user has subscribed to a specific group or not?
Thanks!
elLoco
Comments
The following example
The following example assumes a group node called $group.
---
If you have any trouble creating, configuring, or adding features to your Drupal website, I can help!
You can contact me through my personal contact form.
Sorry for being a
Sorry for being a beginner....
In your example the name is 'group' and the variable is '$group'. If I have a long group name what will my variable be? For example: if I name a group 'my new group' what will the $ variable be? $my_new_group? or the node number?
Thanks again!
This is how I solved
This is how I solved it:
My group is in 'node/138'.
Please correct it, if it is a bad solution!
Thanks!
You misunderstood me
You misunderstood me. I thought that you would already be in a situation where you loaded the appropriate group node into a variable called $group (regardless of what the node title is).
Use the node_load($nid) function if you haven't loaded the node. Consult api.drupal.org if you have trouble.
-cwgordon7
---
If you have any trouble creating, configuring, or adding features to your Drupal website, I can help!
You can contact me through my personal contact form.
Thanks!
Thank you! Sorry for my misunderstanding.
elLoco
check for member
I just encountered this issue today and the correct syntax to see if a user is a member of a particular group is as follows:
-------------------------------------------------------
"If you don't read the newspaper you are uninformed;
if you do read the newspaper you are misinformed."
-- Mark Twain