cbeff607 by Jeff Balicki

updated_profile

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 7d2ad53e
...@@ -243,6 +243,20 @@ return $data; ...@@ -243,6 +243,20 @@ return $data;
243 } 243 }
244 244
245 245
246 add_action( 'init', 'wpa_342456' );
247
248 function wpa_342456() {
249 // if query var is not present just return
250 if ( isset( $_REQUEST['my_listener'] ) || 'set_update_profile' == $_REQUEST['my_listener'] ){
251 $users = get_users( array( 'fields' => array( 'ID' ) ) );
252 foreach($users as $user){
253 update_user_meta( $user->ID, 'updated_profile', 1);
254 }
255
256 }else{
257 return;
258 }
259 }
246 260
247 add_action( 'init', 'wpa_34245' ); 261 add_action( 'init', 'wpa_34245' );
248 262
...@@ -267,6 +281,7 @@ add_action( 'profile_update', function ( $user_id, $old_user_data ) { ...@@ -267,6 +281,7 @@ add_action( 'profile_update', function ( $user_id, $old_user_data ) {
267 update_office_email($user_id); 281 update_office_email($user_id);
268 update_branch_fax($user_id); 282 update_branch_fax($user_id);
269 error_log('profile update '.$user_id); 283 error_log('profile update '.$user_id);
284 update_user_meta( $user_id, 'updated_profile', 1);
270 }, 10, 2 ); 285 }, 10, 2 );
271 286
272 287
...@@ -301,14 +316,15 @@ add_action( 'profile_update', function ( $user_id, $old_user_data ) { ...@@ -301,14 +316,15 @@ add_action( 'profile_update', function ( $user_id, $old_user_data ) {
301 316
302 317
303 318
304 // Add your custom function to the wpo365_user_created hook
305 add_action('wpo365_user_created', 'custom_redirect_after_user_created', 10, 2);
306 319
307 function custom_redirect_after_user_created($user_id, $provider) {
308 320
309 error_log('registration_redirect'); 321 function custom_redirects() {
310 // Redirect the user after user creation based on your requirements 322 $user = wp_get_current_user();
311 wp_redirect('/account/profile/'); 323 $updated_profile = get_user_meta( $user->ID, 'updated_profile', true );
312 exit(); 324 if(!$updated_profile){
325 wp_redirect( home_url( '/account/profile/' ) );
326 die;
327 }
313 328
314 } 329 }
330 add_action( 'template_redirect', 'custom_redirects' );
...\ No newline at end of file ...\ No newline at end of file
......