Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
AgeLock v3.5 Details »»
AgeLock v3.5
Version: 3.5b, by stuie_b stuie_b is offline
Developer Last Online: Aug 2018 Show Printable Version Email this Page

Category: Miscellaneous Hacks - Version: 4.0.x Rating:
Released: 02-12-2010 Last Update: 08-07-2011 Installs: 85
DB Changes Uses Plugins Template Edits
Re-useable Code Is in Beta Stage  
No support by the author.

Age Lock is an all-in-one Forum locking facility that works off the users age instead of there permissions
It gives you the ability to keep those Under 18's out of your adult section


Change log
+ Added support for CMS (Blog locking is there but not usable (99.9% sure blog locking is prob. pointless, since all users would be able to age restrict posts))
+ Enable/Disable Guest Viewing of age locked forums
+ Moved Age Lock core from outdated hook (global_start) to new (global_bootstrap_init_start)
+ Removed defunct Error message
+ Added abillity to re-enable Date of Birth Editing for all users
+ Fixed Bug where Date of birth editing is still disabled for users who are exempt from Age Lock
+ Reworded Default Age Lock Messages
+ Added support for multi-level forum locking using parent lock state (instead of parent-->forum, now parent-->forum-->subforum-->..)
+ Removed over zelus agelock checking (No more queries to get lock state)
+ Removed vb 3.x support

3.5a Fixes
+ Fixed CMS bugs (missing table prefix)
+ Updated template edit to work with Vb 4.1.5

3.5b Fixes
+ Really fixes the CMS bugs (Sorry )

Please be aware although support is provided it is limited. This version is in beta so expect bugs!

enjoy

Stuie

Download Now

File Type: zip Age Lock v3.5b.zip (29.3 KB, 193 views)

Screenshots

