View Full Version : Make moderated posts go into private forum instead of queue?
joeschmoe
10-31-2002, 07:37 PM
Hi guys,
I'm hoping someone can help me out.
I am in the process of changing and tweaking vB to be more like the customer support databse similar to RightNow type software. See this link (http://ask.adaptec.com/cgi-bin/adaptec_tic.cfg/php/enduser/std_alp.php?p_sid=Bdm-x7tg&p_lva=&p_sp=&p_li=) for an example of what I'm talking about. Does anyone have a hack similar to this yet?
Here is what I haven't been able to figure out yet:
1) I'd like to have all the new threads by registered users moderated, and have the threads go into a private forum, instead of the moderation queue, which is pretty bulky to deal with (I am expecting over 100 threads/day).
1a) If #1 can't be done, how can I set the default "validate" value to "no" in the post moderation queue page?
2) When a registered user is submitting a post, I'd like the "new thread" button to take them to an HTML page with rules, and at the bottom of that page a link will take them to the new thread posting page. I'm told this takes a php hack, but how do I do this?
Thanks in advance for any help!
Logician
11-01-2002, 11:38 AM
edit newthread.php find:
$DB_site->query("INSERT INTO thread
Before that add:
if ($foruminfo['moderatenew']!=0) {$oldforumid=$forumid;$forumid=X;}
And before:
// update forum stuff
add:
if ($foruminfo['moderatenew']!=0) {$forumid=$oldforumid;}
Replace X with your private forum id..
As for your second request: what about editing newthread template and put your notices at the top? That requires no hacking and IMO quite effective..
If you want this notice displayed to certain people or in certain forums you can apply "advanced templates hack" first (it's in my profile), edit your newthread template and put a conditional at the top like:
[[($forumid==X and $bbuserinfo[usergroupid]==Y)]]
Your notices go here..
[[/($forumid==X and $bbuserinfo[usergroupid]==Y)]]
For instance this conditional will display your notices in only forum X and if viewer is from usergroup Y. (FYI. for registered users usergroup id =2)
Enjoy..
Erwin
11-02-2002, 12:45 AM
Logician is a legend. :) If he released all his request answers as hacks, he'll have hundreds of hacks to his name.
Logician
11-02-2002, 07:09 AM
Originally posted by Erwin
If he released all his request answers as hacks, he'll have hundreds of hacks to his name.
oh what a nightmare.. Think about the time you'll commit for the support of 200 hacks you have lol..
btw. tyvm for the flattering comments.. :)
joeschmoe
11-05-2002, 02:10 PM
Thanks a bunch! Those will work great. :D
joeschmoe
11-18-2002, 03:27 PM
Logician, I'm hoping you can help out once again.
Your hack suggestion works great, however is there a way to make the the user threads submitted into each forum go into a subforum of the forum it was submitted in, until it's validated by an admin?
The hack you offered makes the threads go into a single forum and it is hard to sort the threads into the proper forum, because we have so many forums.
I hope I'm not being nitpicky or confusing, thanks again!
Logician
11-18-2002, 10:27 PM
yes it is possible:
Replace
if ($foruminfo['moderatenew']!=0) {$oldforumid=$forumid;$forumid=X;}
AS:
if ($foruminfo['moderatenew']!=0)
{
$oldforumid=$forumid;
if ($forumid==X1) {$forumid=X2;}
elseif ($forumid==Y1) {$forumid=Y2;}
elseif ($forumid==Z1) {$forumid=Z2;}
else {$forumid=W2;}
}
So as you see you have to enter all main forumids (X1,Y1,Z1) and their sub forumids (Z2,Y2,X2) in that code one by one. Make sure you dont forget any!
Enjoy. ;)
joeschmoe
11-19-2002, 04:29 PM
thankyouthankyouthankyou!
:)
joeschmoe
11-20-2002, 07:53 PM
I hate to ask another question, but I did a search in newthread.php and did not find this line: if ($foruminfo['moderatenew']!=0) {$oldforumid=$forumid;$forumid=X;}
Am I supposed to be looking in newthread.php or a different file?
Logician
11-20-2002, 08:00 PM
it's our previous hack code. So you are supposed to look into this thread. :)
joeschmoe
11-20-2002, 08:32 PM
Ah - okay, I was looking in an original copy of the file. :) Forgive me, I'm new to this editing of the core files of the program.
On the replacement of the "X1", "X2", etc. with the forum ID numbers, I will eventually have about 35-50 forums. I am assuming I just continue the elseif ($forumid==Z1) {$forumid=Z2;} line for as many forums as I have, right?
And also, what do I replace the "W2" in this line with:
else {$forumid=W2;} ? Does the "W2" equal the main category/forum?
This is the format I am planning on:
-Main Category
--Forum 1
---Sub-Forum 1.1
----Sub-Forum 1.1 submitted questions
---Sub-Forum 1.2
----Sub-Forum 1.2 submitted questions
---Sub-Forum 1.3
----Sub-Forum 1.3 submitted questions
---etcetera, and so on
--Forum 2
---etcetera, and so on
-Second Category
--Forum 1b
---Sub-Forum 1b.1
----Sub-Forum 1b.1 submitted questions
---etcetera, and so on
You get the idea :) it will be a big forum with many sub-forums. So by my second question I mean in that "else" statement, does the "W2" variable just get replaced with the forum ID of the Main category the forums are in? Because there are two categories...I just don't want to flub this up. For a non-programmer, there's nothing worse than loading up the page and a jumble of code or error message popping up! :)
Thanks again for the help!
Logician
11-20-2002, 10:05 PM
Originally posted by joeschmoe
On the replacement of the "X1", "X2", etc. with the forum ID numbers, I will eventually have about 35-50 forums. I am assuming I just continue the elseif ($forumid==Z1) {$forumid=Z2;} line for as many forums as I have, right?
yep just continue like that..
And also, what do I replace the "W2" in this line with:
else {$forumid=W2;} ? Does the "W2" equal the main category/forum?
If you did everything correct, this line will never needed nor run. It's just your insurance. If you edited some forumid's wrong, this line will save thread to forum W2 so there will not be any weird issues or orphaned threads in your db. even if you didnt apply the hack correctly.
So in other words just use any forumid there. Eg. An admin only forum will be a good start.
joeschmoe
11-20-2002, 10:37 PM
Cool - so I've added the lines of code, created two of the "submitted question subforums", edited the "X1", "X2", etc.
Hopefully this is my last question: In this line of code: if ($foruminfo['moderatenew']!=0) {$oldforumid=$forumid;$forumid=X;} what is "X"?
-----
Also, do I just copy and paste these in, or do I follow the format of the if-then-else statements (two spaces indentation, etc.) elsewhere in the file?
Before uploading this new file I want to make sure it's all okay. :)
Logician
11-20-2002, 10:50 PM
Originally posted by joeschmoe
Hopefully this is my last question: In this line of code: if ($foruminfo['moderatenew']!=0) {$oldforumid=$forumid;$forumid=X;} what is "X"?
I guess you mean "what WAS X"? Because we don't use this line anymore. You are supposed to replace this line with the new code I provided.
You'd better post here what you applied to your script and let's see if it's correct.
joeschmoe
11-20-2002, 11:07 PM
Okay, here goes:
if ($foruminfo['moderatenew']!=0) {$oldforumid=$forumid;$forumid=X;}
$DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,p ostusername,postuserid,lastposter,dateline,iconid, visible,attach) VALUES (NULL,'".addslashes(htmlspecialchars($subject))."','".time()."','$forumid','1','0','".addslashes($postusername)."','$bbuserinfo[userid]','".addslashes($postusername)."','".time()."','$iconid','$visible','$attachcount')");
$threadid=$DB_site->insert_id();
// subscribe to thread
if ($email and $bbuserinfo['userid']!=0) {
if (!$checkid=$DB_site->query_first("SELECT subscribethreadid FROM subscribethread WHERE userid=$bbuserinfo[userid] AND threadid=$threadid")) {
$DB_site->query("INSERT INTO subscribethread (subscribethreadid,userid,threadid) VALUES (NULL,$bbuserinfo[userid],$threadid)");
}
}
/*if ($bbuserinfo[userid]==0) {
$postusername=$bbuserinfo[username];
} else {
$postusername="";
}*/
// create first post
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,at tachmentid,pagetext,allowsmilie,showsignature,ipad dress,iconid,visible) VALUES (NULL,'$threadid','".addslashes(htmlspecialchars($subject))."','".addslashes($postusername)."','$bbuserinfo[userid]','".time()."','$attachmentid','".addslashes($message)."','$allowsmilie','$signature','$ipaddress','$iconi d','1')");
$postid=$DB_site->insert_id();
indexpost($postid,1);
if ($foruminfo['moderatenew']!=0) {
$oldforumid=$forumid;
// ***************** start of moderation forum queue hack
if ($forumid==48) {$forumid=53;} // Nitro TC - chassis & handling
elseif ($forumid==49) {$forumid=54;} // Nitro TC - engines & speed
elseif ($forumid==Z1) {$forumid=Z2;}
elseif ($forumid==Y1) {$forumid=Y2;}
elseif ($forumid==Z1) {$forumid=Z2;}
else {$forumid=55;} // this is the error forum - if posts do not go into the right forum they will go into this forum
}
// update forum stuff
The line with the variable "X" in it was from your first reply, I thought I was supposed to use that line still.
joeschmoe
11-20-2002, 11:10 PM
<I'm not sure what's happening, I've tried replying a couple of times and my posts keep coming up in the wrong order...I think the moderators changed the time on the server, which is throwing off the posting queue>
Yah, okay, I forgot to change the Z1, Z2, etc., variables, I should have commented those out before pasting them in my post. :)
I've been trying to follow the directions but it's a little hard for me I guess since I'm not familiar with the coding - is this right, then? // ***************** start of moderation forum queue hack
if ($foruminfo['moderatenew']!=0)
{
$oldforumid=$forumid;
if ($forumid==48) {$forumid=53;} // Nitro TC - chassis & handling
elseif ($forumid==49) {$forumid=54;} // Nitro TC - engines & speed
//elseif ($forumid==Z1) {$forumid=Z2;}
//elseif ($forumid==Y1) {$forumid=Y2;}
//elseif ($forumid==Z1) {$forumid=Z2;}
else {$forumid=55;} // this is the error forum - if posts do not go into the right forum they will go into this forum
}
$DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,p ostusername,postuserid,lastposter,dateline,iconid, visible,attach) VALUES (NULL,'".addslashes(htmlspecialchars($subject))."','".time()."','$forumid','1','0','".addslashes($postusername)."','$bbuserinfo[userid]','".addslashes($postusername)."','".time()."','$iconid','$visible','$attachcount')");
$threadid=$DB_site->insert_id();
// subscribe to thread
if ($email and $bbuserinfo['userid']!=0) {
if (!$checkid=$DB_site->query_first("SELECT subscribethreadid FROM subscribethread WHERE userid=$bbuserinfo[userid] AND threadid=$threadid")) {
$DB_site->query("INSERT INTO subscribethread (subscribethreadid,userid,threadid) VALUES (NULL,$bbuserinfo[userid],$threadid)");
}
}
/*if ($bbuserinfo[userid]==0) {
$postusername=$bbuserinfo[username];
} else {
$postusername="";
}*/
// create first post
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,at tachmentid,pagetext,allowsmilie,showsignature,ipad dress,iconid,visible) VALUES (NULL,'$threadid','".addslashes(htmlspecialchars($subject))."','".addslashes($postusername)."','$bbuserinfo[userid]','".time()."','$attachmentid','".addslashes($message)."','$allowsmilie','$signature','$ipaddress','$iconi d','1')");
$postid=$DB_site->insert_id();
indexpost($postid,1);
if ($foruminfo['moderatenew']!=0) {$forumid=$oldforumid;}
// update forum stuff
Logician
11-20-2002, 11:19 PM
no your code is wrong. Please read the instructions carefully. You are supposed to replace the line:
if ($foruminfo['moderatenew']!=0) {$oldforumid=$forumid;$forumid=X;}
with the new code.
Also u should NOT touch that part:
if ($foruminfo['moderatenew']!=0) {$forumid=$oldforumid;}
Besides you have to enter all ids one by one, it seems that you forget to edit z1, y1, z2 y2 parts in :
if ($forumid==48) {$forumid=53;} // Nitro TC - chassis & handling
elseif ($forumid==49) {$forumid=54;} // Nitro TC - engines & speed
elseif ($forumid==Z1) {$forumid=Z2;}
elseif ($forumid==Y1) {$forumid=Y2;}
elseif ($forumid==Z1) {$forumid=Z2;}
Logician
11-21-2002, 08:15 AM
This code should work:
// ***************** start of moderation forum queue hack
if ($foruminfo['moderatenew']!=0)
{
$oldforumid=$forumid;
if ($forumid==48) {$forumid=53;} // Nitro TC - chassis & handling
elseif ($forumid==49) {$forumid=54;} // Nitro TC - engines & speed
//elseif ($forumid==Z1) {$forumid=Z2;}
//elseif ($forumid==Y1) {$forumid=Y2;}
//elseif ($forumid==Z1) {$forumid=Z2;}
else {$forumid=55;} // this is the error forum - if posts do not go into the right forum they will go into this forum
}
$DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,p ostusername,postuserid,lastposter,dateline,iconid, visible,attach) VALUES (NULL,'".addslashes(htmlspecialchars($subject))."','".time()."','$forumid','1','0','".addslashes($postusername)."','$bbuserinfo[userid]','".addslashes($postusername)."','".time()."','$iconid','$visible','$attachcount')");
$threadid=$DB_site->insert_id();
// subscribe to thread
if ($email and $bbuserinfo['userid']!=0) {
if (!$checkid=$DB_site->query_first("SELECT subscribethreadid FROM subscribethread WHERE userid=$bbuserinfo[userid] AND threadid=$threadid")) {
$DB_site->query("INSERT INTO subscribethread (subscribethreadid,userid,threadid) VALUES (NULL,$bbuserinfo[userid],$threadid)");
}
}
/*if ($bbuserinfo[userid]==0) {
$postusername=$bbuserinfo[username];
} else {
$postusername="";
}*/
// create first post
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,at tachmentid,pagetext,allowsmilie,showsignature,ipad dress,iconid,visible) VALUES (NULL,'$threadid','".addslashes(htmlspecialchars($subject))."','".addslashes($postusername)."','$bbuserinfo[userid]','".time()."','$attachmentid','".addslashes($message)."','$allowsmilie','$signature','$ipaddress','$iconi d','1')");
$postid=$DB_site->insert_id();
indexpost($postid,1);
if ($foruminfo['moderatenew']!=0) {$forumid=$oldforumid;}
// update forum stuff
joeschmoe
11-22-2002, 02:03 PM
Thanks Logician,
I copied and pasted your code above in my newthread.php using Notepad (to keep the formatting correct, Wordpad messed it up), then tried posting as a guest in my forum and got "Parse error: parse error on line 449"
I've attached the newthread.php file, could you look at it and see what may be messed up? I'm pretty sure I pasted it in correctly.
<file deleted per post below>
Logician
11-22-2002, 04:32 PM
This is because you inserted the hack code into the wrong section in the first place. Now follow me and please proceed carefully:
1- Revert back to your original newthread.php
2- find:
if ($postpoll) {
$visible = 0;
}
3- Delete the section starting from there until :
// update forum stuff
4- Now insert this code into the part you deleted
(Btw. please remove your file from the post above. Site rules do not allow posting of entire vb files here.)
joeschmoe
11-22-2002, 07:05 PM
Okay, it allows the post to go through now, but the post goes into the main forum, not the moderated subforum.
Thanks for your patience and help!!
Logician
11-22-2002, 08:05 PM
Originally posted by joeschmoe
Okay, it allows the post to go through now, but the post goes into the main forum, not the moderated subforum.
Thanks for your patience and help!!
According to your code, forum 48 and 49 should be set as moderated and new threads posted in these 2 forums will appear in forums 53 and 54.. I can not know which forums you set as moderated or which ones are subs or main..
joeschmoe
11-22-2002, 08:15 PM
Got it! Works like a charm! :) Finally, thank you!
One last thing though: the reason I wanted to use a forum/subforum system instead of the moderation queue was to avoid having to get multiple moderators to go into the queue (and we'd be getting over 100 new threads each day); how can I modify the code to have the subforum act as the moderation queue for each forum?
Logician
11-22-2002, 08:48 PM
Originally posted by joeschmoe
how can I modify the code to have the subforum act as the moderation queue for each forum?
it seems to me that the hack works like this at the moment. What difference are u asking for?
joeschmoe
11-22-2002, 09:28 PM
I'm sorry, I wasn't being vague on purpose :)
I meant that I want to forego the moderation queue entirely and use the hack to have the subforum of each forum act as the queue.
Ideally, any posts in a forum would automatically go into the private subforum without the moderators having to go through the moderation queue in the Admin CP. So I just want to skip the moderation queue altogether.
Don't get me wrong, I LOVE the hack, your help and patience, however the way it works at the moment isn't exactly as I'd like it to be. I hope I'm not being too much trouble.
Logician
11-22-2002, 10:20 PM
So if u replace the hack code:
$oldforumid=$forumid;
as:
$oldforumid=$forumid;$visible=1;
and replace:
if ($foruminfo['moderatenew']!=0) {$forumid=$oldforumid;}
as:
if ($foruminfo['moderatenew']!=0) {$forumid=$oldforumid;$visible=0;}
Then make your sub-forums private, the posts should apprear in sub forums as normal posts, instead of going into moderation queue. Then all you have to do is to move the thread to the main forums if you approve them. This would save you going into the Mod. CP.
However I'm not sure what might be the consequences of this change. There may be subtle clashing issues like thread subscription etc. You better check it in a test board for a while to see if it will work.
And even if it works ok, please remember that a moved thread will lose thread subscribers (this is not related to the hack, it's default vb behaviour) so when you use this structure, your moderated threads will not save thread poster's subscription when it's approved.
Hope this helps.. :glasses:
joeschmoe
11-22-2002, 10:44 PM
Excellent, works like a charm! :D Thanks so much for everything! "I'm not worthy!" haha
Thread subscription may not be an issue with what we're planning for the forum (we'll have to see), but I am noticing that the "last post" column doesn't seem to update for some of the forums, on some of the pages. Could this be one of the consequences you mentioned?
Logician
11-23-2002, 09:22 AM
yep it is :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.