How to limit user to publish post per day and per role?

You can use my plugin Posts Creation Limits which has a per user, per role, per post type, per post status limiting system and combined with its post_creation_limits_custom_checks action hook and check if the user has created a post that day already – if so: show the the “limit reached message”. For example: add_action( ‘post_creation_limits_custom_checks’, … Read more

Only allow administrators and editors to access wp-admin

You’re correct in that you should be checking for a capability. However, manage options is only given to administrators by default. You should check against a capability that both editors and administrators have such as delete_others_posts. function restrict_admin(){ //if not administrator, kill WordPress execution and provide a message if ( ! current_user_can( ‘delete_others_posts’ ) ) … Read more

How to target with css, admin elements according to user role level?

The admin_body_class filter lets you add classes to the body tag. This function will add all roles as classes in the form role-$role, for example role-administrator, to the body tag: function wpa66834_role_admin_body_class( $classes ) { global $current_user; foreach( $current_user->roles as $role ) $classes .= ‘ role-‘ . $role; return trim( $classes ); } add_filter( ‘admin_body_class’, … Read more

How to update user role without logout

I think you are on the right track, wp_cache_delete was what finally helped me get an auto-signup with auto-login plugin working… I have this from there: wp_cache_delete($current_user->ID, ‘users’); wp_cache_delete($current_user->user_login, ‘userlogins’); Then see what roles you get after that with: $current_user = wp_get_current_user();

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)