Update user from external script

It sounds like you are updating the user information after the form has been displayed. You need to rearrange your code so that you are updating the user information earlier, before the form is displayed. If you need help figuring out how to do that, then you need to share some more details about how … Read more

Designing a member area on my site

If you never heard of WordPress, you can have an overview at the Codex in Getting Started with WordPress and explore the topics as the need arrives. G.M’s linked Answer has very nice information for your use-case, and sample code with advanced techniques. Worth bookmarking. To get really started, learn how to make a Child … Read more

Validate user meta and redirect

Here is how I would do it: function save_extra_user_profile_fields( $user_id ) { if (!isset($_POST[‘address’]) || empty($_POST[‘address’])) { // this field was not set or was empty // do your action wp_redirect( home_url() ); // or profile page exit; } else { // field was set and contains a value // do your action update_user_meta( $user_id, … Read more

Multisite – Echo admins profile meta

According to the Codex, get_user_id_from_string() is deprecated, and should be replaced with get_user_by(). <p> <?php $thisblog = get_current_blog_id(); // probably don’t need this anymore $admin_email = trim( get_option( ‘admin_email’ ) ); $admin_user = get_user_by( ’email’, $admin_email ) ); $phone_number = get_user_meta($admin_user->ID, ‘phone’, true); if($phone_number!=”) { ?> <?php echo $phone_number; ?> <?php } else { ?> … Read more