Set echo preferences for new users after their account is created

Default settings for existing users are intended to be low volume and not annoying
New users need more encouragement and incentive to return

Change-Id: Id37ad8289a5c968ae8be6a8c424a19d6cbc7e071
This commit is contained in:
lwelling 2013-04-24 20:41:47 -04:00
parent 51bd09e3aa
commit 073ef28599
2 changed files with 17 additions and 7 deletions

View file

@ -409,16 +409,15 @@ $wgDefaultUserOptions['echo-notify-show-link'] = true;
// By default, send emails for each notification as they come in
$wgDefaultUserOptions['echo-email-frequency'] = EchoHooks::EMAIL_IMMEDIATELY;
// Set all of the events to notify by web and email by default (won't affect events that don't email)
// Set all of the events to notify by web but not email by default (won't affect events that don't email)
foreach ( $wgEchoNotificationCategories as $category => $categoryData ) {
foreach ( $wgEchoNotifiers as $notifierType => $notifierData ) {
$wgDefaultUserOptions["echo-subscriptions-{$notifierType}-{$category}"] = true;
}
$wgDefaultUserOptions["echo-subscriptions-email-{$category}"] = false;
$wgDefaultUserOptions["echo-subscriptions-web-{$category}"] = true;
}
// unset default notifications for reverted (change them to opt-in)
$wgDefaultUserOptions['echo-subscriptions-email-reverted'] = false;
$wgDefaultUserOptions['echo-subscriptions-web-reverted'] = false;
// most settings default to web on, email off, but override these two
$wgDefaultUserOptions['echo-subscriptions-email-edit-user-talk'] = true;
$wgDefaultUserOptions['echo-subscriptions-web-article-linked'] = false;
// Echo Configuration for EventLogging
$wgEchoConfig = array(

View file

@ -446,6 +446,17 @@ class EchoHooks {
* @return bool
*/
public static function onAccountCreated( $user, $byEmail ) {
// new users get echo preferences set that are not the default settings for existing users
$user->setOption( 'echo-subscriptions-web-reverted', false );
$user->setOption( 'echo-subscriptions-email-reverted', false );
$user->setOption( 'echo-subscriptions-web-article-linked', true );
$user->setOption( 'echo-subscriptions-email-mention', true );
$user->setOption( 'echo-subscriptions-email-page-review', true );
$user->setOption( 'echo-subscriptions-email-edit-thank', true );
$user->setOption( 'echo-subscriptions-email-article-linked', true );
$user->saveSettings();
EchoEvent::create( array(
'type' => 'welcome',
'agent' => $user,