diff options
author | DM42.Net (Matt Dent) <dentm42@dm42.net> | 2018-12-14 12:52:58 -0500 |
---|---|---|
committer | DM42.Net (Matt Dent) <dentm42@dm42.net> | 2018-12-14 12:55:49 -0500 |
commit | eb297104debfc42fe6f3afee4eae3c2602627aeb (patch) | |
tree | e4122dfa9269c6769bd867cfcc6ee1fc4dff022a /Zotlabs/Module | |
parent | f81a3ba45d50c0a0e4da68c17aba73425058e23d (diff) | |
download | volse-hubzilla-eb297104debfc42fe6f3afee4eae3c2602627aeb.tar.gz volse-hubzilla-eb297104debfc42fe6f3afee4eae3c2602627aeb.tar.bz2 volse-hubzilla-eb297104debfc42fe6f3afee4eae3c2602627aeb.zip |
Make Affinity Slider (optionally) 'sticky' across page loads. (default is current behavior: reset slider with each page load)
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r-- | Zotlabs/Module/Network.php | 7 | ||||
-rw-r--r-- | Zotlabs/Module/Settings/Featured.php | 8 |
2 files changed, 15 insertions, 0 deletions
diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index b93faa612..894e5c8b6 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -132,6 +132,13 @@ class Network extends \Zotlabs\Web\Controller { $deftag = ''; + if (feature_enabled(local_channel(),'affinity')) { + $affinity_locked = int(get_pconfig(local_channel(),'affinity','lock',1)); + if ($affinity_locked) { + set_pconfig(local_channel(),'affinity','cmin',$cmin); + set_pconfig(local_channel(),'affinity','cmax',$cmax); + } + } if(x($_GET,'search') || $file || (!$pf && $cid) || $hashtags || $verb || $category || $conv || $unseen) $nouveau = true; diff --git a/Zotlabs/Module/Settings/Featured.php b/Zotlabs/Module/Settings/Featured.php index 542a05363..1d903fcf7 100644 --- a/Zotlabs/Module/Settings/Featured.php +++ b/Zotlabs/Module/Settings/Featured.php @@ -17,8 +17,12 @@ class Featured { $cmin = intval($_POST['affinity_cmin']); if($cmin < 0 || $cmin > 99) $cmin = 0; + + $lock = ($_POST['affinity_lock']) ? intval($_POST['affinity_lock']) : 1; + set_pconfig(local_channel(),'affinity','cmin',$cmin); set_pconfig(local_channel(),'affinity','cmax',$cmax); + set_pconfig(local_channel(),'affinity','lock',$lock); info( t('Affinity Slider settings updated.') . EOL); @@ -49,6 +53,10 @@ class Featured { $setting_fields .= replace_macros(get_markup_template('field_input.tpl'), array( '$field' => array('affinity_cmin', t('Default minimum affinity level'), $cmin, t('0-99 - default 0')) )); + $lock = intval(get_pconfig(local_channel(),'affinity','lock',1)); + $setting_fields .= replace_macros(get_markup_template('field_checkbox.tpl'), array( + '$field' => array('affinity_lock', t('Always reset on new page visit.'), $lock, t('default: yes'), Array('No','Yes')) + )); $settings_addons .= replace_macros(get_markup_template('generic_addon_settings.tpl'), array( '$addon' => array('affinity_slider', '' . t('Affinity Slider Settings'), '', t('Submit')), |