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

Reply
 
Thread Tools Display Modes
  #1  
Old 07-19-2012, 09:14 AM
bzcomputers's Avatar
bzcomputers bzcomputers is offline
 
Join Date: Apr 2012
Location: TX
Posts: 503
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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?
Reply With Quote
  #2  
Old 07-19-2012, 09:37 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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).
Reply With Quote
  #3  
Old 07-19-2012, 12:04 PM
bzcomputers's Avatar
bzcomputers bzcomputers is offline
 
Join Date: Apr 2012
Location: TX
Posts: 503
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
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".
Reply With Quote
  #4  
Old 07-19-2012, 12:26 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 07-19-2012, 03:39 PM
bzcomputers's Avatar
bzcomputers bzcomputers is offline
 
Join Date: Apr 2012
Location: TX
Posts: 503
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
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.)
Reply With Quote
  #6  
Old 07-19-2012, 03:46 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by bzcomputers View Post
$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}}
Reply With Quote
  #7  
Old 07-19-2012, 03:58 PM
bzcomputers's Avatar
bzcomputers bzcomputers is offline
 
Join Date: Apr 2012
Location: TX
Posts: 503
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
oops, try {vb:urlencode {vb:raw cruiseline}}
Thanks for the quick replies, that did it - works perfect now!
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 10:22 PM.


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.05530 seconds
  • Memory Usage 2,222KB
  • Queries Executed 11 (?)
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
  • (3)bbcode_code
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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_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