Hot answers tagged

2

Interesting functionality, you will need something that does this: Will need to use the hook set_user_role to detect when user role change Then will need to query all posts from that user Then use wp_update_post to change the post status


2

1) Install & network activate User Role Editor plugin from http://example.com/wp-admin/network/plugins.php 2) Then go to Settings > User Role Editor menu on network and make sure you have the settings as shown in following screenshot. 3) Go to "User Role Editor" settings page on your main site ...


1

I just found a very simple solution. If you haven't already - install some form of a capabilities manager plugin. Then, create a new capability from within the capabilities manager - call it "CUSTOM_CAPABILITY_NAME" or whatever you want. Then assign it to a specific role or user. Important: copy and backup and file you intend to modify in case you f*ck ...


1

option 1 is definitely easier and less prone to errors/accidents than changing publish settings every time an author changes roles. To do so globally you should add a filter to the_content (and other content items in your page/post loops) which checks for the author's role and return some text to inform the viewer that the content is not currently ...


1

use the profile_update hook and in the hooked function, run this check to make sure that it's adding the previous data to the users profile on update too. if ( $update ){ do_action('profile_update', $user_id, $old_user_data); }else{ do_action('user_register', $user_id); } return $user_id; This answer can help you understand it more: ...


1

Your problem is that current_user_can() takes a capability not a user role. So, to check for an administrator, for example, you might use: if ( current_user_can( 'manage_options' ) ) { ... } because ordinarily only admins can manage options. You'd have to tie your custom user roles to capabilities that correspond to their roles, which are defined for ...



Only top voted, non community-wiki answers of a minimum length are eligible