The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
While on my journey from 3.6 to 3.7 I'm having some trouble with a script I have that looks at some extra checkboxes below a post.
In the newpost_process hook I take $post['message'] and parse it for a variety of things based on the checkboxes below the post. So I'd have this in my template: HTML Code:
<div><label for="cb_parsethis"><input type="checkbox" name="parsethis" value="1" id="cb_parsethis" tabindex="1" $checked[parsethis] />Parse this</label></div> Then in the hook I'd have: PHP Code:
|
#2
|
|||
|
|||
![]()
The users have to "submit" the form, it won't just run the code automatically when you tick the box.
Note: Including forms inside posts, will cause conflicts with the inline moderation form (the one that allows you to check the boxes in the corner of a post). That is if you are a user with inline moderation permissions. |
#3
|
|||
|
|||
![]()
I'm sorry, I didn't explain what I was doing properly.
This is a checkbox I've added to the misc area for when you make a new post, right under "Automatically parse links in text" that all vB new posts have. It's not a form within a form, just an additional input field. |
#4
|
|||
|
|||
![]()
Oh, I see. You need to clean the input ( Using the vBulletin Input Cleaner) from the checkbox. TYPE_BOOL will probably be the one you want. Then you check it like so:
PHP Code:
|
#5
|
|||
|
|||
![]()
The odd thing is if I put print_r($post) in the newpost_process hook, I see everything in the $post array, and [parsethis] is nowhere to be found. For some reason the field is not being submitted.
|
#6
|
|||
|
|||
![]()
Use the information I gave you in my previous post, you could just add it to $post yourself...
If you want to see what vBulletin is doing with your code, start with the form submission. (Look at where the form posts too, you can find it by looking at the HTML code for the form.) Follow it through the relevant PHP files and see what vBulletin is doing to it. Most likely the following files will be appropriate: newreply.php newthread.php functions_newpost.php |
#7
|
|||
|
|||
![]() Quote:
(thanks for your help so far) |
#8
|
|||
|
|||
![]()
$post is a variable used within a function... you need to clean it and pass it to the function using another hook. It won't look for it, you need to do the same thing vBulletin does to the other variables.
I think instead of my trying to explain it, it would just be easier to look in the PHP file, follow it from where the form has been submitted. |
#9
|
|||
|
|||
![]()
Yeah, I just have to figure out how to pass it. In 3.6.x it was passed automatically.
--------------- Added [DATE]1219366978[/DATE] at [TIME]1219366978[/TIME] --------------- Ok, ok. A cleaning was all that was necessary, and then I was able to access it (just using the method you did above). Sample for those reading this: PHP Code:
Thanks again for the help. |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|