Use something like:
PHP Code:
$answer = 'test';
These following examples should give you a better idea of how to use custom question:
How can I have a question which is the user's username?
1. Create 'Custom' question
2. Use following PHP Code:
PHP Code:
$answer = '<input type="text" readonly="readonly" id="q_' . $formbit[id] . '" name="' . $formbit[id] . '" value="' . $vbulletin->userinfo[username] . '" />';
How can I have a question which is the current date?
1. Create 'Custom' question
2. Use following PHP Code:
PHP Code:
$q[$formbit[id]] = vbdate($vbulletin->options['dateformat'], TIMENOW);
$answer = '<input type="text" readonly="readonly" id="q_' . $formbit[id] . '" name="' . $formbit[id] . '" value="' . $q[$formbit[id]] . '" />';
How can I have a question which gets the Timezone from user's profile?
1. Create 'Custom' question
2. Use following php Code:
PHP Code:
$answer = '<input type="text" readonly="readonly" id="q_' . $formbit[id] . '" name="' . $formbit[id] . '" value="GMT+' . $vbulletin->userinfo[timezoneoffset] . '" />';
How can I have a question which gets the Birthday from user's profile?
1. Create 'Custom' question
2. Use following php Code:
PHP Code:
$answer = '<input type="text" readonly="readonly" id="q_' . $formbit[id] . '" name="' . $formbit[id] . '" value="' . $vbulletin->userinfo[birthday] . '" />';
How can I have a question which uses a query?
The following example gets a list of threads in the forumid 10.
1. Create 'Custom' question
2. Use following php Code:
PHP Code:
$answer = '<select name="'.$formbit[id].'">';
$answer .= '<option></option>';
$thisanswer = $q[$formbit[id]];
$threads = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "thread
WHERE forumid = '10'
ORDER BY title ASC");
while($row = $db->fetch_array($threads)) {
$answer .= '<option value="'.$row[threadid].'"';
if ($row[threadid] == $thisanswer) {
$answer .= 'selected="selected"';
}
$answer .= '>'.$row[title].'</option>';
}
$answer .= '</select>';
Quote:
Originally Posted by Firas S.
Hello Bananalive,
I tried to add a custom question but I got a display error, i.e. what ever is written in the custom question will be displayed in the very top of the page, before the logo.
Actually, what am I trying to do is to add a dependent drop down list that is for the advertisement request period. For example, the first drop down would be the Period [Weeks, Months] and the second list would be the Length [1, 2, 3, 4] where the second one is dependent on the first one.
However, I also tried to write:
But I produced the same problem.
Is there any way to fix this?
Thanks mate
|