summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-03-28 17:36:39 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-03-30 11:14:43 -0400
commit148310e5fc78e69f6bde3683855009dc3d8d485b (patch)
treea10529f506f70ac3a858c6ad660a7e50868c96bf /classes
parenta68836acb4c43500dbff89be1faec19969bc34c2 (diff)
welcome notice, default sub for new users
Diffstat (limited to 'classes')
-rw-r--r--classes/User.php42
1 files changed, 42 insertions, 0 deletions
diff --git a/classes/User.php b/classes/User.php
index d9f30bec5..e9e472fe1 100644
--- a/classes/User.php
+++ b/classes/User.php
@@ -273,12 +273,54 @@ class User extends Memcached_DataObject
$user->emailChanged();
}
+ // Default system subscription
+
+ $defnick = common_config('newuser', 'default');
+
+ if (!empty($defnick)) {
+ $defuser = User::staticGet('nickname', $defnick);
+ if (empty($defuser)) {
+ common_log(LOG_WARNING, sprintf("Default user %s does not exist.", $defnick),
+ __FILE__);
+ } else {
+ $defsub = new Subscription();
+ $defsub->subscriber = $user->id;
+ $defsub->subscribed = $defuser->id;
+ $defsub->created = $user->created;
+
+ $result = $defsub->insert();
+
+ if (!$result) {
+ common_log_db_error($defsub, 'INSERT', __FILE__);
+ return false;
+ }
+ }
+ }
+
$profile->query('COMMIT');
if ($email && !$user->email) {
mail_confirm_address($user, $confirm->code, $profile->nickname, $email);
}
+ // Welcome message
+
+ $welcome = common_config('newuser', 'welcome');
+
+ if (!empty($welcome)) {
+ $welcomeuser = User::staticGet('nickname', $welcome);
+ if (empty($welcomeuser)) {
+ common_log(LOG_WARNING, sprintf("Welcome user %s does not exist.", $defnick),
+ __FILE__);
+ } else {
+ $notice = Notice::saveNew($welcomeuser->id,
+ sprintf(_('Welcome to %1$s, @%2$s!'),
+ common_config('site', 'name'),
+ $user->nickname),
+ 'system');
+ }
+ }
+
return $user;
}