Skip to:
Content
Pages
Categories
Search
Top
Bottom

Groupblog Plugin questions


  • David
    Participant

    @dlabbe

    @MariusOoms This can actually be for anyone that can help. First the pugin is perfect for what I need, but just trying to get used to how it all functions within the site and how the member roles play. My issue that I am trying to solve is as follows.
    I have groups that i create and not the members and I set who I want for a moderator for each group. Each group will have a different moderator therefore control their own blogs and post. When a member logs onto the dashboard to make a post there is a link “My Sites” that shows all the sites/groupblogs on the network. I only want them to see their own site/blog and not the entire network. I know I can go into each site on the network and click on users and set them so they have no role for that site and that will remove the network sites from their dashboard. However, that would take alot of time and as the site grows….not what I want to do. I also tried the WP Hide Dashboard plugin but it still shows the “My Websites” link. Is there a way to hide the “My Website” link? Or set it so when a new group is made it ads everyone with “no role for this site” instead of “subscriber”? I am just trying everything, but with no luck. Any help would be great. thanks

Viewing 1 replies (of 1 total)

  • David
    Participant

    @dlabbe

    I final got what I was looking for. Here is the code if anyone wants to try it or use it. Paste it in the functions.php of your child themes. What it does is removes the orginal function for the “My Blogs” link in the admin bar and I then made my own function that calls that original function only if the user has a blog. Thus anyone that is just a subscriber to the site will not see the “My Blogs” link in the admin bar (to confuse them).

    /* Removes the function from the buddypress/bp-core/bp-core-adminbar.php file in buddypress plugin*/
    remove_action(‘bp_adminbar_menus’, ‘bp_adminbar_blogs_menu’, 6);
    
    /*reset the “MY Blogs” link function so that it only shows for users that have blogs and not subscribers*/
    function bp_adminbar_mynew_blogs_menu() {
    global $bp;
    
    if ( !is_user_logged_in() || !function_exists(‘bp_blogs_install’) )
    return false;
    
    if ( !$blogs = wp_cache_get( ‘bp_blogs_of_user_’ . $bp->loggedin_user->id . ‘_inc_hidden’, ‘bp’ ) ) {
    $blogs = bp_blogs_get_blogs_for_user( $bp->loggedin_user->id, true );
    wp_cache_set( ‘bp_blogs_of_user_’ . $bp->loggedin_user->id . ‘_inc_hidden’, $blogs, ‘bp’ );
    }
    
    echo ‘
    loggedin_user->domain . $bp->blogs->slug . ‘/”>';
    
    _e( ‘My Blogs’, ‘buddypress’ );
    
    echo ‘‘;
    echo ‘
    
        ‘;
    
        if ( is_array( $blogs ) && (int)$blogs ) {
        $counter = 0;
        foreach ( (array)$blogs as $blog ) {
        $alt = ( 0 == $counter % 2 ) ? ‘ class=”alt”‘ : ”;
        $site_url = esc_attr( $blog->siteurl );
    
        echo ‘
        ‘;
        echo ‘‘ . esc_html( $blog->name ) . ‘‘;
    
        echo ‘
            ‘;
            echo ‘
            ‘ . __( ‘Dashboard’, ‘buddypress’ ) . ‘
    
            ‘;
            echo ‘
            ‘ . __( ‘New Post’, ‘buddypress’ ) . ‘
    
            ‘;
            echo ‘
            ‘ . __( ‘Manage Posts’, ‘buddypress’ ) . ‘
    
            ‘;
            echo ‘
            ‘ . __( ‘Manage Comments’, ‘buddypress’ ) . ‘
    
            ‘;
            echo ‘
    
        ‘;
    
        echo ‘
    
        ‘;
        $counter++;
        }
        }
    
        $alt = ( 0 == $counter % 2 ) ? ‘ class=”alt”‘ : ”;
    
        if ( bp_blog_signup_enabled() ) {
        echo ‘
        ‘;
        echo ‘root_domain . ‘/’ . $bp->blogs->slug . ‘/create/”>’ . __( ‘Create a Blog!’, ‘buddypress’ ) . ‘‘;
        echo ‘
    
        ‘;
        }
    
        echo ‘
    
    ‘;
    echo ‘
    
    ‘;
    
    }
    
    /*checks to see if the logged in user has any blogs. Saves the array values to $blogs and then saves the blog count to $blogcount. The IF statement then will be true if the value is 1 or more thus showing the link in the admin panel for the “My blogs”*/
    $blogs = bp_blogs_get_blogs_for_user( $bp->loggedin_user->id );
    $blogCount = ($blogs);
    
    if ( bp_core_is_multisite() && $blogCount >= 1){
    add_action( ‘bp_adminbar_menus’, ‘bp_adminbar_mynew_blogs_menu’, 6 );
    }
    

    If anyone has a better (cleaner) way to do this please I would love to see it. I am just in the early stage of learning php so any help would be great. Thanks

Viewing 1 replies (of 1 total)
  • The topic ‘Groupblog Plugin questions’ is closed to new replies.
Skip to toolbar