File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,27 @@ function json_oauth_load() {
61
61
}
62
62
add_action ( 'init ' , 'json_oauth_load ' );
63
63
64
+ /**
65
+ * Force reauthentication after we've registered our handler
66
+ *
67
+ * We could have checked authentication before OAuth was loaded. If so, let's
68
+ * try and reauthenticate now that OAuth is loaded.
69
+ */
70
+ function json_oauth_force_reauthentication () {
71
+ if ( is_user_logged_in () ) {
72
+ // Another handler has already worked successfully, no need to
73
+ // reauthenticate.
74
+
75
+ return ;
76
+ }
77
+
78
+ // Force reauthentication
79
+ global $ current_user ;
80
+ $ current_user = null ;
81
+ get_currentuserinfo ();
82
+ }
83
+ add_action ( 'init ' , 'json_oauth_force_reauthentication ' , 100 );
84
+
64
85
/**
65
86
* Load the JSON API
66
87
*/
You can’t perform that action at this time.
0 commit comments