Skip to content

Instantly share code, notes, and snippets.

@CatEntangler
Last active September 3, 2015 13:43
Show Gist options
  • Save CatEntangler/a8ee236e7fde8d90d193 to your computer and use it in GitHub Desktop.
Save CatEntangler/a8ee236e7fde8d90d193 to your computer and use it in GitHub Desktop.
<?php
function is_paying_customer( $user_id ) {
$paying_customer = get_user_meta( $user_id, 'paying_customer', TRUE );
if( ! $paying_customer ) {
return false;
}
else {
return true;
}
}
add_filter( 'user_contactmethods', 'add_my_field' );
function add_my_field( $profile_fields ) {
$user_id = ''; // Do your code to figure out what user_id you are talking about
if( is_paying_customer( $user_id ) ) {
$profile_fields[ 'my_new_field'] = 'My Field';
update_user_meta( $user_id, 'my_new_field', 'my value' );
}
return $profile_fields;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment