How to add usermeta for existing users when user profile is updated
How to add usermeta for existing users when user profile is updated
How to add usermeta for existing users when user profile is updated
Hard to say without seeing any code as to how you are building it out but one suggestion would be to update the field on submit prior to running your register_new_user function. PHP strtolower() Function can be used when passing the data to your custom field Javascript/jQuery you can use .toLowerCase() on the field
I suspect, this issue is much more related to htaccess rather than WordPress installation. In a standard WP installation, you can find the .htaccess file in the root directory of your WP install. This file is used for various server settings and specifically, URL rewrites. The reason for this file starts with a dot, the … Read more
simply change the autoincrement number in your table settings in phpmyadmin to 387100 and it will start and go ahead with 387101, 387102, and so on. As it automatically counts +1 when adding a user, this is the most efficiant and easy way to do it without changing any code.
Need some suggestions with Relationship fields and CPT/ACF
Try this, notice how I set the 3rd value of get_user_meta() to “true” function user_last_login_list( $user_login, $user ) { // If last_login user meta exist if(metadata_exists( ‘user’, $user->ID, ‘last_login’ )){ // Get all login dates as a single array $UserLoginDate = get_user_meta($user->ID, ‘last_login’, true); } else { // Initialize as an empty array if it’s … Read more
Problem with custom user fields default value and retrieval
Use this code instead- $args = array( ‘meta_key’ => ‘last_name’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘ASC’ ); $users = get_users( $args ); foreach ( $users as $user ) { $user_id = $user->ID; $post_count = count_user_posts( $user_id ); if ( $post_count > 0 ) { $user_meta = get_user_meta( $user_id, ”, true ); echo ‘ID: ‘ . … Read more
WP_User_Query get_count issue with meta_query relation
i need to return/echo the name of the department/location for each group of employees That is actually a generic PHP/programming question, nonetheless, if you mean an output which looks like so: Location/Department Name – Employee/user – Employee/user – Employee/user Location/Department Name – Employee/user – Employee/user Then here’s one way of accomplishing that: Add this above/before … Read more