News:

Wondering if this will always be free?  See why free is better.

Main Menu

Profile Field, Multi Check-boxes ?

Started by SychO, June 21, 2016, 02:43:18 PM

Previous topic - Next topic

SychO

What I wanna do is make a Multi Check-boxes field, it's for members to select some stuff as favorites,

The multi boxes show normally but doesn't save.

I did something like this and I added the column in the database as well


'multiselect' => array(
'type' => 'callback',
'callback_func' => 'multiselect_modify',
'permission' => 'admin_forum',
'preload' => create_function('', '
global $context, $user_info, $txt, $cur_profile, $modSettings;

$context[\'multiselect\'] = array(
array(\'format\' => \'option1\', \'title\' => \'Title1\'),
array(\'format\' => \'option2\', \'title\' => \'Title2\'),
array(\'format\' => \'option3\', \'title\' => \'Title3\'),
array(\'format\' => \'option4\', \'title\' => \'Title4\'),
);

return true;
'),
),


and this is the callback


function template_profile_multiselect_modify()
{
global $txt, $context, $settings;

echo '
<dt>
<strong>Your Favorites</strong><br />
<span class="smalltext"></span>
<br />';
echo '
</dt>
<dd>';

foreach($context['multiselect'] as $value) {
echo'
<input type="checkbox" name="', $value['format'], '" value="">', $value['title'], '<br>';
}

echo '</dd>';
}

Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

Advertisement: