vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Beta Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=34)
-   -   Forum Activity Check For Forum Access (Per Forum) (https://vborg.vbsupport.ru/showthread.php?t=76963)

sabret00the 02-23-2005 10:00 PM

Forum Activity Check For Forum Access (Per Forum)
 
FAQ
i wrote it but when i tried to bullet it, it went all pear shaped, in short, no more questions :p

thanks to Dean for the assistance :)


in "/forums/forumdisplay.php" find
PHP Code:

// check if there is a forum password and if so, ensure the user has it set
verify_forum_password($foruminfo['forumid'], $foruminfo['password']); 

and addove it add
PHP Code:

    $facffa_checkforums explode(","$vboptions['facffa_checkforums']);
    
$facffa_excludeusergroups explode(","$vboptions['facffa_excludeusergroups']);
    if ((
$vboptions['facffa_checkforumactivity'] AND in_array($foruminfo['forumid'], $facffa_checkforums) AND !in_array($bbuserinfo['usergroupid'], $faffa_excludeusergroups)))
    {
        
// forum activity check
        
$definedtime = ($vboptions['facffa_checkforumactivitytime'] * 86400);
        
$limit TIMENOW $definedtime;
        
$recentpostcount $DB_site->query_first("
            SELECT COUNT(*) AS total
            FROM " 
TABLE_PREFIX "post 
            WHERE userid = 
$bbuserinfo[userid] 
            AND dateline >= 
$limit
        "
);

        if (
$recentpostcount['total'] < $vboptions['facffa_checkforumactivityposts'])
        {
            eval(
print_standard_error('facffa_checknotenoughposts'));
        }
    } 

now shoot over to the "/forums/showthread.php" and find
PHP Code:

// *********************************************************************************
// get thread info
$thread verify_id('thread'$threadid11);
$threadinfo = &$thread

and below that add
PHP Code:

    $facffa_checkforums explode(","$vboptions['facffa_checkforums']);
    
$facffa_excludeusergroups explode(","$vboptions['facffa_excludeusergroups']);
    if ((
$vboptions['facffa_checkforumactivity'] AND in_array($threadinfo['forumid'], $facffa_checkforums) AND !in_array($bbuserinfo['usergroupid'], $faffa_excludeusergroups)))
    {
        
// forum activity check
        
$definedtime = ($vboptions['facffa_checkforumactivitytime'] * 86400);
        
$limit TIMENOW $definedtime;
        
$recentpostcount $DB_site->query_first("
            SELECT COUNT(*) AS total
            FROM " 
TABLE_PREFIX "post 
            WHERE userid = 
$bbuserinfo[userid] 
            AND dateline >= 
$limit
        "
);

        if (
$recentpostcount['total'] < $vboptions['facffa_checkforumactivityposts'])
        {
            eval(
print_standard_error('facffa_checknotenoughposts'));
        }
    } 

now you need to add the phrase
Code:

You have not had enough forum activity in order to access this forum, please become more active then check back there-after.
this slots in front end-error messages :)

now what else was there, oh yeah the options
direct your browser to http://www.mydomain.com/forums/admin...hp?do=addgroup
(please don't take that literally)

and then put this in the boxes
Code:

Varname: facffa
Title: Forum Activity Check For Forum Access (Per Forum)
vB Default: No

once you done that you should be in there? i hoe so cos you need to populate that group with, oh yeah you do that by clicking this http://www.mydomain.com/forums/admin...uptitle=facffa
Code:

Varname: facffa_checkforumactivity
Title: Turn This Option On?
Description: Turning this on will mean that this hack will start working and checking if users have enough posts in order to access specified forums and their threads
Option Code: yesno
Default: no
vBulletin Default: no

Varname: facffa_checkforumactivitytime
Title: Required Time For Forum Activity
Description: This is the option for how many posts in XX days they need to access the forum.
Option Code:
Default: 1
vBulletin Default: no

Varname: facffa_checkforumactivityposts
Title: Required Posts For Forum Activity
Description: This is the setting for how many posts they need in the above time in order to access that forum.
Option Code:
Default: 1
vBulletin Default: no

Varname: facffa_checkforums
Title: Protected Forums
Description: These are the forums id's you want to protect with this hack, please seperate them with a comma.
Option Code:
Default:
vBulletin Default: no

Varname: facffa_excludeusergroups
Title: Excluded Usergroups
Description: These are the usergroup id's you want to exclude from having to actually post, please seperate them with a comma.
Option Code:
Default:
vBulletin Default: no

now i aint had time to test this so test it on your test board and let me know if you get a chance to test it before me, heh the nature of beta huh

even if this hack don't work, feed it to your search engine, by that i mean www.ebslive.com :cool: and stop stealing my smilies :lol:

and i'm spent.

UPDATED: 24/04/05 19:28

DeMiNe0 02-24-2005 12:32 PM

What does this hack do? Have any screenshots?

sabret00the 02-24-2005 12:36 PM

see the faq does come in handy, stupid Standard editor :tantrum:

ok say you got a forum called chit-chat, but you run a car site, you want to know your users are there to more than just chit-chat right and actually talk about what's really good ^o) (the cars) so you install this for the chit-chat forum and then voila they can't access the chit-chat forum unless they've made 50 posts in 2 days.

Guest190829 02-24-2005 01:27 PM

Very nice, I will try this. Thanks sabret00the ;)

