View Full Version : Post new thread from a non-vb page?
satorius99
07-03-2008, 04:44 AM
I'm a newbie but can't seem to find a recent article on how to let users post a new thread from a non-vb page. I am able to get the newthread template to appear on my page with the Title box and submit buttons displaying, but the problem is:
1) the Message box doesn't show up
2) I can post the just title to a the forum while logged in from my non-vb page, but when I try posting while not logged in, it takes me to the log in page, and then gives my the invalid security token error.
What is the proper way to achieve this?
Thanks
Dismounted
07-03-2008, 07:47 AM
You need to replicate the PHP code that displays/prepares the message box.
satorius99
07-03-2008, 02:47 PM
Thanks for the tip--just to clarify, you mean go into the newthread template and copy and paste the template code into my non-vb page? I tried this but it has the same effect. Also, what about issue #2 I mentioned?
What I'm trying to achieve is a Yedda-style "Ask a question" box which will appear on our website's many article pages. Our website is a high traffic home improvement site and we have added a vb forum which is only linked to from one place on our site. This "ask-a-question" box will appear below our articles, which is really just a disguised "new thread" message box. Is there a standard approach for integrating this or an article somewhere that I can look at?
Thanks again for your help.
Dismounted
07-03-2008, 03:16 PM
I'm referring to the PHP code - there is more to displaying the box than just the HTML.
satorius99
07-03-2008, 03:50 PM
I realize that, but I wouldn't even know where to find php code you're talking about. Also, I'm trying not to reinvent the wheel and want to know if this has been done before and if so, how. Again, I am new to vbulletin.
--------------- Added 1215128354 at 1215128354 ---------------
Well I'm still peeling away more layers of the onion - replicating the newthread php code and trying different things in the header of my page but I keep running into the same "security token" issue when posting as an unregistered user. Any help is appreciated.
Any other examples of what this thread title describes that anybody knows of? Seems like simple enough functionality, but I can't find any help...
Dismounted
07-04-2008, 05:29 AM
The security token should be "guest" if the user is not logged in.
satorius99
07-06-2008, 06:00 PM
Ok, I tried updating this but no luck. Just to be clear, is this the token you mean? From the new thread non-vb page:
<input type="hidden" name="securitytoken" value="guest" />
--------------- Added 1215379840 at 1215379840 ---------------
I finally figured this out - I had changed the 'CSRF_PROTECTION' to false from the page with the form (the non-vb page), when it needed to be done on the receiving page (newthread.php). This was the line in question:
define('CSRF_PROTECTION', false);
I knew it would turn out to be a newbie mistake!
Thanks for your help.
Dismounted
07-07-2008, 06:39 AM
You shouldn't disable CSRF protection - it's there for a reason.
Opserty
07-07-2008, 08:45 AM
You could probably generate your own security if you replicate what vBulletin does to generate its own. (Just follow the security token variable backwards, global.php is a good place to start).
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.