how to add wp-user fields to front-end form

Something like this should point you in the right direction: function updateUser($newPassword = ”, $newEmail=””){ $update = array(); if(!empty($newPassword)) $update[‘user_pass’] = $newPassword; if(!empty($newEmail)) $update[‘user_email’] = $newEmail; if(!empty($update)){ $update[‘ID’] = wp_get_current_user_id(); return wp_update_user($update); } return; } See wp_update_user() for more info on how that function works. You should also verify the source of the post data … Read more

Showing user profile data on front-end

You are trying to access the meta data of the user with ID stored in $user->ID but the object $user is not defined in your code. You are also using an undefined variable $user_ID. The quickest fix in your code would be to change this: get_the_author_meta( ‘province’, $user->ID ) ) With: get_the_author_meta( ‘province’, $userdata->ID ) … Read more

php return username of currently viewed author profile

On an author archive page (assuming the plugin uses the core archives) get_queried_object() will return the WP_User object for the author. Something like: $author = get_queried_object(); if (is_a($author, ‘WP_User’)) { var_dump($author->data); } You should see the login, nicename, and display name in there. Use what you need.

User can manage one page accessible by everyone?

As you may or may not be aware WordPress provides a profile page in the admin for each registered user (including the admin of course!): `http://www.example.com/wp-admin/profile.php‘ On that page you will see a number of fields that can be edited / customized including a Biographical Info field. To fetch and output a field from this … Read more

Block Update Profile Errors

Solution: First, Jeff Farthing of theme-my-login pointed out that I was using add_filter instead of add_action, and helped to craft the first code below, however it still has the same problem, so this is a step in the right direction but is not my solution: function tml_profile_errors( &$errors ) { if ( empty( $_POST[‘state’] ) … Read more

Show global Message in User Profiles with admin only Input field in WordPress Backend

You just need to move the capability check “inwards”: function wpse_230369_quote_of_the_day( $user ) { $quote = esc_attr( get_option( ‘quote_of_the_day’ ) ); ?> <div class=”visible-only-for-admin”> <h3>Quote of the Day Input Field</h3> <table class=”form-table” > <tr> <th><label for=”quote_of_the_day”>Quote of the Day</label></th> <td> <?php if ( current_user_can( ‘administrator’ ) ) : ?> <input type=”text” name=”quote_of_the_day” value=”<?php echo $quote … Read more