How may I filter get_users() similarly to pre_get_posts?
There’s the pre_user_query action called in the prepare_query() method of the WP_User_Query class defined in wp-includes/user.php: do_action_ref_array( ‘pre_user_query’, array( &$this ) );
There’s the pre_user_query action called in the prepare_query() method of the WP_User_Query class defined in wp-includes/user.php: do_action_ref_array( ‘pre_user_query’, array( &$this ) );
You do not specify a plugin you are using. But if a user login with a OAuth (used by the mosts social plattforms), then he cannot be logged in in WordPress. Why? A user needs a username and password to login. OAuth (and other methods) do not provide a password. They only answers with Yes, … Read more
You’ll want to use the ‘meta_query’ argument of WP_Query ( http://codex.wordpress.org/Class_Reference/WP_Query ) Here’s a snippet that uses two separate meta key comparisons: $query_args = array( ‘post_type’ => ‘event’, ‘order’ => ‘ASC’, ‘orderby’ => ‘meta_value_num’, ‘meta_key’ => ‘_start_date’, ‘meta_query’ => array ( array( ‘key’ => ‘_start_date’, ‘value’ => $_start_of_month, ‘compare’ => ‘>’, ), array( ‘key’ => … Read more
Before answer, a side note: what you want can be done a in a lot simpler and more performant way just creating a real post type: register a cpt, maybe not public (so no ui is showed on dashboard), and on user profile saving/updating just create/update a cpt entry. Doing so you do not need … Read more
This will add a new column to the Users admin and show their last login. <?php /* Plugin Name: (#158276) WPSE | Last user login */ // Add user meta `last_login` that saves the UNIX time stamp // to identify the exact time when a user logged in add_action( ‘wp_login’, ‘add_login_time’ ); function add_login_time( $user_login … Read more
Might be overkill, but you might want to take a look at BuddyPress – it’s an actively developed project that extends WordPress with social networking features.
The filter to use to modify the e-mail sent to a user when they change their e-mail address is email_change_email. Note that this is different from password_change_email which you’ve used in your original code. That filter allows you to modify the e-mail sent to the user when their password is changed. These two filters work … Read more
What if you use IN operator and split the search term in a words array: $args = array( ‘role’ => ‘Subscriber’, ‘meta_query’ => array( array( ‘key’ => ‘membership_class’, ‘value’ => ‘Full’, ‘compare’ => ‘=’, ‘type’ => ‘CHAR’, ), array( ‘relation’ => ‘OR’, array( ‘key’ => ‘first_name’, ‘value’ => explode( ‘ ‘, $usersearch ), ‘compare’ => … Read more
I think at leasts one approach to this would be the following process: – get all posts by authors – foreach post: – get the author user_meta genere – update the post_meta with that value I have not tested any of the code below, so I wouldn’t copy/paste. But hopefully reading through it will get … Read more
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