]> git.mxchange.org Git - friendica.git/commitdiff
Issue 3616: Don't create notifications for forum accounts
authorMichael <heluecht@pirati.ca>
Sat, 12 Aug 2017 05:08:45 +0000 (05:08 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 12 Aug 2017 05:08:45 +0000 (05:08 +0000)
include/enotify.php

index 39665d14d4c994ca267127ef135b1e5962e03393..3b5672dcd82f2761ae8a26d1bad78a38fb95cdff 100644 (file)
@@ -45,9 +45,14 @@ function notification($params) {
        if (empty($sender_email))
                $sender_email = t('noreply').'@'.$hostname;
 
-       $user = q("SELECT `nickname` FROM `user` WHERE `uid` = %d", intval($params['uid']));
-       if ($user)
-               $nickname = $user[0]["nickname"];
+       $user = dba::select('user', array('nickname', 'page-flags'),
+                       array('uid' => $params['uid']), array('limit' => 1));
+
+       // There is no need to create notifications for forum accounts
+       if (!dbm::is_result($user) || in_array($user["page-flags"], array(PAGE_COMMUNITY, PAGE_PRVGROUP))) {
+               return;
+       }
+       $nickname = $user["nickname"];
 
        // with $params['show_in_notification_page'] == false, the notification isn't inserted into
        // the database, and an email is sent if applicable.