vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Help me start a new thread from within a script... (https://vborg.vbsupport.ru/showthread.php?t=97338)

JJR512 10-02-2005 02:29 AM

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! :)

Marco van Herwaarden 10-02-2005 06:44 AM

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. :D`

Kirk Y 10-02-2005 02:36 PM

Especially with 'discussannouncement' in the conditional there... lol. Sounds like a good idea, though.

JJR512 10-02-2005 03:39 PM

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?

Rostor 11-24-2005 01:53 PM

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) :D

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 :)


All times are GMT. The time now is 07:34 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01013 seconds
  • Memory Usage 1,734KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (3)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete