Skip to content

Instantly share code, notes, and snippets.

@tommcfarlin
Last active January 29, 2016 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tommcfarlin/cf79caf2e6ee73abed08 to your computer and use it in GitHub Desktop.
Save tommcfarlin/cf79caf2e6ee73abed08 to your computer and use it in GitHub Desktop.
[WordPress] Programmatically Update User Profiles
<?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