[wp-trac] [WordPress Trac] #39385: Set $current_user global in wp_signon() after successful authentication
WordPress Trac
noreply at wordpress.org
Wed Aug 29 11:52:28 UTC 2018
#39385: Set $current_user global in wp_signon() after successful authentication
------------------------------------+------------------------------
Reporter: fjarrett | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Login and Registration | Version:
Severity: normal | Resolution:
Keywords: needs-patch close | Focuses:
------------------------------------+------------------------------
Comment (by dotancohen):
To preempt arguments that the wp_login does not need to have the current
user set because one of its parameters is the logged-in user, I counter
that the code in the hooked method may (as, _does_ on one system I'm
writing) can a non-coupled class that itself _does_ require the current
user to be set.
{{{
add_action('wp_login', 'actionWpLogin', 10, 2);
function actionWpLogin($user_login, $user)
{
Foo::bar();
}
/**
* A class that I don't maintain.
*/
class Foo {
public static function bar()
{
$user = wp_get_current_user();
// Some $user magic here...
}
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39385#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list