Adding user to group programmatically
-
Hi there,
I need to, with the user that is logged in, both create a group and add said user as the admin of the group. I’m able to create the group, But when I try to add the user, it just doesn’t want to work.
if any kind soul would help me on this I would greatly appretiate it 🙂
_________________code used________________________
//create group
$candidate_id = bp_loggedin_user_id();
$defaults = array(
‘group_id’ => $this->job_id,
‘creator_id’ => $candidate_id,
‘name’ => ‘asd’,
‘description’ => ‘sdf’,
‘slug’ => ‘dfg’,
‘status’ => ‘private’,
‘enable_forum’ => 1,
‘date_created’ => bp_core_current_time()
);
groups_create_group( $this->job_id );//add user to the group
groups_join_group( $this->job_id, $candidate_id);
_________________________________________-
- You must be logged in to reply to this topic.