vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   [Solved] How to allow some users to put threads without waiting moderation (https://vborg.vbsupport.ru/showthread.php?t=311676)

omardealo 05-26-2014 03:50 PM

[Solved] How to allow some users to put threads without waiting moderation
 
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 :

PHP 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:
Code:

$post['visible'] = 1;

darnoldy 05-26-2014 04:42 PM

Quote:

Originally Posted by omardealo (Post 2499494)
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

Quote:

Originally Posted by darnoldy (Post 2499506)
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 [DATE]1401127681[/DATE] at [TIME]1401127681[/TIME] ---------------

Quote:

Originally Posted by kh99 (Post 2499504)
Try using hook newpost_process and replace your 2 sql queries with this code:
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
PHP Code:

$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

Quote:

Originally Posted by omardealo (Post 2499509)
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:
Code:

$dataman->set('visible', 1);

omardealo 05-26-2014 05:49 PM

Quote:

Originally Posted by kh99 (Post 2499511)
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:
Code:

$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]

PHP Code:

if ($type == 'thread'

$dataman->setr('visible'1);
$dataman->save();


--------------- Added [DATE]1401130437[/DATE] at [TIME]1401130437[/TIME] ---------------

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:
PHP Code:

$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

Quote:

Originally Posted by kh99 (Post 2499519)
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:
PHP Code:

$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 .

PHP Code:

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); 




All times are GMT. The time now is 10:26 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01276 seconds
  • Memory Usage 1,762KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (6)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete