Thread: Miscellaneous Hacks - AgeLock v3.5
View Single Post
  #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
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01302 seconds
  • Memory Usage 1,825KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete