Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-14-2013, 02:50 PM
juzz86 juzz86 is offline
 
Join Date: May 2013
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Moderate only OP (newthread) by Usergroup - Possible?

Hello Folks,

I am attempting to introduce a hook in functions_newpost.php on a vB 4.2.1 forum to allow us to moderate a particular usergroup's threads, not posts, for a subset of forums.

I found an old post for some vB 3.8 code by another user here that seems a good fit, however I think the parameters to point vB to check the usergroup ($vbulletin->userinfo) may be incorrect for vB 4.x:

Code:
else
{
$dataman->set('visible', 1);
$post['visible'] = 1;
}

and add below that:

if ($type == 'thread')
{
if ($foruminfo['forumid'] == X AND is_member_of($vbulletin->userinfo, 
Y))
{
$dataman->set('visible', 1);
$post['visible'] = 1;
}
}

The 'visible' and 'thread' params check out, is anyone able to help me with finding the vB 4.x equivalent of $vbulletin->userinfo please? I would much rather try and have a crack at getting this going than introduce a sitewide thread moderation policy on our sale forums.

Thanks in advance!

Justin
Reply With Quote
  #2  
Old 08-14-2013, 05:34 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What hook location are you using? That is what will determine the variable you use.
Reply With Quote
Благодарность от:
juzz86
  #3  
Old 08-14-2013, 08:59 PM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by juzz86 View Post
Hello Folks,

I am attempting to introduce a hook in functions_newpost.php on a vB 4.2.1 forum to allow us to moderate a particular usergroup's threads, not posts, for a subset of forums.
I know the section of code you are talking about in 'newpost.php', but I am wondering if this is necessary. Your allowed to select moderators to a forum, you are also allowed to set if a usergroup will follow moderation. You might be able to do this without the hack -- depending how strict your permission system is.

To answer your question:
Code:
is_member_of($vbulletin->userinfo,  Y)
Where Y is equl to a valid usergroup id -- is valid vb code as long as '/includes/functions.php' is loaded and in most cases it already is.

Then you just need to alter the permission in 'newpost.php' listed below.
Code:
        // see if post has to be moderated or if poster in a mod
        if (
            ((
                (
                    ($foruminfo['moderatenewthread'] AND $type == 'thread') OR ($foruminfo['moderatenewpost'] AND $type == 'reply')
                )
                OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['followforummoderation'])
            )
            AND !can_moderate($foruminfo['forumid']))
            OR
            ($type == 'reply' AND (($postinfo['postid'] AND !$postinfo['visible'] AND !empty($postinfo['specifiedpost'])) OR !$threadinfo['visible']))
        )
You might be able to use the hook: 'newpost_process' with some clever programming or just add your own custom hook, if you do not want to alter the code directly.

I could have been more helpfull, but you did not explain how you were going to manipulate the usergroup data into the function 'build_new_post'. Hopefully, I helped with something...
Reply With Quote
Благодарность от:
juzz86
  #4  
Old 08-14-2013, 11:24 PM
juzz86 juzz86 is offline
 
Join Date: May 2013
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thankyou both very much for your time, and my apologies for the lack of detail. This end of vB and php in general is all quite new to me, I've been Moderating for years but the step up to Admin requires more of this kind of stuff, and I must admit I'm just feeling my way through for the most part. I appreciate you guys taking time out to help me thus far - thankyou.

Justin from Australia

Quote:
Originally Posted by Lynne View Post
What hook location are you using? That is what will determine the variable you use.
Hi Lynne, I may have used the incorrect term there sorry! Some further details on the Forum for you to give some background. This should've come last night - my apologies:

I co-Admin a small cell phone sale/trade forum. We have some reasonably hefty restrictions on our new memberships currently - thread creation is completely disabled, until a positive transaction is recorded against their name and we manually promote to Members after this. As we are a small forum and a close-knit staff, we don't oppose the level of manual work to keep our forum as evil-free as feasibly possible.

This has worked well for us so far, however we are in the midst of partnering with a news site to provide us a nice portal (and more users), and would like to relax the thread creation restrictions in aid of encouraging new members a bit more.

