Make Affinity Slider (optionally) 'sticky' across page loads. (default is current behavior: reset slider with each page load)

This commit is contained in:
DM42.Net (Matt Dent)
2018-12-14 12:52:58 -05:00
parent f81a3ba45d
commit eb297104de
3 changed files with 22 additions and 2 deletions

View File

@@ -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')),