WordPress last login foreach user

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

Combining Meta_Query key values for one array

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

User meta to post

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

how to add custom user capabilities using add_user_meta or something else?

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

include user profiles in search results?

I haven’t an ready to use solution. However I think you should enhance the query, so that you have the field of the users inside this. I think the follow example demonstrate it more. The two filter hooks are necessary and get an result for the query like this: SELECT SQL_CALC_FOUND_ROWS wpbeta_posts.ID FROM wpbeta_posts JOIN … Read more

Post-Registration, post-meta hook?

You can use user_register add_action(‘user_register’, ‘wpse42506_user_register’, 10, 3); function wpse42506_user_register( $user_ID ) { // do stuff here } If you want to just use the user information, you can use get_userdata http://codex.wordpress.org/Function_Reference/get_userdata If you need more control, you can initiate a new WP_User http://codex.wordpress.org/Class_Reference/WP_User

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