WordPress 4.7 capabilities issue
-
Hey guys,
I have the most current version of bbPress installed: 2.5.11
Just installed WordPress 4.7
These Top Level menus are not being displayed due to a “capabilities” issue. Forums, Topic and Replies. ie I do not have sufficient permissions to view those menus or any bbPress menus anywhere.If I go to the WP Dashboard and click links in the metabox I see this error: Sorry, you are not allowed to edit posts in this post type. I will be looking at forums/capabilities.php and other capabilities.php files to see if I can figure this out, but just wanted to give you a Heads Up about this. Of course this could be isolated to my sites. I deactivated all other plugins and the same issue is still occurring. So it does appear to be an issue directly with bbPress capabilities.
-
LOL rolled the site back to WP 4.6.1 and the site is dead now. Got to love it. fun stuff π
Wierd and wierder. Somehow WP wanted to use the 2017 theme and killed the site. When I went forward to 4.7 the 2017 theme was activated, but at least the site was loading again. Switched back to my theme and the site still loads. So I guess I have to live without bbPress menus until I can figure out what is wrong. π
Another factor in the equation is that I can create new Topics and Replies on the frontend of the site. So it seems that whatever capabilities issue is going on it only affects /wp-admin/ ie is_admin().
So anyway as far as the DB is concerned I have all the necessary caps, which I expected. Still poking around in stuff.
[switch_themes] => 1 [edit_themes] => 1 [activate_plugins] => 1 [edit_plugins] => 1 [edit_users] => 1 [edit_files] => 1 [manage_options] => 1 [moderate_comments] => 1 [manage_categories] => 1 [manage_links] => 1 [upload_files] => 1 [import] => 1 [unfiltered_html] => 1 [edit_posts] => 1 [edit_others_posts] => 1 [edit_published_posts] => 1 [publish_posts] => 1 [edit_pages] => 1 [read] => 1 [level_10] => 1 [level_9] => 1 [level_8] => 1 [level_7] => 1 [level_6] => 1 [level_5] => 1 [level_4] => 1 [level_3] => 1 [level_2] => 1 [level_1] => 1 [level_0] => 1 [edit_others_pages] => 1 [edit_published_pages] => 1 [publish_pages] => 1 [delete_pages] => 1 [delete_others_pages] => 1 [delete_published_pages] => 1 [delete_posts] => 1 [delete_others_posts] => 1 [delete_published_posts] => 1 [delete_private_posts] => 1 [edit_private_posts] => 1 [read_private_posts] => 1 [delete_private_pages] => 1 [edit_private_pages] => 1 [read_private_pages] => 1 [delete_users] => 1 [create_users] => 1 [unfiltered_upload] => 1 [edit_dashboard] => 1 [update_plugins] => 1 [delete_plugins] => 1 [install_plugins] => 1 [update_themes] => 1 [install_themes] => 1 [update_core] => 1 [list_users] => 1 [remove_users] => 1 [promote_users] => 1 [edit_theme_options] => 1 [delete_themes] => 1 [export] => 1 [keep_gate] => 1 [spectate] => 1 [participate] => 1 [moderate] => 1 [throttle] => 1 [view_trash] => 1 [publish_forums] => 1 [edit_forums] => 1 [edit_others_forums] => 1 [delete_forums] => 1 [delete_others_forums] => 1 [read_private_forums] => 1 [read_hidden_forums] => 1 [publish_topics] => 1 [edit_topics] => 1 [edit_others_topics] => 1 [delete_topics] => 1 [delete_others_topics] => 1 [read_private_topics] => 1 [publish_replies] => 1 [edit_replies] => 1 [edit_others_replies] => 1 [delete_replies] => 1 [delete_others_replies] => 1 [read_private_replies] => 1 [manage_topic_tags] => 1 [edit_topic_tags] => 1 [delete_topic_tags] => 1 [assign_topic_tags] => 1 [administrator] => 1 [bbp_keymaster] => 1
I’m starting to think there is an “include” missing somewhere that is not loading the admin.php and actions.php files.
I guess since no one else is reporting any problems then it must have something to do with my setup. So far eliminated any/all functions in my theme functions.php file. So maybe the 2017 theme trying to load was a clue. time to look at themes and loaders.
Nope not a theme or loader issue. Back to pokin around.
I have the same issue. I updated to wordpress 4.7 and lost settings and capabilities from my admin users. All are keymaster.
I created a new admin account and they has all privileges and capabilities. Tabs (Forums, Replies, etc.) are back for this account but not in others.
ran the wp update – never had your problems.
my problem was: couldn’t see the forums in wp-admin and that was sorted by installing simple plugin “User Role Editor” as suggested here by Cydrop: https://bbpress.org/forums/topic/cannot-see-forums-tab-in-wordpress-dashboard/#post-140838
@vcgs – Yep, that worked for me too. Thanks for that π I had tried updating the existing keymaster user account, but did not think to try creating a new administrator user account and instead checked capabilities of the existing keymaster user account. Ok so the issue is a db option or value issue then most likely/logically in the wp_usermeta DB Table. What I will do in a little bit is compare the old existing keymaster user account db options and values to the newly created keymaster user account db options and values to see what is different. I assume that once I figure out what is different, a manual DB option or value can be created for any older administrator/keymaster Roles so that everything works for them too. Will post back here when I figure that out. thanks again vcgs π
Ey @aitpro! THanks for posting. Yes, sounds to be that. Hope you find the solution. I will do the same.
thanks! π
@vcgs – All the bbPress backend menus disappeared again after I refreshed the Dashboard backend for the first time after creating the new administrator/keymaster user account. So that must mean the usermeta data is being updated somewhere “after the fact” and that is the root cause of the problem. Very Rough General Example: If WP version is X then update Y usermeta data. At least I know exactly where I should be looking. So thanks for that. π
Oh my don’t I feel like a dummy. The problem is a Session/Cookie problem. You just need to clear all cookies/cache in your Browser back to a time before you upgraded to WP 4.7. ha ha ha π
ΒΏSure? OMG!! Thanks a lot!!
yeah too funny huh? Went way way way too deeeeeeeeeeeeep on this one. ha ha ha. Anyway thanks again for getting me pointed in the right direction. Intermittent problems (menus appeared briefly then disappeared again) are always related to these types of things: php memory/cache/caching plugins/CDNβs/VPNβs/Proxyβs/Load Balancers/Host server problems (DNS server/DNS configuration problem, MySQL server timeout, server overloaded, etc), /Browser problems (corrupt cache, add-on, extension)/ISP (connectivity)/CloudFlare, etc.
hmm the problem returned again. Ok so it is definitely Session/Cookie related, but there is some other factor involved here.
Oh well I give up for now. I can live without any bbPress backend menus since everything works fine on the frontend. I’ll probably look at this some other day. π
Side Note Bonus: I did stumble across a solution for another problem that I could not figure out before, which is when I switched Themes my Theme stylesheet would no longer load and the Theme displayed without any CSS/broken. The problem is with this DB value: wp_options > template_root > the value was being updated with the full literal path to: C:\xampp\htdocs4\buddypress\wp-content\plugins\buddypress/bp-themes (on a Live Hosted site the path was also the full URL) and the value must be this relative path instead: /plugins/buddypress/bp-themes
Eureka I found where the problem is. Yeah!
On my Live site this is the DB value for wp_options > wp_user_roles is missing the “keep_gate” and all other capabilities.
Live site DB value:
s:13:"bbp_keymaster";a:2:{s:4:"name";s:9:"Keymaster";s:12:"capabilities";a:0:{}}
Local Dev test site DB value:
s:13:"bbp_keymaster";a:2:{s:4:"name";s:9:"Keymaster";s:12:"capabilities";a:29:{s:9:"keep_gate";b:1;s:8:"spectate";b:1;s:11:"participate";b:1;s:8:"moderate";b:1;s:8:"throttle";b:1;s:10:"view_trash";b:1;s:14:"publish_forums";b:1;s:11:"edit_forums";b:1;s:18:"edit_others_forums";b:1;s:13:"delete_forums";b:1;s:20:"delete_others_forums";b:1;s:19:"read_private_forums";b:1;s:18:"read_hidden_forums";b:1;s:14:"publish_topics";b:1;s:11:"edit_topics";b:1;s:18:"edit_others_topics";b:1;s:13:"delete_topics";b:1;s:20:"delete_others_topics";b:1;s:19:"read_private_topics";b:1;s:15:"publish_replies";b:1;s:12:"edit_replies";b:1;s:19:"edit_others_replies";b:1;s:14:"delete_replies";b:1;s:21:"delete_others_replies";b:1;s:20:"read_private_replies";b:1;s:17:"manage_topic_tags";b:1;s:15:"edit_topic_tags";b:1;s:17:"delete_topic_tags";b:1;s:17:"assign_topic_tags";b:1;}}
The wierd thing is why would this have been an intermittent problem? That is going to be tricky thing to figure out. π
Even funnier. All I had to do was deactivate and activate bbPress again. I usually do manual upload upgrading since in past versions of bbPress and BuddyPress my site would crash if I did a normal plugin update or even deactivating and activating bbPres and BuddyPress and I would have to restore the database. Anyway took a chance and no site crash and all capabilities were updated successfully. Yeah!
Also I don’t know if this function I created to add capabilities did anything in combination with deactivating and activating bbPress, but this function was in my Theme functions.php file during the process of doing the deactivation and activation. π
// bbPress Keymaster capabilities fix function aitpro_add_caps_bbp_keymaster_fix() { $capabilities = array( 'keep_gate', 'spectate', 'participate', 'moderate', 'throttle', 'view_trash', 'publish_forums', 'edit_forums', 'edit_others_forums', 'delete_forums', 'delete_others_forums', 'read_private_forums', 'read_hidden_forums', 'publish_topics', 'edit_topics', 'edit_others_topics', 'delete_topics', 'delete_others_topics', 'read_private_topics', 'publish_replies', 'edit_replies', 'edit_others_replies', 'delete_replies', 'delete_others_replies', 'read_private_replies', 'manage_topic_tags', 'edit_topic_tags', 'delete_topic_tags', 'assign_topic_tags' //'test' ); $role = get_role( 'bbp_keymaster' ); foreach( $capabilities as $cap ) { $role->add_cap( $cap ); } } add_action( 'admin_init', 'aitpro_add_caps_bbp_keymaster_fix');
Oh no, I have the same compatibility issues… Let’s hope this gets fixed ASAP
Now that I installed the plugin “User role editor”, everything seems to be working again. Weird, well anyhow, lets hope this bug gets fixed.
Please keep an eye on https://bbpress.trac.wordpress.org/ticket/3028 (Or #bbPress in Slack)
I’m actively trying to resolve the as we speak and will post updates to that ticket
- You must be logged in to reply to this topic.