File Type: jpg cms.jpg (46.4 KB, 0 views)
File Type: jpg forum_lock.jpg (78.2 KB, 0 views)
File Type: jpg guest_article.jpg (23.7 KB, 0 views)
File Type: jpg options_1.jpg (82.6 KB, 0 views)
File Type: jpg options_2.jpg (83.1 KB, 0 views)
File Type: jpg parent_lock.jpg (78.2 KB, 0 views)
File Type: jpg too_old.jpg (29.3 KB, 0 views)
File Type: jpg too_Young.jpg (30.0 KB, 0 views)
File Type: jpg guest_forum.jpg (22.5 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
2 благодарности(ей) от:
Hostboard, spencerp

Comments
  #32  
Old 07-14-2010, 08:00 PM
tbl33 tbl33 is offline
 
Join Date: Jun 2010
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Still awaiting an answer. I thought that this mod was supported.
Reply With Quote
  #33  
Old 07-14-2010, 09:02 PM
stuie_b stuie_b is offline
 
Join Date: Jul 2005
Location: Newcastle, UK
Posts: 79
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by tbl33 View Post
Still awaiting an answer. I thought that this mod was supported.
yes this mod is supported to the best of my abillities and time, i do have other things which need to be sorted before support is an issue like the next version of Age Lock maybe you should be greatful for having support at all,

In answer to your question guest are not exemptable in this version, they are in the latest version which is still under development and at the min there is no eta (problems ),

however since you seem hell bent on this here is a modded version of the code which will enable guest viewing

Edit Global_start hook (Age Lock - Global Setup) and replace all with
PHP Code:
//Age Lock v3.1

function agelock_populate($fid){
global 
$db$vbulletin;
$agelock_qry $db->query_first("SELECT * FROM " TABLE_PREFIX ."forum WHERE forumid='".$fid."'");
if(
$agelock_qry['parentid'] > 0){
    
//Check for Parent Lock
    
$agelock_parent $db->query_first("SELECT * FROM " TABLE_PREFIX ."forum WHERE forumid='".$agelock_qry['parentid']."'");
    if(
$agelock_parent['agelock_parent']){
        
//Parent is locked, send lock status for sub-forum from parent
    
$agelock_ret['locked'] = $agelock_parent['agelock'];
    
$agelock_ret['method'] = $agelock_parent['agelock_method'];
    
$agelock_ret['age']  = $agelock_parent['agelock_age'];
    }else{
        
//Parent Lock is Not enabled, send lock status for sub-forum
     
$agelock_ret['locked'] = $agelock_qry['agelock']; 
    
$agelock_ret['method'] = $agelock_qry['agelock_method'];
    
$agelock_ret['age'] = $agelock_qry['agelock_age']; 
    }
}
$pre_year=date("Y"); $pre_month=date("m"); $pre_day=date("d"); $bday explode("-"$vbulletin->userinfo['birthday']);
if(
$pre_month>$bday[0] || ($bday[0]==$pre_month && $pre_day>=$bday[1]) ){$agelock_ret['userage'] = $pre_year-$bday[2];}else{$agelock_ret['userage'] = $pre_year-$bday[2]-1;}
return 
$agelock_ret;
}
//End of the AgeLock Population Funcion


function agelock_check($fid,$flag=0){
global 
$vbulletin,$db;
$agelock agelock_populate($fid);

if(
$agelock['locked'] == and $vbulletin->options['agelock_global']){
//if(!$vbulletin->userinfo['userid']){if($flag){return 1;}else{standard_error($vbulletin->options['agelock_guest']);}}
if(!$vbulletin->userinfo['permissions']['adminpermissions'] and !preg_match("/".$vbulletin->userinfo['usergroupid']."/i",$vbulletin->options['agelock_exmptusr'])){
if(!
$vbulletin->userinfo['birthday'] and $vbulletin->userinfo['userid']){if($flag){return 1;}else{standard_error($vbulletin->options['agelock_nobday']);}}

if(
$agelock['method'] == 0){ //This forum has a lock, they need too be older than the value set
if($agelock['userage'] < $agelock['age']){ //Are you old enuff? 
if($flag){return 1;}else{standard_error($vbulletin->options['agelock_toyng']);} //Your too young!
}

}elseif(
$agelock['method'] == 1){ //This forum has a lock, they need too be Younger than the value set
if($agelock['userage'] >= $agelock['age']){ //Are you young enuff?
if($flag){return 1;}else{standard_error($vbulletin->options['agelock_toold']);} //Your too Old!
}
}

//End of check if there able to bypass the lock (admins/mods or user specified usergroups)
//End of main age lock code
//End of function

if($vbulletin->options['agelock_global'] and $vbulletin->options['agelock_hidemain']){
foreach (
$vbulletin->forumcache as $key => $value){
    if (
agelock_check($vbulletin->forumcache[$key]['forumid'],1)){
        unset(
$vbulletin->forumcache[$key]);
         }
}

untested!


Stuie
Reply With Quote
  #34  
Old 07-15-2010, 09:16 PM
tbl33 tbl33 is offline
 
Join Date: Jun 2010
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you! No need to get salty. A simple acknowledgement of my message would have prevented my sending another message, "7 days later". Anyway, thank you for your efforts.
Reply With Quote
  #35  
Old 07-15-2010, 09:35 PM
tbl33 tbl33 is offline
 
Join Date: Jun 2010
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

FYI, the code works for allowing guests but it would appear that the sub forums locking isn't working real well. It locks the first tier under the category but anything below that is open.

ie. Underground is locked to over 18 the sub of Others is also locked but all of the subs under Others, is wide open.

I didn't notice if that was an issue in 3.1 or just the modified code above.
Reply With Quote
  #36  
Old 08-08-2010, 08:39 AM
darksoul darksoul is offline
 
Join Date: Apr 2004
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello,

We have a board with 148 forums and subforums. On each page load your plugin will query the database for all forums and it managed to fill a 100Mbps pipe line to the mysql server.
The agelock_populate function should use the forumcache instead of querying the database every time.

Regards,
Darksoul
Reply With Quote
  #37  
Old 08-11-2010, 10:52 AM
stuie_b stuie_b is offline
 
Join Date: Jul 2005
Location: Newcastle, UK
Posts: 79
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Latest version of Age Lock has now been attached,

Its recommended you uninstall all previous versions and upgrade to v3.5

Code:
+ Added support for CMS (Blog locking is there but not usable (99.9% sure blog locking is prob. pointless, since all users would be able to age restrict posts))
+ Enable/Disable Guest Viewing of age locked forums
+ Moved Age Lock core from outdated hook (global_start) to new (global_bootstrap_init_start)
+ Removed defunct Error message 
+ Added abillity to re-enable Date of Birth Editing for all users
+ Fixed Bug where Date of birth editing is still disabled for users who are exempt from Age Lock
+ Reworded Default Age Lock Messages
+ Added support for multi-level forum locking using parent lock state (instead of parent-->forum, now parent-->forum-->subforum-->..)
+ Removed over zelus agelock checking (No more queries to get lock state)
Support is limited but i will try to answer as many as possible.


Stuie
Reply With Quote
  #38  
Old 08-16-2010, 01:16 AM
CrystaStarLight CrystaStarLight is offline
 
Join Date: Sep 2006
Posts: 54
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is a great hack, thank you! Marked installed & 5 starred.

Oh also, in the template changes, I needed to add vb: in front of the "if" conditions in the code, otherwise I was getting an error when I tried to save the template. I have 4.0.6. I don't know if needing a vb: in front of the IF's is a new thing with that version, I just noticed all the surrounding IF's had vb: in front of them, so I tried it and it got rid of the error. This is what I did:

Code:
<vb:if condition="$vboptions['agelock_frmnt'] AND $forum['agelock'] AND $vboptions['agelock_global']">{vb:raw $vboptions['agelock_frmntm']}</vb:if>
Reply With Quote
  #39  
Old 08-16-2010, 09:09 AM
stuie_b stuie_b is offline
 
Join Date: Jul 2005
Location: Newcastle, UK
Posts: 79
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by CrystaStarLight View Post
This is a great hack, thank you! Marked installed & 5 starred.

Oh also, in the template changes, I needed to add vb: in front of the "if" conditions in the code, otherwise I was getting an error when I tried to save the template. I have 4.0.6. I don't know if needing a vb: in front of the IF's is a new thing with that version, I just noticed all the surrounding IF's had vb: in front of them, so I tried it and it got rid of the error. This is what I did:

Code:
<vb:if condition="$vboptions['agelock_frmnt'] AND $forum['agelock'] AND $vboptions['agelock_global']">{vb:raw $vboptions['agelock_frmntm']}</vb:if>
Thanks for the notice, i had used the old template code,

Updated package with correct installation details

Stuie
Reply With Quote
  #40  
Old 08-17-2010, 03:40 AM
ImmortalForums ImmortalForums is offline
 
Join Date: Feb 2007
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Glad to see the query change. 300+ queries for my forum was a bit crazy.
Reply With Quote
  #41  
Old 12-27-2010, 02:16 AM
OldSchoolDSL OldSchoolDSL is offline
 
Join Date: Oct 2010
Posts: 1,196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Installed and working

4.1 PL2

Would be wonderful if someone added the option for this to work with Blogs as well
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 12:19 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.08666 seconds
  • Memory Usage 2,394KB
  • Queries Executed 26 (?)
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
  • (3)bbcode_code
  • (1)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (2)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)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_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
  • 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
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete