Redirecting user after updating profile?

This is the function that you need: add_action( ‘profile_update’, ‘custom_profile_redirect’, 12 ); function custom_profile_redirect() { if(is_admin()): wp_redirect( trailingslashit( home_url() ) ); exit; endif; } Just change the target of wp_redirect to whatever URL you want your users to go to. You can even add conditional logic to it if you only want this to happen … Read more

Showing user ID on user main page from screen options

You need to use the filter ‘manage_’ . $screen->id . ‘_columns’ to add a column and manage_users_custom_column to display its value. add_filter( ‘manage_users_columns’, ‘column_register_wpse_101322’ ); add_filter( ‘manage_users_custom_column’, ‘column_display_wpse_101322’, 10, 3 ); function column_register_wpse_101322( $columns ) { $columns[‘uid’] = ‘ID’; return $columns; } function column_display_wpse_101322( $empty, $column_name, $user_id ) { if ( ‘uid’ != $column_name ) … Read more

How to list users that have written custom post types and hide the ones that have not?

wp_list_authors(), internally gets posts that are only of type post. See line 294 http://core.trac.wordpress.org/browser/tags/3.2.1/wp-includes/author-template.php#L273 As you have noted, this answer is great and with some modification can do what you want. function wpse31443_author_has_custom_post_type( $post_author, $post_type ) { global $wp_post_types; // If nonexistent post type found return if ( array_intersect((array)$post_type, array_keys($wp_post_types)) != (array)$post_type ) return false; … Read more

WordPress edit_user_profile_update update secondary role

I have finally found solution and the right hook for this: profile_update is called at the end of wp_insert_user in user.php which is called from edit_user. wp_insert_user ending: if ( $update ) do_action(‘profile_update’, $user_id, $old_user_data); else do_action(‘user_register’, $user_id); return $user_id;

Customize Admin Users Screen based on Role

Manage Columns It’s pretty straight forward using the manage_{post-type-name}_columns filter: Just switch per $capability and unset what you don’t need in the $post_columns array. function wpse19435_manage_columns( $posts_columns ) { // First role: add a column – take a look at the second function if ( current_user_can( $capability_admin ) ) { $posts_columns[‘some_column_name’] = _x( ‘Whatever’, ‘column … Read more

User profile custom field

Here is an example using a field called my_field. The value is successfully saved and displayed: // Declaring the form fields add_action( ‘show_user_profile’, ‘wpse_show_my_fields’ ); add_action( ‘edit_user_profile’, ‘wpse_show_my_fields’ ); add_action( ‘user_new_form’, ‘wpse_show_my_fields’ ); function wpse_show_my_fields( $user ) { $fetched_field = get_user_meta( $user->ID, ‘my_field’, true ); ?> <tr class=”form-field”> <th scope=”row”><label for=”my_field”><?php _e( ‘Field Name’, ‘text-domain’ … Read more

Adding a photo to each WP user

I use a plugin called Avatar Manager for that function. The author has also done a tutorial on how to write your own avatar manager plugin, but unfortunately it is also a bit outdated and doesn’t work anymore. Although the plugin states it is compatible up to 3.6.1, it is still working in 3.8.1. I … Read more

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