Disable editing profile for second time
If you want to completely disable the user from editing their profile, you can remove the user profile page. See a similar question here: disallow user from editing their own profile information.
If you want to completely disable the user from editing their profile, you can remove the user profile page. See a similar question here: disallow user from editing their own profile information.
You are using the wrong name on the radio inputs, radio-inline but when you try to get that value you are using $_POST[‘gender’] I’ve updated you code and made some improvement too, with the checked() function function show_extra_profile_fields( $user ) { $gender = get_user_meta( $user->ID, ‘gender’, true ); ?> <section> <label class=”label” for=”gender”>Gender</label> <div class=”inline-group”> … Read more
You can get the current user’s info by using wp_get_current_user() and then get the profile edit link by using the user’s ID as following: function wpse_125929_login_logout( $items ) { if ( is_user_logged_in() ) { $current_user = wp_get_current_user(); $profile_edit_url = admin_url( ‘user-edit.php?user_id=’ . $current_user->ID ); $profile_link = ‘<li><a href=”‘ . $profile_edit_url . ‘”>Edit Profile</a></li>’; $logout_url=”<li><a href=””. … Read more
If you use WordPress author template to show user posts ( example.com/author/{user_name} ) the best solution will be to change the main query via the pre_get_posts filter hook. function se339534_author_any_post_types $query ) { // apply changes only for author archive page if ( ! is_author() || ! $query->is_main_query() ) return; $query->set(‘post_type’, ‘any’); } add_action( ‘pre_get_posts’, … Read more
The solution was to move the update_options into the second function.
I suggest using BuddyPress user profiles feature, you don’t need to enable all BuddyPress features. Gravity Forms can be used to create profile-like fields, but it is not really tied to real WordPress user profiles: https://www.gravityforms.com/creating-team-member-profiles/
WordPress does not allow updating user_login for existing users. You may update it using $wpdb->update as below: // Sanitizes the username $user_login = sanitize_user( trim( $user_login ), true ); // Check if the given username exists if ( ! empty( $user_login ) && ! username_exists( $user_login ) ) { global $wpdb; //Update user record $wpdb->update( … Read more
Try the WP_User_Query, something like: $term = get_queried_object(); $users = new WP_User_Query(array( ‘meta_key’ => ‘your_meta_key’, // the key in which you store your terms ‘meta_value’ => (int)$term->term_id, // assuming you store term IDs )); print_r($users->get_results()); A update based on your input: $term = get_queried_object(); $user_query = new WP_User_Query(array( ‘role’ => ‘subscriber’, // or whatever your … Read more
I managed to use $bp->template_message this was a bit tricky but then I had to go to bp-xprofile-screens.php just under line 77 I added unset($is_required[1]); to remove the username update, (as this does not need changing) 🙂 hope someone else, may find this useful.
You can use get_currentuserinfo() to find out a user’s role. To modify the wordpress admin bar, use the admin bar render hook.