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

Reply
 
Thread Tools
Calendar Active Members Time Cut-Off hack Details »»
Calendar Active Members Time Cut-Off hack
Version: 1.00, by PlickBadger PlickBadger is offline
Developer Last Online: Aug 2014 Show Printable Version Email this Page

Category: Mini Mods - Version: 3.8.2 Rating:
Released: 07-07-2009 Last Update: Never Installs: 6
Code Changes  
No support by the author.

If you want your calendar to adhere to the Active Members Time Cut-Off and the Show birthdays for active users only Active Members option. Modify the following files

modify your /forum/includes/functions_calendar.php as follows:
find

PHP Code:
function cache_birthdays($weekly 0)
{
    global 
$doublemonth$vbulletin$calendarinfo$doublemonth1$doublemonth2;

    
$birthday = array(); 
add the following directly below it
PHP Code:
    // calendar hack to limit birthdays to active users pulled directly from functions_databuild.php
    
if ($vbulletin->options['activememberdays'] > AND ($vbulletin->options['activememberoptions'] & 1))
    {
        
$datecut TIMENOW - (intval($vbulletin->options['activememberdays']) * 86400);
        
$activitycut "AND lastactivity >= $datecut";
    }
    else
    {
        
$activitycut '';
    } 
Then add
PHP Code:
$activitycut 
to the end of the following 2 SQL statements

before:
PHP Code:
        if (!$weekly)
        { 
// cache birthdays for a single month
            
$birthdays $vbulletin->db->query_read_slave("
                SELECT birthday, username, userid, showbirthday
                FROM " 
TABLE_PREFIX "user
                WHERE birthday LIKE '
$doublemonth-%' AND
                    usergroupid IN (
$ids) AND
                    showbirthday IN (2, 3)
            "
);
        }
        else
        { 
// cache for two months!
            
$birthdays $vbulletin->db->query_read_slave("
                SELECT birthday, username, userid, showbirthday
                FROM " 
TABLE_PREFIX "user
                WHERE (birthday LIKE '
$doublemonth1-%' OR
                    birthday LIKE '
$doublemonth2-%') AND
                    usergroupid IN (
$ids) AND
                    showbirthday IN (2,3)
            "
);
        } 
after:
PHP Code:
        if (!$weekly)
        { 
// cache birthdays for a single month
            
$birthdays $vbulletin->db->query_read_slave("
                SELECT birthday, username, userid, showbirthday
                FROM " 
TABLE_PREFIX "user
                WHERE birthday LIKE '
$doublemonth-%' AND
                    usergroupid IN (
$ids) AND
                    showbirthday IN (2, 3)
                    
$activitycut
            "
);
        }
        else
        { 
// cache for two months!
            
$birthdays $vbulletin->db->query_read_slave("
                SELECT birthday, username, userid, showbirthday
                FROM " 
TABLE_PREFIX "user
                WHERE (birthday LIKE '
$doublemonth1-%' OR
                    birthday LIKE '
$doublemonth2-%') AND
                    usergroupid IN (
$ids) AND
                    showbirthday IN (2,3)
                    
$activitycut
            "
);
        } 
Then modify your /forum/calendar.php as follows:
find
PHP Code:
        // set date range for events to cache.
        
$eventrange = array('frommonth' => $month'fromyear' => $year'nextmonth' => $month'nextyear' => $year);

        
// cache events for this month only.
        
$eventcache cache_events($eventrange); 
add the following directly below it
PHP Code:
        // calendar hack to limit birthdays to active users pulled directly from functions_databuild.php
        
if ($vbulletin->options['activememberdays'] > AND ($vbulletin->options['activememberoptions'] & 1))
        {
            
$datecut TIMENOW - (intval($vbulletin->options['activememberdays']) * 86400);
            
$activitycut "AND lastactivity >= $datecut";
        }
        else
        {
            
$activitycut '';
        } 
Then add
PHP Code:
$activitycut 
To the following SQL statement
before:
PHP Code:
        if ($calendarinfo['showbirthdays'])
        {  
// Load the birthdays for today

            
foreach($vbulletin->usergroupcache AS $usergroupid => $usergroup)
            {
                if (
$usergroup['genericoptions'] & $vbulletin->bf_ugp_genericoptions['showbirthday'])
                {
                    
$ids .= ",$usergroupid";
                }
            }

            
$comma '';
            
$birthday $db->query_read_slave("
                SELECT birthday, username, userid, showbirthday
                FROM " 
TABLE_PREFIX "user
                WHERE birthday LIKE '
$doublemonth-$doubleday-%' AND
                    usergroupid IN (0
$ids) AND
                    showbirthday IN (2,3)
            "
); 
after:
PHP Code:
        if ($calendarinfo['showbirthdays'])
        {  
// Load the birthdays for today

            
foreach($vbulletin->usergroupcache AS $usergroupid => $usergroup)
            {
                if (
$usergroup['genericoptions'] & $vbulletin->bf_ugp_genericoptions['showbirthday'])
                {
                    
$ids .= ",$usergroupid";
                }
            }

            
$comma '';
            
$birthday $db->query_read_slave("
                SELECT birthday, username, userid, showbirthday
                FROM " 
TABLE_PREFIX "user
                WHERE birthday LIKE '
$doublemonth-$doubleday-%' AND
                    usergroupid IN (0
$ids) AND
                    showbirthday IN (2,3)
                    
$activitycut
            "
); 
I did not write this code, I swiped it from functions_databuild.php, but I thought it might be useful to someone

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 07-08-2009, 07:31 PM
Fynnon Fynnon is offline
 
Join Date: Jul 2008
Posts: 120
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
If you want your calendar to adhere to the Active Members Time Cut-Off and the Show birthdays for active users only Active Members option
What, i don`t really understand what you`re saying in that phrase, lol !?
This mod will show me in memberlist who is celebrating his birthday ?

Its interesting, good mod, too bad it has to have template edits cause everytime you update vB and the template with it you need to do this edit again and if you have like 20 mods like this...

I always wanted to to have a better memberlist to see more about users, like their COUNTRY and other stuff ! 10x
Reply With Quote
  #3  
Old 07-08-2009, 09:58 PM
PlickBadger PlickBadger is offline
 
Join Date: Nov 2004
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The Forum Home Page options (Active Members Time Cut-Off and the Show birthdays for active users only) in the AdminCP limit the birthdays shown on the home page to users that have been active within certain amount of days.

This hack makes the Calendar do the same thing.
Reply With Quote
  #4  
Old 07-09-2009, 02:38 AM
ntduyphuong ntduyphuong is offline
 
Join Date: Sep 2006
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Use the option in vBulletin Options is much safer
Reply With Quote
  #5  
Old 07-09-2009, 12:16 PM
PlickBadger PlickBadger is offline
 
Join Date: Nov 2004
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's the whole point. The option in Vbulletin doesn't work for the calendar, only the home page
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 01:28 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.05369 seconds
  • Memory Usage 2,311KB
  • Queries Executed 21 (?)
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
  • (10)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (4)postbit
  • (5)postbit_onlinestatus
  • (5)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
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete