Modify UserLoginComplete and UserLogoutComplete hooks to allow HTML injection into...
authorAndrew Garrett <werdna@users.mediawiki.org>
Wed, 9 Apr 2008 12:44:53 +0000 (12:44 +0000)
committerAndrew Garrett <werdna@users.mediawiki.org>
Wed, 9 Apr 2008 12:44:53 +0000 (12:44 +0000)
docs/hooks.txt
includes/SpecialUserlogin.php
includes/SpecialUserlogout.php
includes/User.php

index db9d542..63d89a5 100644 (file)
@@ -1119,6 +1119,7 @@ $user: User to get groups for
 
 'UserLoginComplete': after a user has logged in
 $user: the user object that was created on login
+$inject_html: Any HTML to inject after the "logged in" message.
                    
 'UserLoginForm': change to manipulate the login form
 $template: SimpleTemplate instance for the form
@@ -1128,6 +1129,7 @@ $user: the user object that is about to be logged out
        
 'UserLogoutComplete': after a user has logged out
 $user: the user object _after_ logout (won't have name, ID, etc.)
+$inject_html: Any HTML to inject after the "logged out" message.
 
 'UserRights': After a user's group memberships are changed
 $user  : User object that was changed
index 211a9c1..9a93014 100644 (file)
@@ -603,12 +603,14 @@ class LoginForm {
 
                # Run any hooks; ignore results
 
-               wfRunHooks('UserLoginComplete', array(&$wgUser));
+               $injected_html = '';
+               wfRunHooks('UserLoginComplete', array(&$wgUser, &$injected_html));
 
                $wgOut->setPageTitle( wfMsg( 'loginsuccesstitle' ) );
                $wgOut->setRobotpolicy( 'noindex,nofollow' );
                $wgOut->setArticleRelated( false );
                $wgOut->addWikiText( $msg );
+               $wgOut->addHtml( $injected_html );
                if ( !empty( $this->mReturnTo ) ) {
                        $wgOut->returnToMain( $auto, $this->mReturnTo );
                } else {
index d9952ea..7dac24a 100644 (file)
@@ -12,8 +12,11 @@ function wfSpecialUserlogout() {
 
        $wgUser->logout();
        $wgOut->setRobotpolicy( 'noindex,nofollow' );
-       $wgOut->addHTML( wfMsgExt( 'logouttext', array( 'parse' ) ) );
+       
+       // Hook.
+       $injected_html = '';
+       wfRunHooks( 'UserLogoutComplete', array(&$wgUser, &$injected_html) );
+       
+       $wgOut->addHTML( wfMsgExt( 'logouttext', array( 'parse' ) ) . $injected_html );
        $wgOut->returnToMain();
-}
-
-
+}
\ No newline at end of file
index 103130f..6106733 100644 (file)
@@ -1976,7 +1976,6 @@ class User {
                global $wgUser;
                if( wfRunHooks( 'UserLogout', array(&$this) ) ) {
                        $this->doLogout();
-                       wfRunHooks( 'UserLogoutComplete', array(&$wgUser) );
                }
        }