Tag Info

Hot answers tagged

2

Try this /* Save selected data */ add_action( 'personal_options_update', 'save_user_fields' ); add_action( 'edit_user_profile_update', 'save_user_fields' ); function save_user_fields( $user_id ) { if ( !current_user_can( 'edit_user', $user_id ) ) return false; update_usermeta( $user_id, 'country', $_POST['country'] ); } add_action( ...


2

You could simply use the get_blogs_of_user() function: echo count( get_blogs_of_user( $user_ID ) ); instead of your custom SQL query.


1

After experimenting with birgire's comment (huge thanks), I put together a relatively simple regular expression that seems to be solid: SELECT * FROM wp_usermeta WHERE meta_key REGEXP('^wp_([[:digit]]+_)?capabilities$') The prefix can be easily added / changed without breaking the expression. It also requires at least 1 number and an underscore for any ...


1

As noted at the codex page for get_user_meta(): NOTE If the meta value does not exist and $single is true the function will return an empty string. If $single is false an empty array is returned. So I would suggest to do the check like this: ! empty( $themeta ) Regrading your other question, you can save the array by simply doing it like ...


1

If anyone should be faced with this problem, check if you have defined a callback function to set the user_login on pre_user_login. This filter is applied inside the wp_insert_user()-function and produced a same username again. Therefore the nicename was changed by adding a "-2". So, my problem was that I reset the user_logins again and again, instead of ...



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