Extension talk:WSOAuth/Hooks/WSOAuthAfterGetUser
Add topicAppearance
Latest comment: 6 years ago by Revansx in topic Getting the User's Real Name as a PHP variable in LocalSettings
| This page used the Structured Discussions extension to give structured discussions. It has since been converted to wikitext, so the content and history here are only an approximation of what was actually displayed at the time these comments were made. |
Getting the User's Real Name as a PHP variable in LocalSettings
[edit]How could this hook be used in localsettings.php to store the text of the user's Real Name? Is it as simple as something like:
public static function onWSOAuthAfterGetUser( &$user_info, &$errorMessage ) {
$TheUsersRealName = $user['Real Name'];
}
$wgHooks['WSOAuthAfterGetUser'][] = 'MyExtensionHooks::onWSOAuthAfterGetUser';
Revansx (talk) 14:40, 27 April 2020 (UTC)
- Hi Revansx,
- Something like this would expose the user's real name before it gets stored in the database and before the user is authenticated:
- Xxmarijnw (talk) 15:11, 27 April 2020 (UTC)
function onWSOAuthAfterGetUser(&$user_info, &$errorMessage) { $real_name = $user_info['realname']; # Do whatever } $wgHooks['WSOAuthAfterGetUser'][] = 'onWSOAuthAfterGetUser';
- Thanks, I'm trying to set the configuration variable of extension:CreateUserPage with the value of the Real Name from the WSOAuth WSOAuthAfterGetUser Hook. But it's not working. Either the Hooks runs too late (after CreateUSerPage does its thing or i'm writing it incorrectly. The snipit below in my LocalSettings is supposed to create the user's user page with the wikitext being the Real Name from the WSOAuth Login. But it doesn't work.
- Revansx (talk) 15:34, 27 April 2020 (UTC)
wfLoadExtension( "CreateUserPage" ); $wgCreateUserPage_OnLogin = true; function onWSOAuthAfterGetUser(&$user_info, &$errorMessage) { $wgCreateUserPage_PageContent = $user_info['realname']; } $wgHooks['WSOAuthAfterGetUser'][] = 'onWSOAuthAfterGetUser'; - PluggableAuth redirects shortly after this hook is called. When the CreateUserPage extension tries to read the variable, it is no longer set. Xxmarijnw (talk) 17:14, 27 April 2020 (UTC)
- gotcha.. hmm Revansx (talk) 17:19, 27 April 2020 (UTC)