How to make WordPress ‘editor’ role to list/view/add/edit users only with the role ‘author’?

In addition to the code piece in the question, 1. To display only the author roles in the user list page of editor: add_action(‘pre_user_query’,’editors_edit_author_list’); function editors_edit_author_list($user_search) { $user = wp_get_current_user(); if($user->ID != 1) { $user_meta=get_userdata($user->ID); //$user_roles= $user_meta->roles; global $wpdb; if(in_array(‘editor’, $user_meta->roles)) { $user_search->query_where = str_replace( ‘WHERE 1=1’, “WHERE 1=1 AND {$wpdb->users}.ID IN ( SELECT {$wpdb->usermeta}.user_id … Read more

Assign user role by text field in WordPress (Woocommerce) [closed]

Here is the code: function ur_update_role( $valid_form_data, $form_id, $user_id ) { global $table_prefix; $assign_roles_list = array(); if( isset( $valid_form_data[‘billing_ie’]) && !empty( $valid_form_data[‘billing_ie’]->value ) ) { array_push( $assign_roles_list, ‘ie’ ); } if ( ! empty( $assign_roles_list ) ) { // Re-ordering roles according to priority. $user_roles_list = ur_get_default_admin_roles(); foreach ( $user_roles_list as $key => $value ) … Read more

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