1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 11:50:30 +02:00

Viewable By shortcode added. Forum deleted template corrected.

This commit is contained in:
Cameron
2016-03-26 15:17:11 -07:00
parent e401e4b4ac
commit 2dedb86ba8
6 changed files with 164 additions and 10 deletions

View File

@@ -104,12 +104,12 @@ class e107forum
*/
}
/**
* Grab the forum data up front to reduce LEFT JOIN usage. Currently only forum_id and forum_sef but may be expanded as needed.
*/
function getForumData()
/**
* Grab the forum data up front to reduce LEFT JOIN usage. Currently only forum_id and forum_sef but may be expanded as needed.
*/
private function getForumData()
{
$data = e107::getDb()->retrieve("SELECT forum_id, forum_sef FROM `#forum`", true); // no ordering for better performance.
$data = e107::getDb()->retrieve("SELECT forum_id, forum_sef, forum_class FROM `#forum`", true); // no ordering for better performance.
$newData = array();
foreach($data as $row)
@@ -138,6 +138,32 @@ class e107forum
}
function getForumClassMembers($forumId, $type='view')
{
$fieldTypes = array('view' => 'forum_class');
$field = $fieldTypes[$type];
if(isset($this->forumData[$forumId][$field]))
{
$class = $this->forumData[$forumId]['forum_class'];
if($class == 0 || ($class > 250 && $class < 256))
{
return $class;
}
$qry = "SELECT user_id, user_name, user_class FROM `#user` WHERE FIND_IN_SET(".$class.", user_class) OR user_class = ".$class." ORDER by user_name LIMIT 50"; // FIND_IN_SET(user_class, ".$class.")
$users = e107::getDb()->retrieve($qry, true);
return $users;
}
return false;
}
/**
* @param $user integer userid (if empty "anon" will be used)