Browse Source

notification email on follow activities

pull/1/head
Friendika 11 years ago
parent
commit
05236adf0f
4 changed files with 36 additions and 2 deletions
  1. +20
    -0
      include/items.php
  2. +1
    -1
      mod/photos.php
  3. +14
    -0
      view/follow_notify_eml.tpl
  4. +1
    -1
      view/request_notify_eml.tpl

+ 20
- 0
include/items.php View File

@ -1045,6 +1045,26 @@ function new_follower($importer,$contact,$datarray,$item) {
dbesc(datetime_convert())
);
}
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($importer['uid'])
);
if(count($r)) {
if(($r[0]['notify-flags'] & NOTIFY_INTRO) && ($r[0]['page-flags'] == PAGE_NORMAL)) {
$email_tpl = load_view_file('view/follow_notify_eml.tpl');
$email = replace_macros($email_tpl, array(
'$requestor' => ((strlen($name)) ? $name : t('[Name Withheld]')),
'$url' => $url,
'$myname' => $r[0]['username'],
'$siteurl' => $a->get_baseurl(),
'$sitename' => $a->config['sitename']
));
$res = mail($r[0]['email'],
t("You have a new follower at ") . $a->config['sitename'],
$email,
'From: ' . t('Administrator') . '@' . $_SERVER[SERVER_NAME] );
}
}
}
}


+ 1
- 1
mod/photos.php View File

@ -1025,7 +1025,7 @@ function photos_content(&$a) {
$a->set_pager_total(count($r));
$r = q("SELECT `resource-id`, `id`, `filename`, `album`, max(`scale`) AS `scale` FROM `photo`
$r = q("SELECT `resource-id`, `id`, `filename`, `album`, max(`scale`) AS `scale` FROM `photo`
WHERE `uid` = %d AND `album` != '%s'
$sql_extra GROUP BY `resource-id` ORDER BY `created` DESC LIMIT %d , %d",
intval($a->data['user']['uid']),


+ 14
- 0
view/follow_notify_eml.tpl View File

@ -0,0 +1,14 @@
Dear $myname,
You have a new follower at $sitename - '$requestor'.
You may visit their profile at $url.
Please login to your site to approve or ignore/cancel the request.
$siteurl
Regards,
$sitename administrator

+ 1
- 1
view/request_notify_eml.tpl View File

@ -1,7 +1,7 @@
Dear $myname,
You have just received a personal introduction at $sitename
You have just received a connection request at $sitename
from '$requestor'.


Loading…
Cancel
Save