Core Preferences

on Tuesday 20 August 2019
comments: 0

How to get the value of one needed preference?

Example for the list of installed plugins:

$builder_pluglist = e107::getPref('plug_installed');

Where to find used core pref name?

In admin area: Tools / Database / Preferences Editor

How to manage core prefs from custom plugins

This is the way I have confirmed as working... 

$pref = e107::getPref();
$core_pref = e107::getConfig();

the form works with $pref

$core_pref->setPref($pref)->save(false, true);

if pref is multilanguage, it's a bit complicated according to admin/meta.php file 

How to change only one core pref

e107::getConfig('core')->setPref('prefnamet', $new_value);
* Save object data to DB
* @param boolean $from_post merge post data
* @param boolean $force
* @param mixed $session_messages null: normal messages displayed, true: session messages used, false: no messages displayed. 
* @return boolean|integer 0 - no change, true - saved, false - error

Not clear what $from_post means. With one pref true, with full $pref false?


Other links

Follow us