-
-
Save tommcfarlin/cf79caf2e6ee73abed08 to your computer and use it in GitHub Desktop.
[WordPress] Programmatically Update User Profiles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'personal_options_update', 'acme_save_user_permissions' ); | |
add_action( 'edit_user_profile_update', 'acme_save_user_permissions' ); | |
/** | |
* Allows an administrator to update his/her profile as well as all other | |
* user profiles. | |
* | |
* @param int $user_id The ID of the user profile being edited. | |
*/ | |
function acme_save_user_permissions( $user_id ) { | |
// If the current user doesn't have administrative priveleges, exit. | |
if ( ! current_user_can( 'manage_options' ) ) { | |
return; | |
} | |
/* Check the contents of the data to be saved (and sanitize it), then update | |
* the information with the user's profile. | |
*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment