mirror of
https://github.com/e107inc/e107.git
synced 2025-03-14 01:19:44 +01:00
News: {NEWS_VISIBILITY} shortcode added - returns text version of userclass for use in CSS class styling if needed.
This commit is contained in:
parent
bba40d458c
commit
eecbfbd61d
@ -1335,7 +1335,7 @@ class news_admin_ui extends e_admin_ui
|
||||
|
||||
if($mediaData = $this->processSubmittedMedia($row['submitnews_media']))
|
||||
{
|
||||
$data['news_body'] .= "\n\n".$mediaData;
|
||||
$data['news_body'] .= "\n\n---\n\n".$mediaData;
|
||||
}
|
||||
|
||||
if(e107::getPref('wysiwyg',false)!==false)
|
||||
@ -1343,6 +1343,7 @@ class news_admin_ui extends e_admin_ui
|
||||
$data['news_body'] = nl2br($data['news_body']);
|
||||
}
|
||||
|
||||
$data['news_author'] = $row['submitnews_user'];
|
||||
|
||||
$data['news_thumbnail'] = $row['submitnews_file']; // implode(",",$thumbs);
|
||||
$data['news_sef'] = eHelper::dasherize($data['news_title']);
|
||||
|
@ -357,6 +357,14 @@ class news_shortcodes extends e_shortcode
|
||||
return $this->sc_newsimage($parm);
|
||||
}
|
||||
|
||||
public function sc_news_visibility($parm=null)
|
||||
{
|
||||
$string= e107::getUserClass()->getIdentifier($this->news_item['news_class']);
|
||||
return $string;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------- BC compatible Shortcodes ------------------------------------------- //
|
||||
|
||||
function sc_newscategory($parm=null)
|
||||
|
@ -935,6 +935,32 @@ class user_class
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return a key-name identifier for given class ID
|
||||
* @param integer $id - class number. A negative number indicates 'not a member of...'
|
||||
* @return string class name ke
|
||||
*/
|
||||
public function getIdentifier($id)
|
||||
{
|
||||
$cn = abs($id);
|
||||
|
||||
$ucString = '';
|
||||
|
||||
$fixedClasses = array_flip($this->text_class_link);
|
||||
|
||||
if(isset($fixedClasses[$cn]))
|
||||
{
|
||||
return $fixedClasses[$cn];
|
||||
}
|
||||
|
||||
if(isset($this->class_tree[$cn]))
|
||||
{
|
||||
return e107::getForm()->name2id($this->class_tree[$cn]['userclass_name']);
|
||||
}
|
||||
|
||||
return $ucString;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return class description for given class ID
|
||||
|
Loading…
x
Reference in New Issue
Block a user