15

If you plan to use this code on frontend, I would check if email is free to use. Otherwise, you are creating a security hole. if (isset( $_POST['email'])) { // check if user is really updating the value if ($user_email != $_POST['email']) { // check if email is free to use if (email_exists( $_POST['email'] )){ // ...


15

There are two ways I've discovered doing this: Author Page with a custom rewrite rule A custom template files paired with a rewrite rule The first is more simple to implement, but may not work in all circumstances (one of which I'll describe soon). Custom Rewrite Rule I found this solution a few days ago here: URL Rewriting And here's the code, with ...


12

Revisited and updated answer: We can't use the user_contactmethods filter to remove the website wrapper, because this piece is hardcoded in the user-edit.php file and not part of the filterable user contacts loop, generated by: wp_get_user_contact_methods( $profileuser ) Hiding it with CSS The website row element now got it's own .user-url-wrap class: ...


11

You technically don't have to set a nickname, it will be filled with your username if you clear the field out. Display name is selectable between the user's username, first name, last name, first/last, or last/first, or nickname. The nickname exists to give you an option to set display name to something other than your username or real name.


9

Default WordPress uses Gravatar, you can find more information about it here. On WordPress.com, we use Gravatar to associate an avatar with a user’s account. If you’ve set up a Gravatar, it will be displayed when you post to the forums or comment on a blog, and it may also appear if your blog is featured on a tag page. Custom - Backend If you manually want ...


9

Redirect from profile.php to the dashboard Here's one way to do it: add_action( 'load-profile.php', function() { if( ! current_user_can( 'manage_options' ) ) exit( wp_safe_redirect( admin_url() ) ); } ); where we redirect to the dashboard instead, if the current user can't manage options. Redirect from profile.php to the current user's member ...


7

