Skip to:
Content
Pages
Categories
Search
Top
Bottom

Conditional bp_register_group_extension – how?

  • Avatar of dpolant
    dpolant
    Participant

    @dpolant

    I am trying to only register my groups extension if the user is a site admin. My problem is that bp_register_group_extension doesn’t want to run inside functions or if statements. I’ve tried putting it in functions that hook to wp, init and plugins_loaded but nothing seems to work.

    Any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Avatar of Travel-Junkie
    Boris
    Participant

    @travel-junkie

    You could do something like this instead of your normal registration function:

    function activate_extension()
    {
    global $bp;
    if( is_site_admin() )
    {
    $extension = new Your_Group_Extension_Class_Name;
    add_action( "wp", array( &$extension, "_register" ), 2 );
    }
    }
    add_action( 'plugins_loaded', 'activate_extension' );

    Avatar of dpolant
    dpolant
    Participant

    @dpolant

    Good call. I need to learn more about some of the things add_action can do.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.