From a08a589fd7382a2c18e450e8a469c036244fae2a Mon Sep 17 00:00:00 2001 From: Cameron Date: Fri, 3 Mar 2017 13:04:49 -0800 Subject: [PATCH] Fixes #2476 - News Author Avatar --- .../shortcodes/batch/news_shortcodes.php | 5 ++-- e107_handlers/news_class.php | 4 ++-- e107_plugins/news/news.php | 24 +++++++++---------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/e107_core/shortcodes/batch/news_shortcodes.php b/e107_core/shortcodes/batch/news_shortcodes.php index f10988aec..6d92063c7 100644 --- a/e107_core/shortcodes/batch/news_shortcodes.php +++ b/e107_core/shortcodes/batch/news_shortcodes.php @@ -303,7 +303,6 @@ class news_shortcodes extends e_shortcode public function sc_news_author_signature($parm=null) { - $user = e107::user($this->news_item['user_id']); if(!empty($user['user_signature'])) @@ -420,7 +419,9 @@ class news_shortcodes extends e_shortcode { if(!empty($this->news_item['user_id'])) { - return e107::getParser()->toAvatar($this->news_item['user_id'], $parm); + + + return e107::getParser()->toAvatar($this->news_item, $parm); } } diff --git a/e107_handlers/news_class.php b/e107_handlers/news_class.php index 3cae408c4..8caf8a3eb 100644 --- a/e107_handlers/news_class.php +++ b/e107_handlers/news_class.php @@ -528,7 +528,7 @@ class e_news_item extends e_front_model $id = intval($id); $nobody_regexp = "'(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)'"; - $query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_sef, nc.category_icon FROM #news AS n + $query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, u.user_image, nc.category_name, nc.category_sef, nc.category_icon FROM #news AS n LEFT JOIN #user AS u ON n.news_author = u.user_id LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id WHERE n.news_id={$id} AND n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") @@ -637,7 +637,7 @@ class e_news_tree extends e_front_tree_model $db_limit = vartrue($params['db_limit'], '0,10'); - $query = "SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon FROM #news AS n + $query = "SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, u.user_image, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon FROM #news AS n LEFT JOIN #user AS u ON n.news_author = u.user_id LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id {$where} diff --git a/e107_plugins/news/news.php b/e107_plugins/news/news.php index ce1c945da..aee8881f1 100644 --- a/e107_plugins/news/news.php +++ b/e107_plugins/news/news.php @@ -684,7 +684,7 @@ class news_front // $news_total = $sql->count("news", "(*)", "WHERE news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.") AND news_start < ".time()." AND (news_end=0 || news_end>".time().")". str_replace("n.news", "news", $renTypeQry)); $query = " - SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon, + SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, u.user_image, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon, nc.category_meta_keywords, nc.category_meta_description FROM #news AS n LEFT JOIN #user AS u ON n.news_author = u.user_id @@ -706,7 +706,7 @@ class news_front // $news_total = $sql->count("news", "(*)", "WHERE news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.") AND news_start < ".time()." AND (news_end=0 || news_end>".time().") AND news_category=".intval($sub_action)); $query = " - SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon, nc.category_meta_keywords, + SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, u.user_image, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon, nc.category_meta_keywords, nc.category_meta_description FROM #news AS n LEFT JOIN #user AS u ON n.news_author = u.user_id @@ -722,7 +722,7 @@ class news_front $tagsearch = e107::getParser()->filter($_GET['tag']); $query = " - SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon, nc.category_meta_keywords, + SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, u.user_image, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon, nc.category_meta_keywords, nc.category_meta_description FROM #news AS n LEFT JOIN #user AS u ON n.news_author = u.user_id @@ -740,7 +740,7 @@ class news_front $authorSearch = e107::getParser()->filter($_GET['author']); $query = " - SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon, nc.category_meta_keywords, + SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, u.user_image, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon, nc.category_meta_keywords, nc.category_meta_description FROM #news AS n LEFT JOIN #user AS u ON n.news_author = u.user_id @@ -949,7 +949,7 @@ class news_front if(isset($this->pref['trackbackEnabled']) && $this->pref['trackbackEnabled']) { $query = " - SELECT COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_id, nc.category_name, nc.category_sef, + SELECT COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle, u.user_image, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon, nc.category_meta_keywords, nc.category_meta_description FROM #news AS n LEFT JOIN #user AS u ON n.news_author = u.user_id @@ -963,7 +963,7 @@ class news_front else { $query = " - SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon, nc.category_meta_keywords, + SELECT n.*, u.user_id, u.user_name, u.user_customtitle, u.user_image, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon, nc.category_meta_keywords, nc.category_meta_description FROM #news AS n LEFT JOIN #user AS u ON n.news_author = u.user_id @@ -1120,7 +1120,7 @@ class news_front private function getQuery() { $query = " - SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon, + SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, u.user_image, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon, nc.category_meta_keywords, nc.category_meta_description FROM #news AS n LEFT JOIN #user AS u ON n.news_author = u.user_id @@ -1155,7 +1155,7 @@ class news_front $sub_action = intval($this->subAction); // $news_total = $sql->db_Count("news", "(*)", "WHERE news_category={$sub_action} AND news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.") AND news_start < ".time()." AND (news_end=0 || news_end>".time().")"); $query = " - SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_id, nc.category_name, nc.category_sef, + SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, u.user_image, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon, nc.category_meta_keywords, nc.category_meta_description FROM #news AS n LEFT JOIN #user AS u ON n.news_author = u.user_id @@ -1175,7 +1175,7 @@ class news_front if(isset($this->pref['trackbackEnabled']) && $this->pref['trackbackEnabled']) { $query = " - SELECT COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_id, nc.category_name, nc.category_sef, + SELECT COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle, u.user_image, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon, nc.category_meta_keywords, nc.category_meta_description FROM #news AS n LEFT JOIN #user AS u ON n.news_author = u.user_id @@ -1188,7 +1188,7 @@ class news_front else { $query = " - SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon, + SELECT n.*, u.user_id, u.user_name, u.user_customtitle, u.user_image, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon, nc.category_meta_keywords, nc.category_meta_description FROM #news AS n LEFT JOIN #user AS u ON n.news_author = u.user_id @@ -1226,7 +1226,7 @@ class news_front $enddate = mktime(23, 59, 59, $month, $lastday, $year); $query = " - SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_id, nc.category_name, nc.category_sef, + SELECT SQL_CALC_FOUND_ROWS n.*, u.user_id, u.user_name, u.user_customtitle, u.user_image, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon, nc.category_meta_keywords, nc.category_meta_description FROM #news AS n LEFT JOIN #user AS u ON n.news_author = u.user_id @@ -1255,7 +1255,7 @@ class news_front // Get number of news item to show if(isset($this->pref['trackbackEnabled']) && $this->pref['trackbackEnabled']) { $query = " - SELECT SQL_CALC_FOUND_ROWS COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_id, + SELECT SQL_CALC_FOUND_ROWS COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle, u.user_image, nc.category_id, nc.category_name, nc.category_sef, nc.category_icon, nc.category_meta_keywords, nc.category_meta_description, COUNT(*) AS tbcount FROM #news AS n