Since the recent class change this works: add_action( 'personal_options', array ( 'T5_Hide_Profile_Bio_Box', 'start' ) ); /** * Captures the part with the biobox in an output buffer and removes it. * * @author Thomas Scholz, <info@toscho.de> * */ class T5_Hide_Profile_Bio_Box { /** * Called on 'personal_options'. * * @return ...


7

There is a global variable called … $user_id available on that page. Always. From user-edit.php: $user_id = (int) $user_id; $current_user = wp_get_current_user(); if ( ! defined( 'IS_PROFILE_PAGE' ) ) define( 'IS_PROFILE_PAGE', ( $user_id == $current_user->ID ) ); if ( ! $user_id && IS_PROFILE_PAGE ) $user_id = $current_user->ID; ...


7

As far as I'm aware, all you can do is filter the display name via pre_user_display_name and check if it already exists. Unfortunately WP_User_Query doesn't support querying by display_name, so we also have to add to the WHERE clause via pre_user_query. Additionally, there is no elegant way I can think of to handle the case where the display_name already ...


6

You are missing the "checked" value for the inputs <input type="checkbox" name="language" <?php if (get_the_author_meta( 'language', $user->ID) == 'Mandarin' ) { ?>checked="checked"<?php }?> value="Mandarin" /> Mandarin<br /> Also, the usermeta is dealing but your are checking for $_POST['gender'] Finally, you should have one ...


6

Since the asker really doesn’t want to post the answer … someone has to do it: SELECT wp_users.ID , wp_users.user_email FROM wp_users LEFT JOIN wp_bp_xprofile_data ON wp_bp_xprofile_data.user_id = wp_users.ID, WHERE wp_bp_xprofile_data.field_id = 8 AND wp_bp_xprofile_data.value = 'yes' field_id = 8 being the Field you want to get (in my ...


6

Was just trying to figure this out and came across this answer. The above code by Cor van doesn't work anymore, but with a slight change of the add_action, it can. All you need to do is change the last two lines from: add_action( 'admin_head-profile.php', 'cor_profile_subject_start' ); add_action( 'admin_footer-profile.php', 'cor_profile_subject_end' ); ...


6

You should (if available) submit the code you are working with, even if just a snippet, so we can assess your process in relation to your question. The short answer however is YES, it is safe, so long as you, prevent input fields being displayed on user profile page for certain user roles prevent unauthorized users from saving user meta to the database ...


6

From Codex: Plugin API - Action Reference - profile_update: Note: This hook is not used on user edit/profile pages. To hook into the admin's user edit pages, use the hook edit_user_profile_update which is located in /wp-includes/user-edit.php instead. From Codex: Plugin API - Action Reference - edit_user_profile_update: This hook only triggers when a ...


6

Presuming that the user has their avatar saved, as the ID of an attachment, store in user meta, as the field field_with_custom_avatar_id, you could do this to show that attachment if the value is saved: add_filter( 'get_avatar', 'slug_get_avatar', 10, 5 ); function slug_get_avatar( $avatar, $id_or_email, $size, $default, $alt ) { //If is email, try ...


5

Solution as a (MU-)Plugin I checked all the provided solutions and thought I could make a nice MU-Plugin out of it. The only real change is that it avoids <?php ! defined( 'ABSPATH' ) AND exit; /** * Plugin Name: Disable profile page link * Description: Remove edit profile link from admin bar and side menu and kill profile page if user isn't an ...


5

You should hook into the user_register action. I did something similar on a recent site (not involving having to fill out profile fields, but involving having to renew a membership). I will propose a multi-part solution (let me know if any of it is confusing, it's been a long day and I might not explain it perfectly). EDIT: Upon thinking about it further, ...


5

Accepted answer is not working with 4.8 Here comes an up to date and simplified code that should work with any version: // removes admin color scheme options remove_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' ); //Removes the leftover 'Visual Editor', 'Keyboard Shortcuts' and 'Toolbar' options. ...


5

I'll post whole code which have to be in functions.php it's legit WP valid code, how it should be done :) This should work, of course you have to put your role name in switch. UPDATED FOR PERFORMANCE: add_action( 'show_user_profile', 'user_fields_for_admin', 10); add_action( 'edit_user_profile', 'user_fields_for_admin', 10); function ...


5

It's entirely possible that you are calling the_author_meta() from outside of your post loop in the author.php template in which case the above will not work. Instead, you can use get_the_author_meta('facebook') or... get_the_author_meta('facebook', $user_id) where $user_id is the ID# of the current user/author. To get the user ID you can do this; <...


5

Files named "core" are created when some OS process crashes. In your case it was likely a crash of the php interpreter. These files being memory dumps are used to debug the process "postmortem" - e.g. to check in which function did it fail, so it is perfectly safe to delete them if you are not going to debug the issue. In fact, on many systems there is a ...


5

You can do this using either the personal_options_update or edit_user_profile_update hook depending on what exactly you want to do. If those aren't firing when you need, you can poke around in http://core.trac.wordpress.org/browser/tags/3.5.1/wp-admin/user-edit.php to find a different hook to use. See Justin Tadlock's tutorial for more


5

I have written a solution for that some time ago: <?php # -*- coding: utf-8 -*- /** * Plugin Name: T5 Comment author URI to blog author page * Description: Changes the comment author URI to the blog’s author archive * Version: 2012.07.18 * Author: Fuxia Scholz * Author URI: https://fuxia.me * License: MIT * License URI: http://www....


5

I resolved the problem with ob_ functions and DOMDocument. It's better than jQuery or CSS for protecting the form. I use this kind of solution every time when I can't access a part of HTML content through a hook. function remove_extra_field_profile() { $current_file_url = preg_replace( "#\?.*#" , "" , basename( $_SERVER['REQUEST_URI'] ) ); if( $...


5

You can use the WP_User class and the has_cap($role) method. The show_user_profile action passes a WP_User object as a parameter to the called function. http://codex.wordpress.org/Class_Reference/WP_User#has_cap.28.24cap.29 add_action('show_user_profile', 'my_add_extra_profile_fields'); function my_add_extra_profile_fields($user) { if ($user->...


5

The hook you need is the get_avatar filter. It returs the image HTML element representing the user avatar. add_filter( 'get_avatar', 'cyb_get_avatar', 10, 5 ); function cyb_get_avatar( $avatar = '', $id_or_email, $size = 96, $default = '', $alt = '' ) { // Replace $avatar with your own image element, for example // $avatar = "<img alt='$alt' src=...


4

I found this: Exclude Users from Members directory on a BuddyPress based social network We will need to hook to 'bp_ajax_querystring' filter. The following code will allow to exclude the users from the members directory. They will be still listed in the friends list of other users with whom they are friends with. add_action('bp_ajax_querystring','...


4

Try instead $user_contactmethods['work'] = __('I work for...'); and <?php echo get_user_meta($current_user->ID,'work',true);?> where the array index is 'work' instead of 'I work for...', i.e. lowercase and without any spaces.


4

It seems as if the hook personal_options_update might be what you're looking for. add_action( 'personal_options_update', 'my_custom_func' ); function my_custom_func( $user_id /* if you need that */ ) { ... }


Only top voted, non community-wiki answers of a minimum length are eligible