Send a confirmation of user role upgrade conditionally

Quite possibly something like this might work; function user_role_update( $user_id, $new_role ) { $site_url = get_bloginfo(‘wpurl’); $user_info = get_userdata( $user_id ); if (user_can( $user_id, ‘capability’ ) ) { $to = $user_info->user_email; $subject = “Role changed: “.$site_url.””; $message = “Hello ” .$user_info->display_name . ” your role has changed on “.$site_url.”, congratulations you are now an ” … Read more

How to remove “Super Admin” from All Users for those that are not a “Super Admin”?

This list of filters at the top of admin screens are called Views. You can manage views using the views_{$this->screen->id} filter. Where you’d replace {$this->screen->id} with the name of the screen you’d like to manage. In order to filter the Users screen, you can try the following: // filter the ‘users’ views add_filter( “views_users”, “wse57231_filter_user_views”); … Read more

Assigning a category to a user role

This may be similar to what you are looking for, it doesn’t force a category, but doesn’t let the user submit the new post unless at least one category is selected This solution requires jQuery, but with little modification can be ported to plain JavaScript //intercept the “update” or “publish” button $(“#post”).submit(function(e){ //grab the GET … Read more

how to add custom user capabilities using add_user_meta or something else?

Try passing the value without serializing it manually, because WordPress will do it for you anyway: add_user_meta( $user->id, ‘orewpst_capabilities’, array( ‘author’ => 1 ), true ); or update_user_meta( $user->id, ‘orewpst_capabilities’, array( ‘author’ => 1 ) ); // it will create the meta data for you if it doesn’t exist already. The s:23 means that you … Read more

Restrict Author to pick from media library, but not upload media

Just taking a rough stab at this… add_filter(‘media_upload_tabs’, ‘modify_media_tabs’); function modify_media_tabs($tabs) { if (is_super_admin()) return $tabs; return array( ‘type_url’ => __(‘From URL’), ‘gallery’ => __(‘Gallery’), ‘library’ => __(‘Media Library’) ); } add_filter(‘_upload_iframe_src’, ‘change_default_media_tab’); function change_default_media_tab($uri) { if (is_super_admin()) return $uri; return $uri.’&tab=library’; } add_action(‘current_screen’, ‘check_uploading_permissions’); function check_uploading_permissions() { if (is_super_admin()) return; if (get_current_screen()->id == ‘media-upload’ … Read more

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