The groups_join_group action gets passed the group_id as its first parameter:
e.g. do_action( ‘groups_join_group’, $group_id, $user_id );
So, you have the group_id already.
Interestingly, there doesn’t seem to be a function to get the creator – so, you would then either have to:
Create a new BP_Group instance using the group_id, and directly access the it’s ->creator_id attribute, or
Make a direct SQL call on $bp->groups->table_name to return the creator_id where the id = group_id
Thanks @roger , All know that without having the group_id , no one canot perform the ‘groups_join_group’ , But I need this group_id as follows,
function get_group()
{
return group_id();
}
add_action(‘groups_join_group’,’get_group’);
I need the get_group() function should return the group_id where it is hooked into ‘groups_join_group’ as add_action.
@Roger you can try more 🙂
Does any one can get this 🙂 thanks
As I said previously, the group_id is passed as the first parameter to the action.
You need to add the parameters to your function.
If you are not familiar with writing action functions in WordPress, you should read here: https://codex.wordpress.org/Function_Reference/add_action
well, worked , Thanks @rogercoathup