Last modified: 2011-06-09 09:56:09 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T23711, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 21711 - Execute MediaWiki Hook 'AddNewAccount' when new account is added
Execute MediaWiki Hook 'AddNewAccount' when new account is added
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
OpenID (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: T. Gries
: patch
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-11-30 04:38 UTC by Jack D. Pond
Modified: 2011-06-09 09:56 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Add new account hook (as found in SpecialUserlogin.php (376 bytes, patch)
2009-11-30 04:38 UTC, Jack D. Pond
Details

Description Jack D. Pond 2009-11-30 04:38:30 UTC
Created attachment 6846 [details]
Add new account hook (as found in SpecialUserlogin.php

MediaWiki has a hook 'AddNewAccount' that is executed when a new account is added.  This hook should also be executed when Extension:OpenID creates a new account.

One line adds functionality identical to other account adds as found in SpecialUserlogin.php line 189
Comment 1 Roan Kattouw 2009-11-30 13:09:09 UTC
Maybe a hook should be added in the backend (User::addToDatabase()) instead?
Comment 2 Jack D. Pond 2009-11-30 13:27:31 UTC
(In reply to comment #1)
> Maybe a hook should be added in the backend (User::addToDatabase()) instead?

Possible, but it is handled in includes/specials/SpecialUserLogin.php always appearing right before addNewUserLogEntry function call, e.g.:

	wfRunHooks( 'AddNewAccount', array( $u, false ) );
	$u->addNewUserLogEntry();

This is used several times in that script, and I thought might be best to continue the existing practice into OpenID.

However, this question brings up another, to wit, should other login/create account hooks be included in the OpenID extension?  And if so, which ones?  Will look into this and invite others to do so, adding to this bug?
Comment 3 Sergey Chernyshev 2009-11-30 15:01:28 UTC
I have a feeling that hooks should be in the core unless their users extend OpenID specifically.
Comment 4 Jack D. Pond 2009-11-30 17:11:27 UTC
(In reply to comment #3)
> I have a feeling that hooks should be in the core unless their users extend
> OpenID specifically.

Sergey, agreed, but that depend on the definition of "core".  If "core" includes standard Special pages like SpecialUserLogin, this hook is already included in there, thrice as a matter of fact, once in addNewAccountMailPassword() and twice in addNewAccount(), all 3 times immediately prior to addNewUserLogEntry() method.  The problem is that OpenID extension bypasses many of the checks and functional processes of the standard login and uses primatives.  This goes back to the question I discussed with you before about whether the two should be merged - I'd personally like to see this functionality included in the "core" and even used on WP.

In this case I use this particular hook for the exact same reason - to provide functionality when a new user registers.  Other hooks that have relevance for OpenID would be:

AbortNewAccount - http://www.mediawiki.org/wiki/Manual:Hooks/AbortNewAccount
AbortLogin - http://www.mediawiki.org/wiki/Manual:Hooks/AbortLogin
AuthPluginAutoCreate - http://www.mediawiki.org/wiki/Manual:Hooks/AuthPluginAutoCreate
LoginAuthenticateAudit - http://www.mediawiki.org/wiki/Manual:Hooks/LoginAuthenticateAudit
UserLoginMailPassword - http://www.mediawiki.org/wiki/Manual:Hooks/UserLoginMailPassword 
User::mailPasswordInternal - http://www.mediawiki.org/wiki/Manual:Hooks/mailPasswordInternal
UserLoginComplete - http://www.mediawiki.org/wiki/Manual:Hooks/UserLoginComplete
UserCreateForm - http://www.mediawiki.org/wiki/Manual:Hooks/UserCreateForm

Maybe the question is really should a different hook be provided that distinguishes it from standard logins, but much of this functionality is useful in both - and serves the exact same purpose in both generally.
Comment 5 Sergey Chernyshev 2009-11-30 19:06:53 UTC
I see your point and I think merging OpenID support into core is the right thing to do, but it's probably not my call to make.

I think it'll make sense to include some of those hooks (starting with AddNewAccount) into OpenID, but not sure if all of them should be included. It's possible that login needs to be re-architected to be "properly" extended considering that OpenID provides only portion of the process.

Do you have a specific implementation that requires any of those hooks to be added to OpenID?
Comment 6 Siebrand Mazeland 2011-05-16 09:54:31 UTC
Mass maintainer change.
Comment 7 T. Gries 2011-05-24 21:55:37 UTC
Added a hook as suggested. Added a third parameter to the hook $byOpenID = true

SpecialOpenIDLogin.body.php:

# new user account: not opened by mail, opened by OpenID
wfRunHooks( 'AddNewAccount', array( $user, false, true ) );

http://www.mediawiki.org/wiki/Manual:Hooks/AddNewAccount
fixed in r88758
Comment 8 T. Gries 2011-06-09 09:56:09 UTC
UPDATE/CORRECTION of comment #7

Added a hook as suggested.
SpecialOpenIDLogin.body.php:
 
 # new user account: not opened by mail, opened by OpenID
 wfRunHooks( 'AddNewAccount', array( $user, false ) );
 
* since r88763
* http://www.mediawiki.org/wiki/Manual:Hooks/AddNewAccount
* http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/OpenID/SpecialOpenIDLogin.body.php?revision=88763&view=markup

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links