vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Is it possible to automatically prefill the title field when creating a new thread? (https://vborg.vbsupport.ru/showthread.php?t=318486)

greigeh 04-30-2015 12:57 AM

Is it possible to automatically prefill the title field when creating a new thread?
 
Hey,

the title might sound confusing but it's a lot more straightforward than it sounds. Does vBulletin have a way in which by clicking a link to make a new thread for example:

http://popoverdose.com/newthread.php?do=newthread&f=29&title=hey

it would automatically type in the title field 'hey'? Or would this require a plugin?

Thanks

PinkMilk 05-04-2015 12:12 AM

I would think it is, I've be able to grab the get var using javascript but for some reason its not adding it to the input.

All edits are made in the newthread template

Just below <head> I added this:
Code:

<script type="text/javascript">
// this function grabs the hey from &title=hey
function getUrlVars() {
    var vars = {},
        parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
        vars[key] = value;
    });
    return vars;
}

// Making life easier, cleaning text up and relevant get var
var newtitle = decodeURIComponent(getUrlVars()["title"]);

// this should add the hey as the inputs value but it doesn't and I'm not sure why
document.getElementById("titlefromurl").value=newtitle;

</script>

and added new id to the relevant input:
Code:

<input id="titlefromurl" type="text" class="bginput" name="subject"
Obviously this only partially works and so not very helpful to you just yet but I thought I would post it in case others my be able to do something with it and get it working.

kh99 05-04-2015 01:27 PM

I think this might be what we were talking about in this thread: https://vborg.vbsupport.ru/showthread.php?t=285718

greigeh 05-04-2015 08:25 PM

Thanks a bunch!


All times are GMT. The time now is 05:29 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.01186 seconds
  • Memory Usage 1,718KB
  • 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
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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