create shortcode to list users with specific meta key value

Try this: function thebroker_agents() { global $current_user; $bmail = $current_user->user_email; $user_query = new WP_User_Query( array( ‘meta_key’ => ‘broker_email’, ‘meta_value’ => $bmail, ‘fields’ => ‘all’ ) ); $users = $user_query->get_results(); if (!empty($users)) { $results=”<ul>”; foreach ($users as $user){ $results=”<li>” . $user->display_name . ‘</li>’; } $results=”</ul>”; } else { $results=”No users found”; } wp_reset_postdata(); return $results; } … Read more

wordpress editor role remove all but ‘menus’ in appearance menu

by default the editor role should not have access to plugins nor appearance menu. But maybe this roles is already customised in your installation? here is a list of editor default capabilities via functions.php you can remove everything in the appearance menu like so: $role_object = get_role( ‘editor’ ); $role_object->remove_cap( ‘edit_theme_options’ ); to remove access … Read more

change wp user status from wp_users table

User roles are not stored in wp_user table. They are stored as User Metadata. In wp_usermeta you can find two rows for every user: <prefix>capabilities (for example wp_capabilities) which contains serialized array of roles assigned to that user <prefix>user_level (for example wp_user_level) which contains level of given user. It’s important to remember, that keys for … Read more

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