Advertisement:

Author Topic: The default setting for value (option value="0")  (Read 324 times)

Offline innaahtina

  • Newbie
  • *
  • Posts: 5
The default setting for value (option value="0")
« on: May 16, 2018, 02:41:01 PM »
Hello, Tell me how to make default settings. I tried it, but it didn't work.

Code: [Select]
function template_initq()
{
global $context, $settings, $options, $txt;

/* Set the following variable to true if this theme requires the optional theme strings file to be loaded. */
$settings['pm_prefs'] = 0;
}

Initially there was a menu with 3 options, but I want to remove it and make the default specific option.
Here's the code with value:
Code: [Select]
<dt>
<label for="pm_prefs">', $txt['pm_display_mode'], ':</label>
</dt>
<dd>
<select name="pm_prefs" id="pm_prefs" onchange="if (this.value == 2 &amp;&amp; !document.getElementById(\'copy_to_outbox\').checked) alert(\'', $txt['pm_recommend_enable_outbox'], '\');">
<option value="0"', $context['display_mode'] == 0 ? ' selected="selected"' : '', '>', $txt['pm_display_mode_all'], '</option>
<option value="1"', $context['display_mode'] == 1 ? ' selected="selected"' : '', '>', $txt['pm_display_mode_one'], '</option>
<option value="2"', $context['display_mode'] == 2 ? ' selected="selected"' : '', '>', $txt['pm_display_mode_linked'], '</option>
</select>
</dd>

as I understand it, i need to insert this value at the beginning of the file, but how to do it with value (option value="0")?

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 8,134
  • 'Tis the gift to be simple (duh)
Re: The default setting for value (option value="0")
« Reply #1 on: May 16, 2018, 11:11:19 PM »
If you want to remove the select menu and force the same option on all members, this may do what you want -

PersonalMessage.php

Code: [Select]

// Preferences...
$context['display_mode'] = WIRELESS ? 0 : $user_settings['pm_prefs'] & 3;

$context['display_mode'] = 1;

$subActions = array(


Offline innaahtina

  • Newbie
  • *
  • Posts: 5
Re: The default setting for value (option value="0")
« Reply #2 on: May 17, 2018, 06:38:34 AM »
Sir Osis of Liver, Thanks, it works