Average Account Age

WordPress records when a user was registered in the $wpdb->users (usually wp_users) table in the column user_registered. So you can use that to calculate the average account age. There’s no internal function for this, so you’ll have to use $wpdb directly. This stackoverflow answer has some good info about calculating the average of a series … Read more

Store user’s registration date as meta

In your case $registered is the user id not the user object so it does not work. Please use the code as given below. add_action( ‘user_register’, ‘set_user_registration_date’, 10, 1 ); function set_user_registration_date( $user_id ) { $user = get_userdata ( $user_id ); // Update the registration meta data update_user_meta ( $user_id, ‘registration_date’, $user->user_registered ); }

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