The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Way to force "I agree" checkbox before posting in specific forums?
Hello,
We are having issues with user compliance with rules of "forgetting" them. I would like to force a checkbox for our marketplace section where users have to agree they are an interested party only. I want this ONLY in the marketplace forum, and I want it persistent against all posts in the section. Is there a plugin/hack out there which could cleanly fit my needs on a 3.8 install? |
#2
|
|||
|
|||
I'm not sure what you mean by "persistent against all posts" - do you mean you just want them to answer once, or each time they post?
If it's the first one I don't know, maybe there's a mod out there. If it's the second one, you could create a plugin using hook newpost_process and something like this code: Code:
if (in_array($foruminfo['forumid'], array(1, 2, 3))) { $vbulletin->input->clean_gpc('p', 'accept_rules', TYPE_BOOL); if (!$vbulletin->GPC['accept_rules']) { $errors[] = "You must accept the rules before posting"; } } then in the appropriate templets (showthread, newreply, and newthread I think), add something like this: Code:
<if condition="in_array($foruminfo['forumid'], array(1, 2, 3))"> <tr> <td><input type="checkbox" class="bginput" name="accept_rules" value="true"/> I accept the forum rules</td> </tr> </if> (You don't have to make it a table row of course.) You also want to change the 1, 2, 3 in each case to the forum number or numbers you want this to apply to. You could also make a javascript popup to check before it's submitted if you like that idea better. |
#3
|
||||
|
||||
Would this work on vB4?
|
#4
|
|||
|
|||
I think it should, but you'd have to update the "if" tags in the template like this:
Code:
<vb:if condition="in_array($foruminfo['forumid'], array(1, 2, 3))"> <tr> <td><input type="checkbox" class="bginput" name="accept_rules" value="true"/> I accept the forum rules</td> </tr> </vb:if> |
Благодарность от: | ||
RedTurtle |
#5
|
|||
|
|||
kh99,
We have a forum that has cursing in it and can have serious conversations.. How can I use your plugin to make it so when they click on the forum, it gives them the same checkbox, and if they press I agree, it shows them the forum and all of the threads/posts and what not. Kind of like how if you go to a certain website, it may say "Content not suitable for children".. well, I want it to be kind of like a warning "This area of the forum has language that may not be suitable for children and serious conversations. Leave now and go back to the main forum if not interested. Agree if you'd like to proceed into the forum." something like that. Thank you! |
#6
|
|||
|
|||
That's more complicated. It's fairly easy to do for posting because there's already a mechanism for checking for errors and going to the "go advanced" page if there are any, and it's a one-time thing. To do what you want you'd have to create your own way to decide if the user had accepted or not (because you don't want them to have to click for every page). You should spend some time searching for something like this if you haven't already. If you want to create it, you might look at how forum passwords work because it's a similar idea. Or maybe you can figure out a way to use the forum password mechanism, like make the password "agree" then change the forum password message to say "if you accept enter 'agree'".
|
#7
|
||||
|
||||
Quote:
I have created and enabled the plugin as you suggested above and am now putting the following in my SHOWTHREAD template, right above the code for the signature checkbox: Code:
<vb:if condition="in_array($foruminfo['forumid'], array(3, 4, 17, 24))"> <tr> <td><input type="checkbox" class="bginput" name="accept_rules" value="true"/>I agree to follow the rules.</td> </tr> </vb:if> Any idea what I could be doing wrong? Thank you! |
#8
|
|||
|
|||
You're using vb4, right? (Edit: of course, you just mentioned it above). Try this instead (change foruminfo to threadinfo):
Code:
<vb:if condition="in_array($threadinfo['forumid'], array(3, 4, 17, 24))"> <tr> <td><input type="checkbox" class="bginput" name="accept_rules" value="true"/>I agree to follow the rules.</td> </tr> </vb:if> |
#9
|
||||
|
||||
Hi Kh99,
So I am having an issue with the plugin. I'm using the following code: Code:
if ($GLOBALS['forumid'] != 99 AND is_member_of($bbuserinfo, 5,6,7)) { $vbulletin->input->clean_gpc('p', 'accept_rules', TYPE_BOOL); if (!$vbulletin->GPC['accept_rules']) { $errors[] = "<span style='color: #ba0000; background-color: #FDFD65;'>Please scroll down and accept the highlighted rules before submitting your post.</span>"; } } Now if I use is_member_of($bbuserinfo, 5,6,7) it doesn't seem to work. If I put an exclamation in front of it then it works...but I'm not sure why... EDIT: So here's the following things I've tried, as an admin: if ($GLOBALS['forumid'] !=99 AND is_member_of($bbuserinfo, 5,6,7)) <== Doesn't work (lets me post) if ($GLOBALS['forumid'] !=99 AND is_member_of($bbuserinfo, 2,3,4)) <== Works (lets me post) if ($GLOBALS['forumid'] !=99 AND !is_member_of($bbuserinfo, 5,6,7)) <=== Doesn't let me as an admin post (so it works, but not sure why it needs an ! in front of is_member_of) |
#10
|
|||
|
|||
You can only use $bbuserinfo in a template condition. If you want to check in a plugin, use $vbulletin->userinfo. Also, if you want it to work for all forums you can just take out the forum check (unless you're leaving it there for future use or something). So try:
Code:
if (is_member_of($vbulletin->userinfo, 5,6,7)) { I guess in the other thread I assumed when you asked for a conditional you meant a template condition. BTW, ! just means "not", so it was working only because the check was always failing (so !is_member_of was always true), but I think you would have found that it was true for all members. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|