esfron 03-21-2005 11:43 PM

I got:
Code:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/.../forumdisplay.php on line 217

Code:

// get permission to view forum
$_permsgetter_ = 'forumdisplay';
$forumperms = fetch_permissions($forumid);
if (!($forumperms & CANVIEW))
{
        print_no_permission();
}

if (($vboptions['facffa_checkforumactivity'] AND in_array($foruminfo['forumid'], $vboptions['facffa_checkforums'])))
    {
        // forum activity check
        $definedtime = ($vboptions['facffa_checkforumactivitytime'] * 86400);
        $limit = TIMENOW - $definedtime;
        $recentpostcount = $DB_site->query_first("
            SELECT COUNT(*) AS total
            FROM " . TABLE_PREFIX . "post
            WHERE userid = $bbuserinfo['userid']  <- Line 217
            AND dateline >= $limit
        ");

        if ($recentpostcount['total'] < $vboptions['facffa_checkforumactivityposts'])
        {
            eval(print_standard_error('facffa_checknotenoughposts'));
        }
    }


lasto 03-21-2005 11:57 PM

can u change the number of posts required etc to say 5 per day ? - but even that may seem a lot to some people.
You are basically forcing them to post and a lot of people dont like that - but i do :)

esfron 03-22-2005 12:06 AM

No forcing. You can turn on this option or not... fix the days, etc.

One screen is worth a 1000 words. See Screenshot.

lasto 03-22-2005 12:15 AM

arg right well then its a good hack then as u can set it for example to say they gotta have 2 posts in last week etc or even 2 in last month.

Should cut down on zero posters as well.

sabret00the 03-22-2005 07:14 AM

Quote:

Originally Posted by esfron
I got:
Code:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/.../forumdisplay.php on line 217

Code:

// get permission to view forum
$_permsgetter_ = 'forumdisplay';
$forumperms = fetch_permissions($forumid);
if (!($forumperms & CANVIEW))
{
        print_no_permission();
}

