Преглед изворни кода

Ticket #1689 - When profile status isn't 'active' then hide any profile content: Voted By list and Timeline.

AntonLV пре 4 година
родитељ
комит
37ef85ae19

+ 1 - 1
inc/classes/BxDolObjectQuery.php

@@ -97,7 +97,7 @@ class BxDolObjectQuery extends BxDolDb
         if(!empty($iPerPage))
             $sLimitClause = $this->prepareAsString(" LIMIT ?, ?", $iStart, $iPerPage);
 
-        $sQuery = $this->prepare("SELECT `author_id` FROM `{$this->_sTableTrack}` WHERE `object_id` = ?" . $sLimitClause, $iObjectId);
+        $sQuery = $this->prepare("SELECT `tt`.`author_id` FROM `{$this->_sTableTrack}` AS `tt` INNER JOIN `sys_profiles` AS `tp` ON `tt`.`author_id`=`tp`.`id` AND `tp`.`status`='active' WHERE `tt`.`object_id` = ?" . $sLimitClause, $iObjectId);
         return $this->getColumn($sQuery);
     }
     

+ 8 - 7
inc/classes/BxDolVoteReactionsQuery.php

@@ -96,8 +96,8 @@ class BxDolVoteReactionsQuery extends BxDolVoteQuery
     	$aMethod = array('name' => 'getAll', 'params' => array(0 => 'query'));
         $aBindings = array();
 
-    	$sSelectClause = '*';
-    	$sWhereClause = '';
+    	$sSelectClause = '`tt`.*';
+    	$sJoinClause = $sWhereClause = '';
     	$sLimitClause = isset($aParams['start']) && !empty($aParams['per_page']) ? "LIMIT " . $aParams['start'] . ", " . $aParams['per_page'] : "";
 
     	if(!empty($aParams['type']))
@@ -105,24 +105,25 @@ class BxDolVoteReactionsQuery extends BxDolVoteQuery
                 case 'by':
                     $aBindings['object_id'] = $aParams['object_id'];
 
-                    $sWhereClause = 'AND `object_id` = :object_id';
+                    $sJoinClause = "INNER JOIN `sys_profiles` AS `tp` ON `tt`.`author_id`=`tp`.`id` AND `tp`.`status`='active'";
+                    $sWhereClause = "AND `tt`.`object_id` = :object_id";
 
                     if(!empty($aParams['reaction'])) {
                         $aMethod['name'] = 'getColumn';
                         $aBindings['reaction'] = $aParams['reaction'];
 
-                        $sSelectClause = '`author_id`';
-                        $sWhereClause .= ' AND `reaction`=:reaction';
+                        $sSelectClause = "`tt`.`author_id`";
+                        $sWhereClause .= " AND `tt`.`reaction`=:reaction";
                     }
                     else {
                         $aMethod['name'] = 'getAll';
 
-                        $sSelectClause = '`author_id`, `reaction`';
+                        $sSelectClause = "`tt`.`author_id`, `tt`.`reaction`";
                     }
                     break;
             }
 
-        $aMethod['params'][0] = "SELECT " . $sSelectClause . " FROM `" . $this->_sTableTrack . "` WHERE 1 " . $sWhereClause . $sLimitClause;
+        $aMethod['params'][0] = "SELECT " . $sSelectClause . " FROM `" . $this->_sTableTrack . "` AS `tt` " . $sJoinClause . " WHERE 1 " . $sWhereClause . $sLimitClause;
         $aMethod['params'][] = $aBindings;
 
         return call_user_func_array(array($this, $aMethod['name']), $aMethod['params']);

+ 1 - 1
modules/boonex/timeline/classes/BxTimelineDb.php

@@ -546,7 +546,7 @@ class BxTimelineDb extends BxBaseModNotificationsDb
 
         $sSqlMask = "SELECT {select}
             FROM `{$this->_sTable}`
-            LEFT JOIN `{$this->_sTableHandlers}` ON `{$this->_sTable}`.`type`=`{$this->_sTableHandlers}`.`alert_unit` AND `{$this->_sTable}`.`action`=`{$this->_sTableHandlers}`.`alert_action` {join}
+            INNER JOIN `sys_profiles` ON `{$this->_sTable}`.`object_owner_id`=`sys_profiles`.`id` AND `sys_profiles`.`status`='active' LEFT JOIN `{$this->_sTableHandlers}` ON `{$this->_sTable}`.`type`=`{$this->_sTableHandlers}`.`alert_unit` AND `{$this->_sTable}`.`action`=`{$this->_sTableHandlers}`.`alert_action` {join}
             WHERE 1 {where} {order} {limit}";
 
         if(is_string($mixedWhereClause)) {