How to display some selected user meta data on a specific page with a shortcode?

Here is the simplest shortcode that will do the job for you add_shortcode(‘USER_META’, ‘user_meta_shortcode_handler’); /** * User Meta Shortcode handler * usage: [USER_META user_id=1 meta=”first_name”] * @param array $atts * @param string $content * @return stirng */ function user_meta_shortcode_handler($atts,$content=null){ return esc_html(get_user_meta($atts[‘user_id’], $atts[‘meta’], true)); } USAGE: [USER_META user_id=1 meta=”first_name”] [USER_META user_id=1 meta=”last_name”]

Front end user meta options for users

“edit_user_profile_update” is not an action… check: http://codex.wordpress.org/Plugin_API/Action_Reference update_usermeta() is deprecated in wp 3 and above, use update_user_meta() your form is lacking some standard hidden fields like: <input type=”hidden” name=”user_id” id=”user_id” value=”<?php echo esc_attr( $current_user->ID ); ?>” /> use wp_nonce_field(); ex: <?php wp_nonce_field( ‘update-user_’ . $current_user->ID ) ?>

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 create user personal pages with information from their meta profile fields?

First of all register the cpt. Probably if you don’t want add the UI for that post type you can set the show_ui to false. $args = array( ‘label’ => ‘Members’, ‘public’ => true, ‘exclude_from_search’ => true, ‘show_ui’ => false, ‘show_in_nav_menus’ => false, ‘show_in_menu’ => false, ‘show_in_admin_bar’ => false, ‘hierarchical’ => false, ‘has_archive’ => true, … Read more

How to use the WP REST API for new user registration (sign up form)?

hopefully you’ve found the answer already. Here’s our solution, for your reference. 😀 The following code should add User Registration via REST API to your WordPress Website. It supports Registration of ‘subscriber’ and ‘customer’. Add it to your function.php add_action(‘rest_api_init’, ‘wp_rest_user_endpoints’); /** * Register a new user * * @param WP_REST_Request $request Full details about … 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

Show User Their Password

Theoretically, this could be achieved by saving a user’s password elsewhere, when he or she updates it. Note that this sort of thing is hardly ever recommendable. In almost all cases, there is a better architectural approach that renders having to be able to show plain-text passwords unnecessary. That being said, if you absolutely must … Read more

Updating User Meta with SQL Query

How can I write a bulk MySQL command to add in the value wp_capabilites=”a:1:{s:10:”subscriber”;b:1;}” into each user_id except 1, 2 and 3 ie. the newly imported users? You don’t. That is a serialized array which is a PHP construct. MySQL has no idea what to do with it. To the database, it is just an … Read more