if (($vboptions['facffa_checkforumactivity'] AND in_array($foruminfo['forumid'], $vboptions['facffa_checkforums'])))
    {
        // forum activity check
        $definedtime = ($vboptions['facffa_checkforumactivitytime'] * 86400);
        $limit = TIMENOW - $definedtime;
        $recentpostcount = $DB_site->query_first("
            SELECT COUNT(*) AS total
            FROM " . TABLE_PREFIX . "post
            WHERE userid = $bbuserinfo['userid']  <- Line 217
            AND dateline >= $limit
        ");

        if ($recentpostcount['total'] < $vboptions['facffa_checkforumactivityposts'])
        {
            eval(print_standard_error('facffa_checknotenoughposts'));
        }
    }


change
PHP Code:

// get permission to view forum
$_permsgetter_ 'forumdisplay';
$forumperms fetch_permissions($forumid);
if (!(
$forumperms CANVIEW))
{
    
print_no_permission();
}

if ((
$vboptions['facffa_checkforumactivity'] AND in_array($foruminfo['forumid'], $vboptions['facffa_checkforums']))) 
    { 
        
// forum activity check 
        
$definedtime = ($vboptions['facffa_checkforumactivitytime'] * 86400); 
        
$limit TIMENOW $definedtime
        
$recentpostcount $DB_site->query_first(
            SELECT COUNT(*) AS total 
            FROM " 
TABLE_PREFIX "post 
            WHERE userid = 
$bbuserinfo['userid']
            AND dateline >= 
$limit 
        "
); 

        if (
$recentpostcount['total'] < $vboptions['facffa_checkforumactivityposts']) 
        { 
            eval(
print_standard_error('facffa_checknotenoughposts')); 
        } 
    } 

to

PHP Code:

// get permission to view forum
$_permsgetter_ 'forumdisplay';
$forumperms fetch_permissions($forumid);
if (!(
$forumperms CANVIEW))
{
    
print_no_permission();
}

if ((
$vboptions['facffa_checkforumactivity'] AND in_array($foruminfo['forumid'], $vboptions['facffa_checkforums']))) 
    { 
        
// forum activity check 
        
$definedtime = ($vboptions['facffa_checkforumactivitytime'] * 86400); 
        
$limit TIMENOW $definedtime
        
$recentpostcount $DB_site->query_first(
            SELECT COUNT(*) AS total 
            FROM " 
TABLE_PREFIX "post 
            WHERE userid = 
$bbuserinfo[userid]
            AND dateline >= 
$limit 
        "
); 

        if (
$recentpostcount['total'] < $vboptions['facffa_checkforumactivityposts']) 
        { 
            eval(
print_standard_error('facffa_checknotenoughposts')); 
        } 
    } 


esfron 03-22-2005 12:23 PM

Got:

Warning: in_array(): Wrong datatype for second argument in /forumdisplay.php on line 219


Code:

Line 219 ->   if (($vboptions['facffa_checkforumactivity'] AND in_array($foruminfo['forumid'], $vboptions['facffa_checkforums']))) 
    {
        // forum activity check
        $definedtime = ($vboptions['facffa_checkforumactivitytime'] * 86400);
        $limit = TIMENOW - $definedtime;
        $recentpostcount = $DB_site->query_first("
            SELECT COUNT(*) AS total
            FROM " . TABLE_PREFIX . "post
            WHERE userid = $bbuserinfo[userid]
            AND dateline >= $limit
        ");

        if ($recentpostcount['total'] < $vboptions['facffa_checkforumactivityposts'])
        {
            eval(print_standard_error('facffa_checknotenoughposts'));
        }
    }

and the following error:

vBulletin Message:
Unable to add cookies, header already sent.
File: /home/.../includes/init.php
Line: 27

sabret00the 03-22-2005 02:02 PM

find:
PHP Code:

if (($vboptions['facffa_checkforumactivity'] AND in_array($foruminfo['forumid'], $vboptions['facffa_checkforums'])))  
    { 
        
// forum activity check 
        
$definedtime = ($vboptions['facffa_checkforumactivitytime'] * 86400); 
        
$limit TIMENOW $definedtime
        
$recentpostcount $DB_site->query_first(
            SELECT COUNT(*) AS total 
            FROM " 
TABLE_PREFIX "post 
            WHERE userid = 
$bbuserinfo[userid] 
            AND dateline >= 
$limit 
        "
); 

        if (
$recentpostcount['total'] < $vboptions['facffa_checkforumactivityposts']) 
        { 
            eval(
print_standard_error('facffa_checknotenoughposts')); 
        } 
    } 

and replace with
PHP Code:

$facffa_checkforums explode(","$vboptions['facffa_checkforums']);

if ((
$vboptions['facffa_checkforumactivity'] AND in_array($threadinfo['forumid'], $facffa_checkforums)))
    {
        
// forum activity check
        
$definedtime = ($vboptions['facffa_checkforumactivitytime'] * 86400);
        
$limit TIMENOW $definedtime;
        
$recentpostcount $DB_site->query_first("
            SELECT COUNT(*) AS total
            FROM " 
TABLE_PREFIX "post
            WHERE userid = 
$bbuserinfo['userid']
            AND dateline >= 
$limit
        "
);

        if (
$recentpostcount['total'] < $vboptions['facffa_checkforumactivityposts'])
        {
            eval(
print_standard_error('facffa_checknotenoughposts'));
        }
    } 


sabret00the 03-22-2005 02:07 PM

first post updated to fix post instanced. :)

esfron 03-22-2005 03:11 PM

It seems to work. My server just crashed... I'll doublecheck tonight to be sure.

Thank you very much
I have been waiting for this a long time

Click Install

sabret00the 03-22-2005 03:22 PM

Quote:

Originally Posted by esfron
It seems to work. My server just crashed... I'll doublecheck tonight to be sure.

Thank you very much
I have been waiting for this a long time

Click Install

thank you, you done all the testing i never got around to doing :)

esfron 03-22-2005 07:46 PM

OK. It works fine today. I'll check back tomorrow.

- The forums id's separated with a space i.e. 2 26 124 does'nt work. It is working with a comma i.e. 2,26,124.

- It would be nice to make changes so members of certain usergroups (moderators, admin, etc) could be excluded from the activity. This could maybe be a future update. :)

Thanks

Llamaman 04-18-2005 08:57 PM

I am interested in this hack also.

Quote:

- It would be nice to make changes so members of certain usergroups (moderators, admin, etc) could be excluded from the activity. This could maybe be a future update.
If this feature was introduced then I would defenetly install and make use of this hack!

sabret00the 04-18-2005 09:00 PM

I'll add it in the morning :)

esfron 04-24-2005 04:54 PM

Quote:

Originally Posted by sabret00the
I'll add it in the morning :)

Thanks.

sabret00the 04-24-2005 05:30 PM

Quote:

Originally Posted by esfron
Thanks.

done already :)

esfron 04-24-2005 06:34 PM

Quote:

Originally Posted by sabret00the
done already :)

