Skip to:
Content
Pages
Categories
Search
Top
Bottom

Adding user to group programmatically


  • manelmonteiro
    Participant

    @manelmonteiro

    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);
    _________________________________________-

Viewing 1 replies (of 1 total)

  • manelmonteiro
    Participant

    @manelmonteiro

    UPDATE!
    even tho, in the group nothing appears, in the user’s profile, there’s a notice saying that the user has joined the group. what the hell is going on??

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar