vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   How to hyperlink to start New Thread with Title? (https://vborg.vbsupport.ru/showthread.php?t=285718)

bzcomputers 07-19-2012 09:14 AM

How to hyperlink to start New Thread with Title?
 
I know you can hyperlink to start a new thread in a specific forum with this:

Code:

http://www.YOURSITE.COM/forum/newthread.php?action=newthread&forumid=XXX
Is there anyway to add a Thread Title to the link, so it automatically inserts in the the new thread?

kh99 07-19-2012 09:37 AM

You would need a plugin to do that, but it's a one liner. Use hook newthread_form_start and this code:

Code:

$newpost['title'] = $vbulletin->input->clean_gpc('r', 'subject', TYPE_STR);

and then add something like &subject=thread%20title to your url. (Of course your title will need to be URL-encoded, specifically spaces need to be represented as %20).

bzcomputers 07-19-2012 12:04 PM

Quote:

Originally Posted by kh99 (Post 2349449)
You would need a plugin to do that, but it's a one liner. Use hook newthread_form_start and this code:

Code:

$newpost['title'] = $vbulletin->input->clean_gpc('r', 'subject', TYPE_STR);

and then add something like &subject=thread%20title to your url. (Of course your title will need to be URL-encoded, specifically spaces need to be represented as %20).

Thanks for the quick response! Code works great and even being the novice I am, I was able to implement it quickly and easily with your simple instructions.

That being said, I have one follow up question...

If I attempt use a vBulletin variable in the Thread Title and it contains an ampersand in the variable the Thread Title will stop processing at that point and cut the rest of the title off. Is there a work around for this?

Example: I use ...&subject=Issues%20with%20{vb:raw cruiseline}
Where cruiseline = P&O Cruises, then the results displayed for title are "Issues with P".

kh99 07-19-2012 12:26 PM

Use {vb:urlencode cruiseline} instead of vb:raw.

BTW, user Sarteck came up with virtually the plugin I did, but deleted the post because I happened to post first. But I wanted to point something out that I hadn't thought of - I used 'subject' because that's what's used by the vb code when you submit a thread, but there's no reason you couldn't use any name you want, as long a it's the same in the plugin and where you construct the link. So for instance if you like &title=something better you could use that.

bzcomputers 07-19-2012 03:39 PM

Quote:

Originally Posted by kh99 (Post 2349497)
Use {vb:urlencode cruiseline} instead of vb:raw.

BTW, user Sarteck came up with virtually the plugin I did, but deleted the post because I happened to post first. But I wanted to point something out that I hadn't thought of - I used 'subject' because that's what's used by the vb code when you submit a thread, but there's no reason you couldn't use any name you want, as long a it's the same in the plugin and where you construct the link. So for instance if you like &title=something better you could use that.

$cruiseline = P&O Cruises

Using: &subject=Issues%20with%20{vb:raw cruiseline}

{vb:raw cruiseline} = "Issues with P"
{vb:urlencode cruiseline} = "Issues with cruiseline"

As you can see that didn't work.

(Thanks, for the additional info on the plugin.)

kh99 07-19-2012 03:46 PM

Quote:

Originally Posted by bzcomputers (Post 2349545)
$cruiseline = P&O Cruises

Using: &subject=Issues%20with%20{vb:raw cruiseline}

{vb:raw cruiseline} = "Issues with P"
{vb:urlencode cruiseline} = "Issues with cruiseline"

As you can see that didn't work.

oops, try {vb:urlencode {vb:raw cruiseline}}

bzcomputers 07-19-2012 03:58 PM

Quote:

Originally Posted by kh99 (Post 2349547)
oops, try {vb:urlencode {vb:raw cruiseline}}

Thanks for the quick replies, that did it - works perfect now!


All times are GMT. The time now is 07:52 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.01152 seconds
  • Memory Usage 1,731KB
  • 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
  • (3)bbcode_code_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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