Parse error: parse error, unexpected T_STRING, expecting ']' in /home.../forumdisplay.php on line 226
I added ['usergroupid'] in forumdisplay and showthread but I got Warning: in_array(): Wrong datatype for second argument in /forumdisplay.php on line 223

It does'nt work with id=6 (admin). Got "You have not had enough forum activity in order to access this forum, please become more active then check back there-after."

sabret00the 04-24-2005 06:45 PM

what's line 223?

esfron 04-24-2005 06:51 PM

223:

PHP Code:

    if (($vboptions['facffa_checkforumactivity'] AND in_array($foruminfo['forumid'], $facffa_checkforums) AND !in_array($bbuserinfo['usergroupid'], $faffa_excludeusergroups))) 


esfron 04-24-2005 07:41 PM

Right now as user, I made 1 posts in 1 day. I tryed to access to protected forum but I get:

Unable to add cookies, header already sent.
File: /home.../includes/init.php
Line: 27

Init.php is fine because the hack is working without the usergroups update. I replaced the last forumdisplay&showthread by the old ones.

esfron 04-25-2005 01:44 PM

OK. I fixed the last one.

Right now, I get "Warning: in_array(): Wrong datatype for second argument in /showthread.php on line 319". Usergroups are not going to be excluded.

319 ->
PHP Code:

 if (($vboptions['facffa_checkforumactivity'] AND in_array($threadinfo['forumid'], $facffa_checkforums) AND !in_array($bbuserinfo['usergroupid'], $faffa_excludeusergroups))) 

Any idea ?
.

sabret00the 04-25-2005 01:50 PM

can you put 27 in the excuded usergroups in the vboptions and tell me if you still get the error please.

esfron 04-25-2005 02:17 PM

Usergroups:

- not connected (ID=1): error is:
Warning: in_array(): Wrong datatype for second argument in /showthread.php on line 319
AND
You have not had enough forum activity in order to access this forum, please become more active then check back there-after.


- connected member4 (ID=27), error is:
Warning: in_array(): Wrong datatype for second argument in /showthread.php on line 319
AND
Unable to add cookies, header already sent.
File: /home.../includes/init.php
Line: 27


Fix for forumdisplay:

PHP Code:

if (($vboptions['facffa_checkforumactivity'] AND in_array($threadinfo['forumid'], $facffa_checkforums) AND !in_array($bbuserinfo['usergroupid'], $faffa_excludeusergroups))) 
    { 


Marco van Herwaarden 04-25-2005 08:20 PM

What php version are you running?

esfron 04-25-2005 08:54 PM

Php 4.3.11

Darmak 05-14-2005 02:12 AM

Quote:

Originally Posted by esfron
Usergroups:

- not connected (ID=1): error is:
Warning: in_array(): Wrong datatype for second argument in /showthread.php on line 319
AND
You have not had enough forum activity in order to access this forum, please become more active then check back there-after.


- connected member4 (ID=27), error is:
Warning: in_array(): Wrong datatype for second argument in /showthread.php on line 319
AND
Unable to add cookies, header already sent.
File: /home.../includes/init.php
Line: 27


Fix for forumdisplay:

PHP Code:

if (($vboptions['facffa_checkforumactivity'] AND in_array($threadinfo['forumid'], $facffa_checkforums) AND !in_array($bbuserinfo['usergroupid'], $faffa_excludeusergroups))) 
    { 


To solve your problem replace in your forumdisplay.php & showthread.php this line

PHP Code:

if (($vboptions['facffa_checkforumactivity'] AND in_array($threadinfo['forumid'], $facffa_checkforums) AND !in_array($bbuserinfo['usergroupid'], $faffa_excludeusergroups))) 
    { 

Whit

PHP Code:

if (($vboptions['facffa_checkforumactivity'] AND in_array($threadinfo['forumid'], $facffa_checkforums) AND !in_array($bbuserinfo['usergroupid'], $facffa_excludeusergroups))) 
    { 

TYPO error... :p

esfron 05-14-2005 09:23 AM

Es bueno. Muchas gracias amigo Darmark de M?xico.
Thank you very much, Sabret00the. :up:

Nick0r 05-15-2005 07:20 PM

I'd like a mod to this, it could work one of two ways

a) User needs xx posts BEFORE his xx per week starts.
b) User is in additional usergroup X then his XX per week starts.

Either way works good for me, no need to have both.

sabret00the 05-16-2005 02:28 PM

Quote:

Originally Posted by Nick0r
User is in additional usergroup X then his XX per week starts.

it's as simple as adding AND in_array($bbuserinfo[membergroupid], X,X,X) to the conditionals.

KevinL 07-05-2005 01:51 AM

This works really well!

Thanks! :)


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

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.01531 seconds
  • Memory Usage 1,907KB
  • 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
  • (8)bbcode_code_printable
  • (14)bbcode_php_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (33)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