How to save multiple custom user profile fields using repeater JQuery

Add square brackets to input names to get PHP to interpret them as an array of data instead of overriding the value with each new input. so your input will look like this: <input type=”text” name=”skills[]” id=”skills” value=”<?php echo esc_attr( get_the_author_meta( ‘skills’, $current_user->ID ) ); ?>” class=”textbox” /> <input type=”text” name=”skills_percent[]” id=”skills_percent” value=”<?php echo esc_attr( … Read more

How to get user details by name

“Users” are basically “authors” in WordPress so those pages are available at example.com/author/{user-name}/ (with or without the trailing slash) and what you are looking for is actually to change the “author permalink base” for the URL rewrite. eg: add_action( ‘init’, ‘set_custom_author_base’ ); function set_custom_author_base() { global $wp_rewrite; $wp_rewrite->author_base=”user”; } You can then add (or modify) … Read more

Get all user meta_keys and then group users by matching values

Eventually came to a solution in case anyone needs it: function mb_get_user_meta_values( $mb_user_meta_key ) { if( empty($mb_user_meta_key) ) return; $mb_get_users = get_users( array( ‘meta_key’ => $mb_user_meta_key ) ); $mb_user_meta_values = array(); foreach( $mb_get_users as $mb_user ) { $mb_user_meta_values[] = get_user_meta( $mb_user->ID, $mb_user_meta_key, true ); } $mb_user_meta_values = array_unique( $mb_user_meta_values ); return $mb_user_meta_values; } Then I … Read more

Set “editor” role to existing user

Usermeta key that stores the user’s role has a prefix in the name, the one set in the wp-config.php file. So meta_key will have the form {prefix}_capabilities and your query should look like global $wpdb; $wpdb->query( $wpdb->prepare( “UPDATE {$wpdb->usermeta} SET meta_value=”a:1:{s:6:\”editor\”;b:1;}” WHERE user_id = %d AND meta_key = ‘{$wpdb->prefix}capabilities'”, $user_id ) ); You do not … Read more

get_users – Sort by a different meta_value than search criteria

Should be ‘meta_key’ => ‘last_name’ instead of ‘meta_key’ => ‘user_lastname’ $args = array( ‘meta_query’ => array( array( ‘key’ => ‘pw_user_status’, ‘value’ => ‘approved’ , ), ), ‘orderby’ => ‘meta_value’, ‘meta_key’ => ‘last_name’, ‘order’ => ‘ASC’ ); $users = get_users( $args );

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