forked from GNUsocial/gnu-social
welcome notice, default sub for new users
This commit is contained in:
parent
a68836acb4
commit
148310e5fc
14
README
14
README
@ -1169,6 +1169,20 @@ banned: an array of usernames and/or profile IDs of 'banned' profiles.
|
|||||||
not be accepted at all. (Compare with blacklisted users above,
|
not be accepted at all. (Compare with blacklisted users above,
|
||||||
whose posts just won't show up in the public stream.)
|
whose posts just won't show up in the public stream.)
|
||||||
|
|
||||||
|
newuser
|
||||||
|
-------
|
||||||
|
|
||||||
|
Options with new users.
|
||||||
|
|
||||||
|
subscribe: nickname of a user account to automatically subscribe new
|
||||||
|
users to. Typically this would be system account for e.g.
|
||||||
|
service updates or announcements. Users are able to unsub
|
||||||
|
if they want. Default is null; no auto subscribe.
|
||||||
|
welcome: nickname of a user account that sends welcome messages to new
|
||||||
|
users. Can be the same as 'subscribe' account, although on
|
||||||
|
busy servers it may be a good idea to keep that one just for
|
||||||
|
'urgent' messages. Default is null; no message.
|
||||||
|
|
||||||
Troubleshooting
|
Troubleshooting
|
||||||
===============
|
===============
|
||||||
|
|
||||||
|
@ -273,12 +273,54 @@ class User extends Memcached_DataObject
|
|||||||
$user->emailChanged();
|
$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');
|
$profile->query('COMMIT');
|
||||||
|
|
||||||
if ($email && !$user->email) {
|
if ($email && !$user->email) {
|
||||||
mail_confirm_address($user, $confirm->code, $profile->nickname, $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;
|
return $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,6 +151,9 @@ $config =
|
|||||||
array('notify' => array()),
|
array('notify' => array()),
|
||||||
'inboxes' =>
|
'inboxes' =>
|
||||||
array('enabled' => true), # on by default for new sites
|
array('enabled' => true), # on by default for new sites
|
||||||
|
'newuser' =>
|
||||||
|
array('subscribe' => null,
|
||||||
|
'welcome' => null),
|
||||||
);
|
);
|
||||||
|
|
||||||
$config['db'] = &PEAR::getStaticProperty('DB_DataObject','options');
|
$config['db'] = &PEAR::getStaticProperty('DB_DataObject','options');
|
||||||
|
@ -391,6 +391,7 @@ class NoticeListItem extends Widget
|
|||||||
case 'xmpp':
|
case 'xmpp':
|
||||||
case 'mail':
|
case 'mail':
|
||||||
case 'omb':
|
case 'omb':
|
||||||
|
case 'system':
|
||||||
case 'api':
|
case 'api':
|
||||||
$this->out->element('dd', null, $source_name);
|
$this->out->element('dd', null, $source_name);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user