WordPress.org

Ready to get started?Download WordPress

Forums

BuddyPress Groupblog
[resolved] No default member roles with Buddypress 1.7 (8 posts)

  1. Mike
    Member
    Posted 1 year ago #

    The cause appears to be pointed out in the following notice, logged in debug mode when the plugin tries to set up the globals:

    PHP Notice: Indirect modification of overloaded property BuddyPress::$groupblog has no effect in /Users/xxxxxx/git/myblog/wp-content/plugins/bp-groupblog/bp-groupblog.php on line 87

    http://wordpress.org/extend/plugins/bp-groupblog/

  2. Mike
    Member
    Posted 1 year ago #

    This seems to fix it:

    function bp_groupblog_setup_globals() {
    	global $bp, $wpdb;
    
    	if ( !isset( $bp->groupblog ) || !is_object( $bp->groupblog ) ) {
    	    $bp->groupblog = new stdClass;
    	}
    	$bp->groupblog->image_base = WP_PLUGIN_DIR . '/bp-groupblog/groupblog/images';
    	$bp->groupblog->slug = BP_GROUPBLOG_SLUG;
    	$bp->groupblog->default_admin_role = BP_GROUPBLOG_DEFAULT_ADMIN_ROLE;
    	$bp->groupblog->default_mod_role = BP_GROUPBLOG_DEFAULT_MOD_ROLE;
    	$bp->groupblog->default_member_role = BP_GROUPBLOG_DEFAULT_MEMBER_ROLE;
    
    }
  3. valuser
    Member
    Posted 1 year ago #

    Gives a white screen - perhaps i have not understood properly!

    inserted `if ( !isset( $bp->groupblog ) || !is_object( $bp->groupblog ) ) {
    $bp->groupblog = new stdClass;`

    at line 82 of bp-groupblog.php.

    Was this the correct remedy ?

  4. Mike
    Member
    Posted 1 year ago #

    Yes, it worked OK here. Try a copy and paste of the whole function I list above, over your existing bp_groupblog_setup_globals function.
    You're missing a closing brace in your comment - don't know if you are doing the same in your code.

  5. valuser
    Member
    Posted 1 year ago #

    You are certainly correct. My apology.

    BUT BUT

    you must also have got over the glitch thats explained here ??? http://wordpress.org/support/topic/redirect-goes-to-wp-admin?replies=6

    Have you any ideas that you might share about this. Please!

    I just think this plugin is a hugely important one.

    Thanks again

  6. Mike
    Member
    Posted 1 year ago #

    Ah. Yes, I did make a workaround for that recently. I didn't realise it was an issue for others too. Here's my function - try dropping this in in place of the existing one in bp-groupblog/bp-groupblog.php

    /**
     * groupblog_screen_blog()
     *
     * This screen gets called when the 'group blog' link is clicked.
     */
    function groupblog_screen_blog() {
    	global $bp;
    
    	if ( bp_is_groups_component() && bp_is_current_action( 'blog' ) ) {
    
    		$checks = get_site_option('bp_groupblog_blog_defaults_options');
    		$blog_details = get_blog_details( get_groupblog_blog_id(), true );
    
    		if ( isset( $checks['redirectblog'] ) && $checks['redirectblog'] == 1 ) {
    			$location = wp_sanitize_redirect($blog_details->siteurl);
    			wp_redirect( $location );
    		}
    		else if ( isset( $checks['redirectblog'] ) && $checks['redirectblog'] == 2 ) {
    			$location = wp_sanitize_redirect($blog_details->siteurl);
    			wp_redirect( $location . '/' . $checks['pageslug'] . '/' );
    		}
    		else {
    			if ( file_exists( locate_template( array( 'groupblog/blog.php' ) ) ) ) {
    				bp_core_load_template( apply_filters( 'groupblog_screen_blog', 'groupblog/blog' ) );
    				add_action( 'bp_screens', 'groupblog_screen_blog' );
    			}
    			else {
    			 	add_action( 'bp_template_content', 'groupblog_screen_blog_content' );
    				bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'groups/single/plugins' ) );
    			}
    		}
    	}
    }
  7. valuser
    Member
    Posted 1 year ago #

    Wow! Many many thanks! Perfect! What a day! I don't mind gushing! Thank you so much!

  8. Mike
    Member
    Posted 1 year ago #

    No problem ;)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.