Log in

View Full Version : [Solved] How to allow some users to put threads without waiting moderation


omardealo
05-26-2014, 03:50 PM
Hello ,
i have Some forums require waiting moderation for threads and posts , I want to allow for some users to put threads without "waiting moderation" if them posts more than 5 .
and Does not show them this message "Thank you for posting! Your post will not be visible until a moderator has approved it for posting."


that's my try but not work,

Hook : newthread_form_complete

code :

$moderator_advanced_forums = $vbulletin->options['moderator_advanced_forums'];
$moderator_advanced_forums1 = explode(",", $moderator_advanced_forums);

if($vbulletin->options['moderator_advanced_onoff']
AND $vbulletin->userinfo['posts'] >= $vbulletin->options['moderator_advanced_posts']
AND in_array($threadinfo[forumid], $moderator_advanced_forums1) )
{
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . " thread SET visible = '1' where forumid in (".$moderator_advanced_forums.")
AND postuserid = ".$vbulletin->userinfo['userid']."
");
$vbulletin->db->query_write("DELETE FROM " . TABLE_PREFIX . " moderation WHERE primaryid = ".$vbulletin->threadinfo['threadid']." AND type = 'thread' ");
}


Any suggestions or ideas ?! :rolleyes:

kh99
05-26-2014, 04:34 PM
Try using hook newpost_process and replace your 2 sql queries with this code:
$post['visible'] = 1;

darnoldy
05-26-2014, 04:42 PM
i have Some forums require waiting moderation for threads and posts , I want to allow for some users to put threads without "waiting moderation" if them posts more than 5 .If I understand you correctly...

You have forums that put new posts int moderation. You want members who have already made more than 5 posts to not be put into moderation.

If that is what you want to do, you can do that with user groups permissions and automatic promotions?you don't need a plugin.

omardealo
05-26-2014, 05:00 PM
If I understand you correctly...

You have forums that put new posts int moderation. You want members who have already made more than 5 posts to not be put into moderation.

If that is what you want to do, you can do that with user groups permissions and automatic promotions—you don't need a plugin.

okay , but i don't want put all them in one group ... They are in more than 1 UserGroup

--------------- Added 1401127681 at 1401127681 ---------------

Try using hook newpost_process and replace your 2 sql queries with this code:
$post['visible'] = 1;

okay i change the hook and code , but still not work
note : the thread must be delete from table moderation , Even Do not be a list of wating moderation
$moderator_advanced_forums = explode(",", $vbulletin->options['moderator_advanced_forums']);
if($vbulletin->options['moderator_advanced_onoff']
AND $vbulletin->userinfo['posts'] >= $vbulletin->options['moderator_advanced_posts']
AND in_array($threadinfo[forumid], $moderator_advanced_forums) )
{
$post['visible'] = 1;
}

kh99
05-26-2014, 05:37 PM
okay i change the hook and code , but still not work
note : the thread must be delete from table moderation , Even Do not be a list of wating moderation

If we can get that to work it should never be moderated, so you shouldn't have to remove it from the list.

Try adding this line in addition to what you have:
$dataman->set('visible', 1);

omardealo
05-26-2014, 05:49 PM
If we can get that to work it should never be moderated, so you shouldn't have to remove it from the list.

Try adding this line in addition to what you have:
$dataman->set('visible', 1);

yeah , you are right .. You made me think of it in the same way
and i try it already , but not worked ... i used more of hook
[ newpost_process,newpost_form_complete,newpost_comp lete, elc]

if ($type == 'thread')
{
$dataman->setr('visible', 1);
$dataman->save();
}

--------------- Added 1401130437 at 1401130437 ---------------

wait ... your code maybe working , I'm going to try it well

kh99
05-26-2014, 06:12 PM
The code that sets visible=1 for no moderation is just before hook newpost_process, so I think that is the hook you want to use. The code looks like this:
$dataman->set('visible', 1);
$post['visible'] = 1;


so you probably should set both. Also you should not call $dataman->save() because this is called later, and some error checking is done first.

omardealo
05-26-2014, 06:39 PM
The code that sets visible=1 for no moderation is just before hook newpost_process, so I think that is the hook you want to use. The code looks like this:
$dataman->set('visible', 1);
$post['visible'] = 1;


so you probably should set both. Also you should not call $dataman->save() because this is called later, and some error checking is done first.

thnx so much , you are my Hero :up:
your first code i think it working very good
and Thank you for clarifying it .

if($vbulletin->options['moderator_advanced_onoff']
AND $vbulletin->userinfo['posts'] >= $vbulletin->options['moderator_advanced_posts']
AND in_array($foruminfo[forumid], $moderator_advanced_forums1) )
{
$dataman->set('visible', 1);
}