SooperGenius (@soopergenius)

Forum Replies Created

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

  • SooperGenius
    Participant

    @soopergenius

    Nevermind, Robin. It’s just a Notice and not an error at this point. I’m not going to stress over it at the moment. The code is working fine. Thanks for the help.


    SooperGenius
    Participant

    @soopergenius

    is_bbpress() almost works. Thanks for the pointer there, by the way. I can’t see how I missed that function in all my searching. I failed my Google-fu obviously. My code now looks like this in the my-plugin.php file.

    function forum_lock_check($allcaps, $cap) {
    	if (function_exists("is_bbpress")) {
    		$is_bbpress = is_bbpress();
    	} else {
    		$is_bbpress = false;
    	}
    	
    	return $allcaps;
    }
    
    add_filter("user_has_cap", "forum_lock_check", 10, 3); 

    Here’s the funny part. (Funny = weird not Funny = haha) If I’m navigating to the main forums page (http://localhost/wordpress/forums/), then everything proceeds swimmingly. If I then navigate to a forum within the page (http://localhost/wordpress/forums/forum.forum-a) or to a thread within the forum (http://localhost/wordpress/forums/topic/post-1) I then get several of the following errors.

    Notice: Trying to get property of non-object in C:\xampp\htdocs\wordpress\wp-includes\query.php on line 3792
    
    Notice: Undefined property: WP_Query::$post in C:\xampp\htdocs\wordpress\wp-includes\query.php on line 3306

    Commenting out the “$is_ppbress = is_bbpress();” line removes the errors but I’ve got no idea why WordPress suddenly doesn’t like the code. Have you seen this before? What file is is_bbpress() in?

    Thanks, Robin.

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