Is a user_meta research case-sensitive or not

Solution found : to make a case-sensitive search for a meta_key / meta_value pair : a hardcoded mysql query on the usermeta table with the BINARY keyword, with get_results() method of $wpdb object: global $wpdb; $sql = $wpdb->prepare( “SELECT user_id FROM {$wpdb->prefix}usermeta WHERE meta_key = ‘unique_id’ AND BINARY meta_value=”unique_id_value””); $wordpress_user_query = $wpdb->get_results( $sql);

Get all user meta by meta key instead of ID

Two options. The first will keep you away from custom SQL, and should be a lot more efficient than what you currently have. It runs two queries, one to get the user ID with the highest hourly rate, and then again to get the lowest. You need one more query to update the user meta … Read more

Updating user meta

One of two functions you’ll need; update_user_meta or add_user_meta – more often than not you’ll just need the former, but it’s worth noting the difference: add_post_meta will only create an entry if the $unique parameter is false, or if there is no existing data for $meta_key. update_post_meta will add if no data exists yet, otherwise … Read more

User Last Login Sort Column

I don’t see anywhere in your code that the query is being modified. Just flagging a column to be sortable doesn’t mean it knows how to sort the data – it will just add the little up/down arrow and make the column clickable but you have to intercept the query var accordingly and tell WP … Read more

Add user data to table when user is created?

Looks to me you should be seeking a woocommerce purchase completion hook. This would be when you could add that a donation has been made and at what amount, then you could grab any user information, amounted donated and other info you need and save it to your donor table. use this: add_action(‘woocommerce_order_status_completed’, ‘save_to_donors’,10,1); instead … Read more

How to display current_user bio

You probably want to use wp_get_current_user to find out which user is browsing the site. $current_user = wp_get_current_user(); echo ‘User ID: ‘ . $current_user->ID . ‘<br />’; From there you’ll use the ID to pull the user’s metadata with get_user_meta. $all_meta_for_user = get_user_meta( $current_user->ID ); echo ‘User Description: ‘ . $all_meta_for_user[‘description’] . ‘<br />’; The … Read more

How to set show admin bar front to true for all users?

You can use update_user_option() function (see codex) Your loop looks fine to me, so probably this would work: // Create the WP_User_Query object $wp_user_query = new WP_User_Query(array(‘role’ => ‘Subscriber’)); // Get the results $users = $wp_user_query->get_results(); // Check for results if (!empty($users)) { // loop trough each author foreach ($users as $user) { // update … Read more

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