r86583 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86582‎ | r86583 | r86584 >
Date:00:08, 21 April 2011
Author:nimishg
Status:deferred
Tags:
Comment:
added hook to actually check that a user made it through the account process
Modified paths:
  • /trunk/extensions/CustomUserSignup/CustomUserSignup.hooks.php (modified) (history)
  • /trunk/extensions/CustomUserSignup/CustomUserSignup.php (modified) (history)
  • /trunk/extensions/CustomUserSignup/modules/AccountCreationUserBucket.js (modified) (history)

Diff [purge]

Index: trunk/extensions/CustomUserSignup/CustomUserSignup.php
@@ -39,6 +39,7 @@
4040
4141 // NOTE: This hook includes JS for the account creation project
4242 $wgHooks['BeforePageDisplay'][] = 'CustomUserSignupHooks::beforePageDisplay';
 43+$wgHooks['AddNewAccount'][] = 'CustomUserSignupHooks::addNewAccount';
4344
4445
4546 // For Account Creation Project
Index: trunk/extensions/CustomUserSignup/CustomUserSignup.hooks.php
@@ -100,8 +100,22 @@
101101 return true;
102102 }
103103
104 - public static function beforePageDisplay( $out, $skin ) {
105 - $out->addModules( 'ext.UserBuckets' );
106 - return true;
 104+ public static function beforePageDisplay( $out, $skin ) {
 105+ $out->addModules( 'ext.UserBuckets' );
 106+ return true;
 107+ }
 108+
 109+ public static function addNewAccount( $user, $byEmail ){
 110+ global $wgRequest;
 111+ $buckets = ClickTrackingHooks::unpackBucketInfo();
 112+ if(isset($buckets['AccountCreation']) && $buckets['AccountCreation'][0] != "none"){
 113+
 114+ // *NOT HTTPONLY* In fact, that's the point of this cookie
 115+
 116+ setcookie( 'acctcreation' , $buckets['AccountCreation'][0] ,
 117+ time() + 60 * 60 * 24 * 365 );
107118 }
 119+ return true;
 120+ }
 121+
108122 }
\ No newline at end of file
Index: trunk/extensions/CustomUserSignup/modules/AccountCreationUserBucket.js
@@ -21,37 +21,46 @@
2222 // particularly if there are orders of magnitude differences in the
2323 // bucket sizes
2424 // "none" is reserved for control
25 - "rates": {"NiceMsg1": 1, "NiceMsg2": 1 },
 25+ "rates": {"ACP1": 25, "ACP2": 25, "ACP3": 25, "none": 25},
2626
2727 // individual changes, function names corresponding
2828 // to what is in "rates" object
2929 // (note: "none" function not needed or used)
3030
31 - "NiceMsg1": function(){
 31+ "ACP1": function(){
3232 //change to NiceMsg1 campaign
33 - $j("#pt-anonlogin a").attr("href", $j("#pt-anonlogin a").attr("href") + "&campaign=NiceMsg1" );
 33+ $j("#pt-anonlogin a").attr("href", $j("#pt-anonlogin a").attr("href") + "&campaign=ACP1" );
3434 },
35 - "NiceMsg2": function(){
 35+ "ACP2": function(){
3636 //change to NiceMsg2 campaign
37 - $j("#pt-anonlogin a").attr("href", $j("#pt-anonlogin a").attr("href") + "&campaign=NiceMsg2" );
 37+ $j("#pt-anonlogin a").attr("href", $j("#pt-anonlogin a").attr("href") + "&campaign=ACP2" );
3838 },
 39+
 40+ "ACP3": function(){
 41+ //change to NiceMsg2 campaign
 42+ $j("#pt-anonlogin a").attr("href", $j("#pt-anonlogin a").attr("href") + "&campaign=ACP3" );
 43+ },
3944
4045 // "allActive" is reserved.
4146 // If this function exists, it will be apply to every user not in the "none" bucket
4247 "allActive": function(){
 48+ if($j.cookie('acctcreation') ){
 49+
 50+ //track login attempt
 51+ $j("#wpLoginAttempt").click(function(){ $j.trackAction('login-attempt'); });
 52+
 53+ //track account creation
 54+ $j("#wpCreateaccount").click(function(){ $j.trackAction('account-created'); });
 55+ $j("#userloginlink").click(function(){ $j.trackAction('login-link'); });
 56+
 57+ //add click tracking to preview
 58+ $j("#wpPreview").click(function(){ $j.trackAction('preview'); });
 59+
 60+ //add click tracking to save
 61+ $j("#wpSave").click(function(){ $j.trackAction('save'); });
 62+ }
4363
44 - //add click tracking to save
45 - $j("#wpSave").click(function(){ $j.trackAction('save'); });
4664
47 - //track login attempt
48 - $j("#wpLoginAttempt").click(function(){ $j.trackAction('login-attempt'); });
49 -
50 - //track account creation
51 - $j("#wpCreateaccount").click(function(){ $j.trackAction('account-created'); });
52 -
53 - //add click tracking to preview
54 - $j("#wpPreview").click(function(){ $j.trackAction('preview'); });
55 -
5665 }
5766
5867 };
\ No newline at end of file

Status & tagging log