Thus, I am hoping to be able to use the little bit of code I found last night to put a 'catch' in the newpost rules, that any thread posted into forumID 41, by usergroup 2, is automagically placed in the moderation queue. The aim is to avoid moderating their negotiation back-and-forth posts, and just moderate all OPs by that usergroup.

Quote:
Originally Posted by tbworld View Post
I know the section of code you are talking about in 'newpost.php', but I am wondering if this is necessary. Your allowed to select moderators to a forum, you are also allowed to set if a usergroup will follow moderation. You might be able to do this without the hack -- depending how strict your permission system is.

To answer your question:

Code:
is_member_of($vbulletin->userinfo,  Y)
Where Y is equl to a valid usergroup id -- is valid vb code as long as '/includes/functions.php' is loaded and in most cases it already is.

Then you just need to alter the permission in 'newpost.php' listed below.

Code:
        // see if post has to be moderated or if poster in a mod
        if (
            ((
                (
                    ($foruminfo['moderatenewthread'] AND $type == 'thread') OR ($foruminfo['moderatenewpost'] AND $type == 'reply')
                )
                OR !($forumperms & $vbulletin->bf_ugp_forumpermissions['followforummoderation'])
            )
            AND !can_moderate($foruminfo['forumid']))
            OR
            ($type == 'reply' AND (($postinfo['postid'] AND !$postinfo['visible'] AND !empty($postinfo['specifiedpost'])) OR !$threadinfo['visible']))
        )
You might be able to use the hook: 'newpost_process' with some clever programming or just add your own custom hook, if you do not want to alter the code directly.

I could have been more helpfull, but you did not explain how you were going to manipulate the usergroup data into the function 'build_new_post'. Hopefully, I helped with something...
This has been very helpful tbworld, thankyou. As I mentioned above this is very new to me, and I'm still learning how everything ties in together in the backend. Ideally all posts, except those from usergroup 2, would avoid moderation. This is done easily enough, however as there is no real way to moderate threads only per-usergroup, I was hoping to make something similar to this (very crude, sorry):

Code:
if usergroup == Junior AND == newthread AND forumid == 41 THEN visible == 0
We're just hoping to avoid two things:

1) Moderating all new threads for forumid 41 (easily achieveable but detrimental to our established userbase)

2) Moderating every single post for usergroup 2 in forumid 41.

I hope this clarifies a little. Again, sorry for my lack of understanding

Justin
Reply With Quote
  #5  
Old 08-28-2013, 11:19 PM
juzz86 juzz86 is offline
 
Join Date: May 2013
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I would like to re-submit this in hopes someone out there may be able to provide a bit more detail on whether this is even possible.

I have added the relevant code above into forum_newpost.php, in the correct syntax and location. I am unsure what else needs to be done to get this to work, and would love any other advice or opinions.

To refresh, we are hoping to send new threads (OPs) made by Junior Members in forum 41 to the moderation queue automatically, while letting their posts in other threads in the same forum filter through.

I know I need to be looking at the 'newpost' side of things, I just can't work out what else is needed other than the code above to get this working for us. Moderating every post isn't practical unfortunately.

Thankyou.

Justin
Reply With Quote
  #6  
Old 08-29-2013, 06:55 AM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi @juzz86, I will try to take a quick look at this after work. Just saw your message, but my brain is already mush. Unfortunately, the permission sequence in 'newpost' has to be analyzed, and states charted before any additional conditionals are added. Since your just talking about moderation in a particular forum, this should be doable without any real headaches.

What is an 'OPs' ?
Reply With Quote
  #7  
Old 08-29-2013, 07:08 AM
juzz86 juzz86 is offline
 
Join Date: May 2013
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by tbworld View Post
Hi @juzz86, I will try to take a quick look at this after work. Just saw your message, but my brain is already mush. Unfortunately, the permission sequence in 'newpost' has to be analyzed, and states charted before any additional conditionals are added. Since your just talking about moderation in a particular forum, this should be doable without any real headaches.

What is an 'OPs' ?
You're a bit of a godsend my friend, I want you to know that

I don't want this to be a massive hassle, so if it turns out to be a mammoth job we will just work around it as best we can.

Plural of Original Post
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:39 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05965 seconds
  • Memory Usage 2,240KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (6)bbcode_code
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (2)post_thanks_box_bit
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete