Tag Info

New answers tagged

0

The Active Directory Integration plugin causes this. I've posted a bug report and will perhaps contribute a fix.


0

You just need to add a DISTINCT to your SQL query, something like: $cities = $wpdb->get_col("SELECT DISTINCT(meta_value) FROM $wpdb->usermeta WHERE meta_key = 'my_cities_meta_key'" ); Alternatively, if you want to do it with php for some reason (if you want to know that a city is listed twice before displaying only unique entries) $cities = ...


0

What about putting the city/regions/whatever into an array you can loop through? Something like this: $cities = array( 'Richmond', 'Chicago', 'New York' ); foreach ( $cities as $city ) { ?> <h2><?php echo $city; ?></h2> <ul><?php foreach ( get_users_by_meta_data( 'school_division', $city ) as $user ) { ?> ...


0

The b in the serialized string means boolean. So you need to use true instead of one. And serializing it results in double serialization which explains "s:25:" in the beginning. Try this: update_user_meta(46, 'wp_capabilities', array('employer'=>true));


0

The easiest trick is to use the user_contactmethods - the fields don't actually have to be contacts, but WordPress will do all the leg work for you (displaying the fields & saving the data): function wpse_183763_user_contactmethods( $methods, $user ) { $methods['my_field_1'] = 'My Label For Field 1'; $methods['my_field_2'] = 'My Label For Field ...


0

Thanks for your explanation, i will just add to yours the update_user_meta() also return true if successful update happened. In short - It returns Meta ID if the key didn't exist, true on successful update, false on failure.


0

I finally sorted this out - there was a problem in the way that the db was storing the meta_value for my custom key. I had to repair the usermeta db table - I used a database checking plugin and then did the repair through phpMyadmin and now the query works properly. Thank you to anyone who took a look at this.


0

You will need an opening select tag that tells PHP it is an array. Something along the lines of the following should get you on your way... <?php // Display Fields add_action( 'show_user_profile', 'add_multiple_choice_dropdown ' ); add_action( 'edit_user_profile', 'add_multiple_choice_dropdown ' ); function add_multiple_choice_dropdown ( $user ) { ...


0

Try using Subscriber, with capital S. $args = array( 'role' => 'Subscriber', 'meta_key' => 'school', 'meta_value' => $school ); :)


0

So I was really overthinking this problem. Hopefully my answer can help someone in the future. Basically all I needed to do was save the array from wordpress and check to see if the user_ID (Associative Array Key) was in the Array, if it was and the user needed to change the value I needed to search throughout the array replace the value and update that ...



Top 50 recent answers are included