diff --git a/include/text.php b/include/text.php index 4efa308911..67ce7e65e8 100644 --- a/include/text.php +++ b/include/text.php @@ -1239,33 +1239,33 @@ function prepare_body(&$item, $attach = false, $preview = false) { return $ev; } - if (!Config::get('system','suppress_tags')) { - $taglist = dba::p("SELECT `type`, `term`, `url` FROM `term` WHERE `otype` = ? AND `oid` = ? AND `type` IN (?, ?) ORDER BY `tid`", - intval(TERM_OBJ_POST), intval($item['id']), intval(TERM_HASHTAG), intval(TERM_MENTION)); + $taglist = dba::p("SELECT `type`, `term`, `url` FROM `term` WHERE `otype` = ? AND `oid` = ? AND `type` IN (?, ?) ORDER BY `tid`", + intval(TERM_OBJ_POST), intval($item['id']), intval(TERM_HASHTAG), intval(TERM_MENTION)); - while ($tag = dba::fetch($taglist)) { - if ($tag["url"] == "") { - $tag["url"] = $searchpath.strtolower($tag["term"]); - } - - $orig_tag = $tag["url"]; - - $tag["url"] = best_link_url($item, $sp, $tag["url"]); - - if ($tag["type"] == TERM_HASHTAG) { - if ($orig_tag != $tag["url"]) { - $item['body'] = str_replace($orig_tag, $tag["url"], $item['body']); - } - $hashtags[] = "#".$tag["term"].""; - $prefix = "#"; - } elseif ($tag["type"] == TERM_MENTION) { - $mentions[] = "@".$tag["term"].""; - $prefix = "@"; - } - $tags[] = $prefix."".$tag["term"].""; + while ($tag = dba::fetch($taglist)) { + if ($tag["url"] == "") { + $tag["url"] = $searchpath . strtolower($tag["term"]); } - dba::close($taglist); + + $orig_tag = $tag["url"]; + + $tag["url"] = best_link_url($item, $sp, $tag["url"]); + + if ($tag["type"] == TERM_HASHTAG) { + if ($orig_tag != $tag["url"]) { + $item['body'] = str_replace($orig_tag, $tag["url"], $item['body']); + } + + $hashtags[] = "#" . $tag["term"] . ""; + $prefix = "#"; + } elseif ($tag["type"] == TERM_MENTION) { + $mentions[] = "@" . $tag["term"] . ""; + $prefix = "@"; + } + + $tags[] = $prefix . "" . $tag["term"] . ""; } + dba::close($taglist); $item['tags'] = $tags; $item['hashtags'] = $hashtags; diff --git a/src/Object/Post.php b/src/Object/Post.php index 16dabbb71e..ecc6956be7 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -8,6 +8,7 @@ use Friendica\BaseObject; use Friendica\Content\ContactSelector; use Friendica\Content\Feature; use Friendica\Core\Addon; +use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\PConfig; use Friendica\Database\DBM; @@ -337,6 +338,7 @@ class Post extends BaseObject $tmp_item = [ 'template' => $this->getTemplate(), 'type' => implode("", array_slice(explode("/", $item['verb']), -1)), + 'suppress_tags' => Config::get('system', 'suppress_tags'), 'tags' => $item['tags'], 'hashtags' => $item['hashtags'], 'mentions' => $item['mentions'], diff --git a/view/templates/wall_thread.tpl b/view/templates/wall_thread.tpl index 37f034586a..a82efa7d1c 100644 --- a/view/templates/wall_thread.tpl +++ b/view/templates/wall_thread.tpl @@ -51,11 +51,13 @@