Mark.B
04-13-2009, 07:45 PM
In another thread there has been some discussion of creating a style chooser dropdown that actually updates the member's profile details.
We have achieved that part of it ok.
It works like the existing style chooser, from a drop down list that then refreshes the page.
That works fine, but I would *also* like to get a URL equivalent to the dropdown that achieves the same thing. This will be for use in the postbit where I have an entry showing people's style as a clickable link.
The submit code being used in the php file is this:
if ($_POST['do'] == 'updateoptions')
{
if ($show['member']){
$vbulletin->input->clean_array_gpc('p', array('newstyleset' => TYPE_INT));
$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD);
$userdata->set_existing($vbulletin->userinfo);
// style set
if ($vbulletin->options['allowchangestyles'] AND $vbulletin->userinfo['realstyleid'] != $vbulletin->GPC['newstyleset'])
{
$userdata->set('styleid', $vbulletin->GPC['newstyleset']);
}
($hook = vBulletinHook::fetch_hook('profile_updateoptions') ) ? eval($hook) : false;
$userdata->save();
}
else {
exec_header_redirect("../index.php?");
}
}
And the HTML in the template is this:
<input type="hidden" name="s" value="" />
<input type="hidden" name="do" value="updateoptions" />
<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
<select class="forumselector" name="newstyleset" id="sel_newstyleset" onchange="this.form.submit()";>
<optgroup label="$vbphrase[quick_style_chooser]">
$quickchooserbits
</optgroup>
</select>
Could someone let me know if it's possible to submit this form via a clickable URL? Or failing that, a submit button would do.... And if so what the syntax is?
We have achieved that part of it ok.
It works like the existing style chooser, from a drop down list that then refreshes the page.
That works fine, but I would *also* like to get a URL equivalent to the dropdown that achieves the same thing. This will be for use in the postbit where I have an entry showing people's style as a clickable link.
The submit code being used in the php file is this:
if ($_POST['do'] == 'updateoptions')
{
if ($show['member']){
$vbulletin->input->clean_array_gpc('p', array('newstyleset' => TYPE_INT));
$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD);
$userdata->set_existing($vbulletin->userinfo);
// style set
if ($vbulletin->options['allowchangestyles'] AND $vbulletin->userinfo['realstyleid'] != $vbulletin->GPC['newstyleset'])
{
$userdata->set('styleid', $vbulletin->GPC['newstyleset']);
}
($hook = vBulletinHook::fetch_hook('profile_updateoptions') ) ? eval($hook) : false;
$userdata->save();
}
else {
exec_header_redirect("../index.php?");
}
}
And the HTML in the template is this:
<input type="hidden" name="s" value="" />
<input type="hidden" name="do" value="updateoptions" />
<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
<select class="forumselector" name="newstyleset" id="sel_newstyleset" onchange="this.form.submit()";>
<optgroup label="$vbphrase[quick_style_chooser]">
$quickchooserbits
</optgroup>
</select>
Could someone let me know if it's possible to submit this form via a clickable URL? Or failing that, a submit button would do.... And if so what the syntax is?