Skip to:
Content
Pages
Categories
Search
Top
Bottom

How do I selectively register a group extension?


  • Boris
    Participant

    @travel-junkie

    Hey,

    the way I have set the registration process up is that users have to choose what kind of account they want. The choices are as a normal user or as an organization. When they choose organization they automatically get a group created for them. I then add some meta data to that group (‘group_type’, ‘organization’).

    Now I’ve started to work on a group extension, using the new group API. The problem I’ve run into now is how do I make sure that this group extension only gets loaded when group_type is ‘organization’?

    I’ve tried playing around with the function bp_register_group_extension, but I only managed to either get it loaded with every group or not at all.

    I appreciate any help!

    Cheers,

    Boris

Viewing 1 replies (of 1 total)

  • Boris
    Participant

    @travel-junkie

    Ok, it seems I’ve got it working now. I ended up copying and modifying bp_register_group_extension:

    function activate_skool_courses()
    {
    global $bp;
    $type = groups_get_groupmeta( $bp->groups->current_group->id, 'group_type' );
    if( $type == 'organization' )
    {
    $extension = new Group_Skool_Courses;
    add_action( "wp", array( &$extension, "_register" ), 2 );
    }
    }
    add_action( 'plugins_loaded', 'activate_skool_courses' );

Viewing 1 replies (of 1 total)
  • The topic ‘How do I selectively register a group extension?’ is closed to new replies.
Skip to toolbar