The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
hey, i hope i got the right forum for my little 'request'.
![]() I have added a new column called 'onfrontpage' to the 'thread' table. When i make a new thread there's a little selectbox where i can choose something like "is on frontpage". When i select "yes" the column 'onfrontpage' for this thread is filled with '1'. Otherwise it's '0'. Now here's my problem: I wan't to have a little '<input type="checkbox">' on showthread.php that shows if this thread is currently on the frontpage (if the columns 'onfrontpage' says '1') so that i can easily change it. But how do i do that? I've been working on that for 4 hours now but i didn't figure out how to do that yet ![]() I can't select the value of 'onfrontpage' out of the database. It must be somewhere hidden in the showthread.php or functions_showthread.php. Is there someone with too much spare time who is willing to help me? It doesn't need to be a detailed instruction, some hints are more than welcome ![]() regards, dominik |
#2
|
|||
|
|||
![]()
I believe it should be automatically loaded with your thread cache... Check $threadinfo['onfrontpage'] and see if it holds your variable?
|
#3
|
|||
|
|||
![]()
Well, that did the trick. I deleted that and replaced it with $show[onfrontpage] and that didn't work
![]() Thanks alot ![]() my next problem: i added the following to the SHOWTHREAD-template Code:
<div><label for="cb_onfrontpage"><input type="checkbox" name="do" value="onfrontpage" id="cb_onfrontpage" tabindex="1" $checked[onfrontpage] />Auf der Startseite?</label></div> Code:
// ############################### start do set on frontpage ############################### if ($_POST['do'] == 'onfrontpage') { $DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET onfrontpage = $threadinfo[onfrontpage] WHERE threadid = $threadid"); $_REQUEST['forceredirect'] = 1; $url = "showthread.php?$session[sessionurl]t=$threadid"; eval(print_standard_redirect('redirect_openclose')); } ![]() If i change $threadinfo[onfrontpage] to '1' or '0' manually he'll change it in the database... wrong variable i try to use? |
#4
|
|||
|
|||
![]()
In your query:
"onfrontpage = $threadinfo[onfrontpage]" You don't want to set the onfrontpage to the $threadinfo value, you want to set it to the form value. I would replace the checkbox value with "1" so that it will feed the database a 1 if it is checked. |
#5
|
|||
|
|||
![]()
I changed it to
Code:
<div><label for="cb_onfrontpage"><input type="checkbox" name="onfrontpage" value="1" id="cb_onfrontpage" tabindex="1" $checked[onfrontpage] />Auf der Startseite?</label></div> ![]() |
#6
|
|||
|
|||
![]()
Try these:
Code:
<div><label for="cb_onfrontpage"><input type="checkbox" name="onfrontpage" value="1" id="cb_onfrontpage" tabindex="1" $checked[onfrontpage] />Auf der Startseite?</label></div> Code:
// ############################### start do set on frontpage ############################### if ($_POST['onfrontpage'] == 1) { $DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET onfrontpage = 1 WHERE threadid = $threadid"); $_REQUEST['forceredirect'] = 1; $url = "showthread.php?$session[sessionurl]t=$threadid"; eval(print_standard_redirect('redirect_openclose')); } |
#7
|
|||
|
|||
![]()
hm that would work but not as i expected.
How can i set onfrontpage to '0' ? I want it so that you can select with the checkbox if the the post is on the frontpage (onfrontpage = '1') or not (onfrontpage = '0'). With your code it can only set it to '1' but not to '0'. |
#8
|
|||
|
|||
![]()
Well I don't know where this code is going, so I don't know if it has access to a current $threadinfo... if it does, this would work:
Code:
// ############################### start do set on frontpage ############################### if ($_POST['onfrontpage'] != $threadinfo['onfrontpage']) { $DB_site->query("UPDATE " . TABLE_PREFIX . "thread SET onfrontpage = $_POST['onfrontpage'] WHERE threadid = $threadid"); $_REQUEST['forceredirect'] = 1; $url = "showthread.php?$session[sessionurl]t=$threadid"; eval(print_standard_redirect('redirect_openclose')); } |
#9
|
|||
|
|||
![]()
this code is going to options.php line 143
![]() |
#10
|
|||
|
|||
![]()
do you mean postings.php? If so, it should have threadinfo and that should work.
|
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|