Skip to:
Content
Pages
Categories
Search
Top
Bottom

Group Creation Button within User Profile for BuddyPress

  • Avatar of MickeyRoush
    MickeyRoush
    Participant

    @mickeyroush

    As the title states I’m trying to create a Group Creation Button within the user’s profile. I’ve tried this code, which I found using Google:

    `function groups_subnav_hook() {
    global $bp;

    $groups_link = $bp->loggedin_user->domain . $bp->groups->slug . ‘/’;

    bp_core_new_subnav_item( array(
    ‘name’ => ‘Create New Group’ ,
    ‘slug’ => ‘create’,
    ‘parent_slug’ => $bp->groups->slug,
    ‘parent_url’ => $groups_link,
    ‘position’ => 10,
    ‘screen_function’ => ‘groups_screen_group_members’,
    ‘user_has_access’ => bp_is_my_profile() // Only the logged in user can access this on his/her profile
    ) );
    }
    add_action( ‘wp’, ‘groups_subnav_hook’, 2 );
    add_action( ‘admin_menu’, ‘groups_subnav_hook’, 2 );`

    While it creates the button, etc. it also causes the default group creation button within the Groups page to redirect to the home page when clicked. The button within the user profile does the same thing. I believe part of the code above is depreciated, but I don’t believe that would cause it to redirect to the home page.

    I would be happy if the button within the user profile just redirected the user to the Groups page where they can click the create button from there. Any tips would be greatly appreciated.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.