cbeff607 by Jeff Balicki

updated_profile

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 7d2ad53e
......@@ -243,6 +243,20 @@ return $data;
}
add_action( 'init', 'wpa_342456' );
function wpa_342456() {
// if query var is not present just return
if ( isset( $_REQUEST['my_listener'] ) || 'set_update_profile' == $_REQUEST['my_listener'] ){
$users = get_users( array( 'fields' => array( 'ID' ) ) );
foreach($users as $user){
update_user_meta( $user->ID, 'updated_profile', 1);
}
}else{
return;
}
}
add_action( 'init', 'wpa_34245' );
......@@ -267,6 +281,7 @@ add_action( 'profile_update', function ( $user_id, $old_user_data ) {
update_office_email($user_id);
update_branch_fax($user_id);
error_log('profile update '.$user_id);
update_user_meta( $user_id, 'updated_profile', 1);
}, 10, 2 );
......@@ -301,14 +316,15 @@ add_action( 'profile_update', function ( $user_id, $old_user_data ) {
// Add your custom function to the wpo365_user_created hook
add_action('wpo365_user_created', 'custom_redirect_after_user_created', 10, 2);
function custom_redirect_after_user_created($user_id, $provider) {
error_log('registration_redirect');
// Redirect the user after user creation based on your requirements
wp_redirect('/account/profile/');
exit();
function custom_redirects() {
$user = wp_get_current_user();
$updated_profile = get_user_meta( $user->ID, 'updated_profile', true );
if(!$updated_profile){
wp_redirect( home_url( '/account/profile/' ) );
die;
}
}
add_action( 'template_redirect', 'custom_redirects' );
\ No newline at end of file
......