Tag Info

Hot answers tagged

1

Make sure to have identical keys in both of the arrays. Keys 'first_name', 'last_name' and respective keys 'fname', 'lname' are different. If you can make them identical then first do it, otherwise you will either need to do string manipulation for these keys before using them or put a condition like below in the foreach loop - foreach($user_meta_fields as ...


1

Edit: The meta_key is case insensitive by default because the default collation on the relevant tables is "utf8_general_ci", which uses case insensitive sorting for text comparisons. If you change the collation of the rows in the database, you can change the sort order and thus whether it is case sensitive or not. You can also use the DB_COLLATE define in ...


1

For this, you have to use user_register hook defined on wp-includes/users.php line 1759. personal_options_update hook is called, when an user updating his own profile. edit_user_profile_update is called, when an administrator updating other user profile. nothing is called, when an administrator creating a new user. On user-new.php page, new user are ...


1

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 ) { global $wpdb; ...


1

You have to use the function get_user_meta $new_user = get_userdata($user_id); // get all the meta data of the user $new_user_data = get_user_meta( $user_id ); // get the first name of the user as a string $new_user_firstname = get_user_meta( $user_id, 'first_name', true );



Only top voted, non community-wiki answers of a minimum length are eligible