vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=235)
-   -   Miscellaneous Hacks - Cyb - Advanced Permissions Based on Post Count (https://vborg.vbsupport.ru/showthread.php?t=201285)

sailnet 02-20-2012 10:11 PM

tried this to no avail...

PHP Code:

if ($vbulletin->options['apboupc_global_enable'] AND ($vbulletin->options['apboupc_pm_amount']>0) AND (THIS_SCRIPT=='private'))
{
    
$min_days 7;
    
$days_registered floor((TIMENOW $vbulletin->userinfo['joindate']) / 86400);
    if (  (
$vbulletin->options['apboupc_pm_amount'] !='0') AND ($vbulletin->options['apboupc_pm_amount'] > $vbulletin->userinfo[posts]) AND  (!is_member_of($vbulletin->userinfosplit(','$vbulletin->options['apboupc_pm_excludedgroups'])))       )  
    ||  (
$days_registered <= $min_days
    {
        
$apboupc_pmsnote construct_phrase($vbphrase['apboupc_pm_note'], $vbulletin->options['apboupc_pm_amount']);
        
$vbulletin->templatecache['pm_newpm'] = str_replace('$vbphrase[separate_multiple_names]''$vbphrase[separate_multiple_names]<br /><br />$apboupc_pmsnote'$vbulletin->templatecache['pm_newpm']);
    }



kh99 02-20-2012 11:38 PM

That looks like maybe it would work but I think you have a paren problem. I think that one by itself under the word "split" should go down one line so that $min_days has two after it.

Edit: except one other thing...if you were to set $vbulletin->options['apboupc_pm_amount'] option to 0 it wouldn't kick in even if they days registered was too low.

sailnet 02-21-2012 12:03 AM

thanks - but I don't think so....unless I'm really missing something here:

here's the standard code - I did not change the original condition in the if statement with the ANDS, I just spread it out to make it more readable.

PHP Code:

        if ($vbulletin->options['apboupc_global_enable'] AND ($vbulletin->options['apboupc_pm_amount']>0) AND (THIS_SCRIPT=='private'))
        {
            if ((
$vbulletin->options['apboupc_pm_amount'] !='0') AND ($vbulletin->options['apboupc_pm_amount'] > $vbulletin->userinfo[posts]) AND (!is_member_of($vbulletin->userinfosplit(','$vbulletin->options['apboupc_pm_excludedgroups']))))
            {
                
$apboupc_pmsnote construct_phrase($vbphrase['apboupc_pm_note'], $vbulletin->options['apboupc_pm_amount']);
                
$vbulletin->templatecache['pm_newpm'] = str_replace('$vbphrase[separate_multiple_names]''$vbphrase[separate_multiple_names]<br /><br />$apboupc_pmsnote'$vbulletin->templatecache['pm_newpm']);
            }
        } 

and here's my modded code:

PHP Code:

if ($vbulletin->options['apboupc_global_enable'] AND ($vbulletin->options['apboupc_pm_amount']>0) AND (THIS_SCRIPT=='private'))
{
    
$min_days 7;
    
$days_registered floor((TIMENOW $vbulletin->userinfo['joindate']) / 86400);
    if (  (
$vbulletin->options['apboupc_pm_amount'] !='0') AND 
          (
$vbulletin->options['apboupc_pm_amount'] > $vbulletin->userinfo[posts]) AND  
          (!
is_member_of($vbulletin->userinfosplit(','$vbulletin->options['apboupc_pm_excludedgroups']))) 
       )  
    or (
$days_registered <= $min_days
    {
        
$apboupc_pmsnote construct_phrase($vbphrase['apboupc_pm_note'], $vbulletin->options['apboupc_pm_amount']);
        
$vbulletin->templatecache['pm_newpm'] = str_replace('$vbphrase[separate_multiple_names]''$vbphrase[separate_multiple_names]<br /><br />$apboupc_pmsnote'$vbulletin->templatecache['pm_newpm']);
    }



you wrote: Edit: except one other thing...if you were to set $vbulletin->options['apboupc_pm_amount'] option to 0 it wouldn't kick in even if they days registered was too low.

you are correct - I have it set to 15 and I'm the only person who touches the admin panel so this is not a concern of mine.

ps: thank you for you help thus far - it is much appreciated.

kh99 02-21-2012 12:08 AM

Well, it's obvious something's wrong with the parens just from looking at these lines:

Code:

    or ($days_registered <= $min_days)
    {


For it to be correct, the closing paren for the very first opening one after 'if' has to be the last thing before the '{', and you can see that it's not.

sailnet 02-21-2012 12:22 AM

thanks for the fast reply. I fail to see what I'm missing for instance:

PHP Code:

if (  (b) and (d) and (f) )  // condition 1
or 
  (
h)  // condition 2
{
   do 
something;   // get's executed if condition 1 is true or condition 2 is true


this is how I read the above code.

kh99 02-21-2012 12:35 AM

Quote:

Originally Posted by sailnet (Post 2301758)
thanks for the fast reply. I fail to see what I'm missing for instance:

PHP Code:

if (  (b) and (d) and (f) )  // condition 1
or 
  (
h)  // condition 2
{
   do 
something;   // get's executed if condition 1 is true or condition 2 is true


this is how I read the above code.


That's not correct syntax. An if statement has to be

Code:

if (expr)
    statement


so all parts of the expression have to be inside the outer set of parentheses. What you have is

Code:

if (expr) or (expr)
    statement


sailnet 02-21-2012 12:14 PM

kh99 - thank you for all your help. trying to insert the code into the mod was taking too long so I just added a few lines to code to private.php - not my first choice of how to do things but it works for now and perhaps 4.0 has a mod I can use when I upgrade soon.

brandon515 07-20-2012 07:29 PM

This mod is awesome...thanks for you work on this!

Quick question: Can I use this mod in conjunction with VB paid subscriptions? I only allow new threads to be created if a user has X number of posts (this mod works great for that). But if a member chooses to do so, they can pay to be bumped up to a usergroup that is allowed to create new threads.

Just I guess I'm really asking which of the two overrides the other....usergroups vs. Cyb-Advanced Perms

Thx
Brandon

chefy 08-22-2012 04:29 PM

I have identified 2 bugs on this product. Hope Valter or any other programmer could share with us the patch instructions:

[BUG 1] If you have enabled the restriction "Post Links/Images/emails" with a minimum post count of X (we'll use X=5 in this example) then a member with less than 5 posts is in fact unable to post any link. But what happens when he wants to report a post? The system will allow him to send the report, however it will not get posted on the moderators forum. Guess why? Yes, because the reports contain links in their body and since this member has lees than 5 posts the system will prevent his report from being posted. Instead of posting the report on the predefined forum it is being sent to all the moderators through email which isn't the expected behavior.

[BUG 2] If you have enabled the restriction "Post Links/Images/emails" with a minimum post count of X (we'll use X=5 in this example) then a member with less than 5 posts is in fact unable to post any image. But what happens if our smart member makes use of "https" in their image link instead of "http"? Something like this: https://vborg.vbsupport.ru/. Answer is easy: the image will get posted bypassing the restriction of the 5 minimum posts to post images.

Unfortunately 4.4 is the latest vB 3.x version of this mod. The current version is 5.2.1 but only available for vB 4.x series. I don't know if version 5.2.1 still have these bugs but maybe the programmer want to check.

Please fix these bugs and share with us the patch instructions.

chefy 08-27-2012 03:53 PM

Valter or any other programmer could fix those bugs please?


All times are GMT. The time now is 04:04 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.01333 seconds
  • Memory Usage 1,785KB
  • 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
  • (3)bbcode_code_printable
  • (5)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete