1

Topic: Select form problem

Hello! I'm making some extension and I would like to add SELECT in profle settings. So I'm doing something like this.

    <install><![CDATA[
            $forum_db->add_field('users', 'airagh_ext_avatars', 'TINYINT(1)', false, 1);
            $forum_db->add_field('users', 'airagh_ext_link_color', 'VARCHAR(10)', false, 'Default');
    ]]>
    </install>

    <uninstall><![CDATA[
        $forum_db->drop_field('users', 'airagh_ext_avatars');
        $forum_db->drop_field('users', 'airagh_ext_link_color');
    ]]>
    </uninstall>
    <hooks>
        <hook id="pf_change_details_settings_email_fieldset_end"><![CDATA[
            if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php'))
                include $ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php';
            else
                include $ext_info['path'].'/lang/English/'.$ext_info['id'].'.php';
            $forum_page['item_count'] = 0;
?>
                <fieldset class="frm-group group<?php echo ++$forum_page['group_count'] ?>">
                    <div class="sf-set set<?php echo ++$forum_page['item_count'] ?>">
                        <div class="sf-box checkbox">
                            <span class="fld-input"><input type="checkbox" id="fld<?php echo ++$forum_page['fld_count'] ?>" name="form[airagh_ext_avatars]" value="1"<?php if ($user['airagh_ext_avatars'] == '1') echo ' checked="checked"' ?> /></span>
                            <label for="fld<?php echo $forum_page['fld_count'] ?>"><span><?php echo $lang_airagh_ext['Display avatars'] ?></span> <?php echo $lang_airagh_ext['Display avatars label'] ?></label>
                        </div>
                        <div class="sf-box select">
                            <label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_airagh_ext['Link colors'] ?></span></label><br />
                            <span class="fld-input">
                                <select id="fld<?php echo $forum_page['fld_count'] ?>" name="form[airagh_ext_link_color]">
                                    <option value="Default" <?php if($user['airagh_ext_link_color']=='Default') echo("selected=\"selected\"") ?>><?php echo $lang_airagh_ext['Default'] ?></option>
                                    <option value="Black" <?php if($user['airagh_ext_link_color']=='Black') echo("selected=\"selected\"") ?>><?php echo $lang_airagh_ext['Black'] ?></option>
                                </select>
                            </span>
                        </div>
                    </div>
                </fieldset>
<?php
        ]]></hook>
        <hook id="pf_change_details_settings_validation"><![CDATA[
            $form['airagh_ext_avatars'] = (!isset($_POST['form']['airagh_ext_avatars']) || $_POST['form']['airagh_ext_avatars'] != '1') ? '0' : '1';
            if (isset($form['airagh_ext_link_color']))
            {
                $form['airagh_ext_link_color'] = preg_replace('#[\.\\\/]#', '', $form['airagh_ext_link_color']);
            }
            ]]></hook>

Checkbox is working all right, but selecting anything with select form seems to doesn't make any changes.
What's wrong with my code?

If any of my dropbox link fails with 404 error, change dl.dropbox.com/u/56038890/punbb/*.zip in address to 82283017.

Currently working on rPlus - responsive theme for developers to create their own themes basing on this one.

2

Re: Select form problem

Nevermind, I had problem in pf_change_details_settings_validation

If any of my dropbox link fails with 404 error, change dl.dropbox.com/u/56038890/punbb/*.zip in address to 82283017.

Currently working on rPlus - responsive theme for developers to create their own themes basing on this one.