mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-10 02:18:48 +00:00
[various] Use new centralized admin account retrieval methods
This commit is contained in:
parent
a5768ce402
commit
fada358607
2 changed files with 9 additions and 7 deletions
|
@ -40,15 +40,17 @@ function notifyall_post(App $a)
|
|||
return;
|
||||
}
|
||||
|
||||
$condition = ['account_removed' => false, 'account_expired' => false];
|
||||
|
||||
// if this is a test, send it only to the admin(s)
|
||||
// admin_email might be a comma separated list, but we need "a@b','c@d','e@f
|
||||
if (intval($_REQUEST['test'])) {
|
||||
$email = DI::config()->get('config', 'admin_email');
|
||||
$email = "'" . str_replace([" ",","], ["","','"], $email) . "'";
|
||||
}
|
||||
$sql_extra = ((intval($_REQUEST['test'])) ? sprintf(" AND `email` in ( %s )", $email) : '');
|
||||
$adminEmails = \Friendica\Model\User::getAdminListForEmailing(['email']);
|
||||
|
||||
$recipients = DBA::p("SELECT DISTINCT `email` FROM `user` WHERE `verified` AND NOT `account_removed` AND NOT `account_expired` $sql_extra");
|
||||
$condition['email'] = array_column($adminEmails, 'email');
|
||||
}
|
||||
|
||||
$recipients = DBA::p("SELECT DISTINCT `email` FROM `user`" . DBA::buildCondition($condition));
|
||||
|
||||
if (! $recipients) {
|
||||
DI::sysmsg()->addNotice(DI::l10n()->t('No recipients found.'));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue