Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-02-2005, 02:29 AM
JJR512's Avatar
JJR512 JJR512 is offline
 
Join Date: Oct 2001
Location: Glen Burnie, MD, USA
Posts: 710
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Help me start a new thread from within a script...

If a certain circumstance is true, I want a redirect to go newthread.php and have the Title and Message parts filled out with pre-determined info. How do I do this?

This will be done from one of the admincp pages (not going to say which at this time).

So far, I have:
Code:
if ($_POST['discussannouncement'] == '1')
{
define('CP_REDIRECT', $vboptions[bburl].'/newthread.php');
}
else
{
define('CP_REDIRECT', '-------.php');
}
As it is, this works fine. If the condition is true, it goes to newthread.php, and if it's not, it goes to itself, as is the normal behavior for the particular script. The only problem with the code above is that I get an invalid forum message, but I've already figured out I can solve that by changing "newthread.php" in the code above to "newthread.php?f=2" (or some other number).

But I'd like for the new thread page to have the Title and Message pre-filled out with the values of two separate variables.

Is there a way to do this?

Thanks in advance!
Reply With Quote
  #2  
Old 10-02-2005, 06:44 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just set the correct variables, shouldn't be much of a problem, check how preview works.

PS Not difficult to gues what you are working on. `
Reply With Quote
  #3  
Old 10-02-2005, 02:36 PM
Kirk Y's Avatar
Kirk Y Kirk Y is offline
 
Join Date: Apr 2005
Location: Tallahassee, Florida
Posts: 2,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Especially with 'discussannouncement' in the conditional there... lol. Sounds like a good idea, though.
Reply With Quote
  #4  
Old 10-02-2005, 03:39 PM
JJR512's Avatar
JJR512 JJR512 is offline
 
Join Date: Oct 2001
Location: Glen Burnie, MD, USA
Posts: 710
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hehe...

But I guess my problem is what are the correct variables. The way I'm trying to do it now, the only way to pass the variables is through the URL, correct?

On the newthread.php page, the name of the subject field is "subject". I've tried loading newthread.php?f=2&subject=test, yet the subject stays blank. But if I edit newthread.php and find the last time $subject is set to something, then after that add $subject="test", and load the page newthread.php?f=2, test IS in the subject.

To isolate the problem, in the newthread template I renamed the subject field to subject666, then loaded the page newthread.php?f=2&subject666=test. Still, the subject line was blank.

What am I doing wrong?

Quote:
Originally Posted by MarcoH64
...check how preview works...
Sorry, I missed that bit when I posted the reply. I'll check into that, but since you mention it, makes me wonder if it might be easier to make my hack load the newthread page in its preview stage, rather than in its newthread stage? I guess I'm thinking that because the preview stage is designed to be already filled out, whereas the newthread stage is designed to be blank. Does that make sense?
Reply With Quote
  #5  
Old 11-24-2005, 01:53 PM
Rostor Rostor is offline
 
Join Date: Nov 2001
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi JJR512,

I don't know if you need the code anymore, in any case I give you my solution (that is real similar to your)

In newthread.php I added 2 lines,

First for the text that must apper in messagetextarea
PHP Code:
// ############################### start new thread ###############################
if ($_REQUEST['do'] == 'newthread')
{
        
$newpost['message'] = $_REQUEST['messaggionews']; 
Second for the subject just where you said,
PHP Code:
        $subject $newpost['title'];
        
$subject $_REQUEST['oggettonews'];  #ROSTOR 
Then I put the value in newthread template for the sbject :

PHP Code:
<input type="text" class="bginput" name="subject" value="$subjectvalue="$oggettonewssize="40" maxlength="85" tabindex="1" /> 
That's all

Now you can open a 3D with a link like this : newthread.php?do=newthread&f=1&oggettonews=YOUROBJ ECTHERE&messaggionews=YOURMESSAGEHERE

bYE
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:36 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04581 seconds
  • Memory Usage 2,211KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (3)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete