Query wp_usermeta alongside wp_users

This is not a simple answer, so first you will need to include one more filter to allow you to grab both the make the meta_query interact with the main query via an OR instead of a AND, check my sample of code: add_filter(‘user_search_columns’, ‘q166419_user_search_columns’ , 10, 3); function q166419_user_search_columns($search_columns, $search, $this){ if(!in_array(‘display_name’, $search_columns)){ $search_columns[] … Read more

How do I update a specific object in an array, in user meta?

You can just assign a new value to the 1h_userbadge_comments25 key. Like so… <?php $meta_value = get_user_meta($user_id, ‘lh_userbadges’, false); // just assign this key a new value $meta_value[‘lh_userbadge_comments25’] = 25; Then just save it again. <?php update_user_meta( $user_id, ‘lh_userbadges’, $meta_value ); Whether or not storing all of those values as an array is the correct … Read more

Drop down list in user profile page

thanks for that. Just one minor tweak, as the first bit of code threw up an error. Below is the working code for the first block of code. //hooks add_action( ‘show_user_profile’, ‘Add_user_fields’ ); add_action( ‘edit_user_profile’, ‘Add_user_fields’ ); function Add_user_fields( $user ) { ?> <h3>Extra fields</h3> <table class=”form-table”> <tr> <th><label for=”text”>text</label></th> <td> <?php // get test … Read more

Hide a user from WordPress

You’re wanting to hide a user from WordPress in three places: The user list in the admin The count above that user list The user’s author archive on the front-end As you mentioned, you’ve already solved item 1 and you’ve included the code for that. So, I’ll provide the solutions for items 2 and 3. … Read more

Extend the wp_users table

There are far better ways of doing this. Instead of modifying the user table, make use of User Meta. It has a dedicated table, and works the same way as post meta, but for users. add_user_meta get_user_meta update_user_meta There are many tutorials explaining how to add additional fields to the user profile using User meta … Read more

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