Created
May 5, 2022 16:18
-
-
Save woodwardtw/fc58ccf7e1d43e5d680b95c81c168f85 to your computer and use it in GitHub Desktop.
looking at the user_register action through gravity form and normal WP paths
This file contains hidden or 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
add_action( 'user_register', 'explore_user_stuff', 10, 1 ); | |
function explore_user_stuff( $user_id ) { | |
write_log($_POST);//will have info if done through typical WP fashion but not if through gform | |
write_log($user_id);//has user ID no matter what | |
$user = get_user_by('id', $user_id);//get user info | |
write_log($user); | |
} | |
//LOGGER -- like frogger but more useful | |
if ( ! function_exists('write_log')) { | |
function write_log ( $log ) { | |
if ( is_array( $log ) || is_object( $log ) ) { | |
error_log( print_r( $log, true ) ); | |
} else { | |
error_log( $log ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment