Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons

Reply
 
Thread Tools
Widget - Today's Birthdays Details »»
Widget - Today's Birthdays
Version: 1.00, by ZexTasy ZexTasy is offline
Developer Last Online: Feb 2011 Show Printable Version Email this Page

Category: vBulletin CMS Widgets - Version: 4.0.8 Rating:
Released: 12-09-2010 Last Update: 12-09-2010 Installs: 49
Uses Plugins Template Edits
Translations  
No support by the author.

First I want to thank Lynne for giving me a good startup for both code and this post from her Widget - Online Users mod.

This is a widget for your CMS pages to show Today's Birthdays.



You will need to Create a new Template (vbcms_widget_execphp_birthdays), Cache the template, Create a new Widget (Today's Birthdays), Configure the Widget, and then finally add the Widget to your Layout (I am not including instructions for that, you should know how to add Widgets to Layouts).

1.0 2010-12-10: First version (4.0.8)

INSTALL INSTRUCTIONS:

1) Create a new Template
Styles & Templates > select style (I like to do this in the MASTER STYLE, but you will need to reinput it after every upgrade) > Add Template
Title - vbcms_widget_execphp_birthdays
Template code -
HTML Code:
<vb:if condition="$show['birthdays']">
<div class="cms_widget category_widget">
    <div class="block">
        <div class="cms_widget_header">
	    <h3><img src="{vb:stylevar imgdir_misc}/birthday.png" alt="{vb:rawphrase todays_birthdays}" /> {vb:rawphrase todays_birthdays}</h3>
        </div>
        <div class="cms_widget_content widget_content">
            <div>
                <ol class="commalist">
			{vb:raw birthdays}
		</ol>
            </div>
        </div>
    </div>
</div>
</vb:if>

2) Create a new Plugin
Plugins & Products > Add New Plugin > leave everything default except:
Hook Location - cache_templates
Title - Cache template for Today's Birthdays Widget
Plugin PHP code -
PHP Code:
if (THIS_SCRIPT == 'vbcms')
{
    
$cache[] = 'forumhome_birthdaybit';

Plugin is Active - Yes

3) Create a new Widget
vBulletin CMS > Widgets > Create New Widget
Widget Type - PHP Direct Execution
Title - Today's Birthdays
SAVE

4) Configure the Widget
Now go to vBulletin CMS > Widgets > Today's Birthdays > Configure
Change the Template Name to -
vbcms_widget_execphp_birthdays
Add the following code -
PHP Code:
$today vbdate('Y-m-d'TIMENOWfalsefalse);

// ### TODAY'S BIRTHDAYS #################################################
if (vB::$vbulletin->options['showbirthdays'])
{
    if (!
is_array(vB::$vbulletin->birthdaycache)
        OR (
$today != vB::$vbulletin->birthdaycache['day1'] AND $today != vB::$vbulletin->birthdaycache['day2'])
        OR !
is_array(vB::$vbulletin->birthdaycache['users1'])
    )
    {
        
// Need to update!
        
require_once(DIR '/includes/functions_databuild.php');
        
$birthdaystore build_birthdays();
        
DEVDEBUG('Updated Birthdays');
    }
    else
    {
        
$birthdaystore $vbulletin->birthdaycache;
    }
    switch (
$today)
    {
        case 
$birthdaystore['day1']:
            
$birthdaysarray $birthdaystore['users1'];
            break;

        case 
$birthdaystore['day2']:
            
$birthdaysarray $birthdaystore['users2'];
            break;

        default:
            
$birthdaysarray = array();
    }
    
// memory saving
    
unset($birthdaystore);

    
$birthdaybits = array();

    foreach (
$birthdaysarray AS $birthday)
    {
        
$templater vB_Template::create('forumhome_birthdaybit');
            
$templater->register('birthday'$birthday);
        
$birthdaybits[] = $templater->render();
    }

    
$birthdays implode(''$birthdaybits);
    

    
$show['birthdays'] = iif ($birthdaystruefalse);
}
else
{
    
$show['birthdays'] = false;
}

$birthdaysarray = array('birthdays' => $birthdays,
    
'show' => $show,
    );
vB_Template::preRegister('vbcms_widget_execphp_birthdays'$birthdaysarray); 
After install clear the CMS cache

Download Now

File Type: txt widget-birthdays 1.0.txt (3.2 KB, 188 views)

Screenshots

File Type: jpg todays_birthdays_widget.jpg (6.6 KB, 0 views)

Show Your Support

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

Comments
  #2  
Old 12-11-2010, 12:57 AM
Taurus1's Avatar
Taurus1 Taurus1 is offline
 
Join Date: Dec 2009
Posts: 648
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you! Works great.
Reply With Quote
  #3  
Old 12-12-2010, 02:08 AM
OldSchoolDSL OldSchoolDSL is offline
 
Join Date: Oct 2010
Posts: 1,196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
Parse error: syntax error, unexpected T_LNUMBER in /home/socially/public_html/forums/includes/class_core.php(4074) : eval()'d code on line 2
Followed everything to the letter and even double checked after, but got the following error on the top of every page on my site, after I told the system to rebuild theme / styles .... I too edit the default theme / style and use it as the parent theme for everything (makes it real easy to update 12 other themes).

Got ride of the error by clearing the CSM CACHE and / or Verify and Repair Node Table

Setup a test account with today as the accounts (fake user's) birthday. Nothing showed up, so this seems not to be working for me.
Reply With Quote
  #4  
Old 12-12-2010, 07:30 AM
ZexTasy ZexTasy is offline
 
Join Date: Jan 2008
Posts: 34
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

which vb version are you using?
Reply With Quote
  #5  
Old 12-12-2010, 07:37 AM
OldSchoolDSL OldSchoolDSL is offline
 
Join Date: Oct 2010
Posts: 1,196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ZexTasy View Post
which vb version are you using?
4.0.8 Patch Level 2

Thanks for the quick reply
Reply With Quote
  #6  
Old 12-12-2010, 12:28 PM
OldSchoolDSL OldSchoolDSL is offline
 
Join Date: Oct 2010
Posts: 1,196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by OldSchoolDSL View Post
4.0.8 Patch Level 2

Thanks for the quick reply
FIXED.

It works.... But it only showed up after I logged into my "demo / test account".

What I had done was change the birth date from within the admin account to reflect today. But oddly enough it would not show up until I finally logged into that account.

My "demo / test account" is simply another user to which I made to see things from another point of view, without having to make the changes on my account or another user's (2 browser going at once).

(my test site basically died off and I've not gotten to re-making a new one yet... So much work)
Reply With Quote
  #7  
Old 12-12-2010, 06:35 PM
ZexTasy ZexTasy is offline
 
Join Date: Jan 2008
Posts: 34
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That sounds logical. Since Birthdays make use of the datastore and when updating a user in the admincp you don't update that. Therefore the user did not come up as having a birthday on that day. I'll add a comment to the startpost that it's useful to clear the CMS cache after install! I am glad it all works! (Y)
Reply With Quote
  #8  
Old 12-16-2010, 01:22 AM
fastcom fastcom is offline
 
Join Date: Mar 2010
Posts: 13
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi ZexTasy,
I want display winget in forum block. I have complet step 1,2 and 4. At step 4 I config:
Title: Today's Birthdays
Active: Yes
Content type: PHP
Content:
PHP Code:
$today vbdate('Y-m-d'TIMENOWfalsefalse);

// ### TODAY'S BIRTHDAYS #################################################
if (vB::$vbulletin->options['showbirthdays'])
{
    if (!
is_array(vB::$vbulletin->birthdaycache)
        OR (
$today != vB::$vbulletin->birthdaycache['day1'] AND $today != vB::$vbulletin->birthdaycache['day2'])
        OR !
is_array(vB::$vbulletin->birthdaycache['users1'])
    )
    {
        
// Need to update!
        
require_once(DIR '/includes/functions_databuild.php');
        
$birthdaystore build_birthdays();
        
DEVDEBUG('Updated Birthdays');
    }
    else
    {
        
$birthdaystore $vbulletin->birthdaycache;
    }
    switch (
$today)
    {
        case 
$birthdaystore['day1']:
            
$birthdaysarray $birthdaystore['users1'];
            break;

        case 
$birthdaystore['day2']:
            
$birthdaysarray $birthdaystore['users2'];
            break;

        default:
            
$birthdaysarray = array();
    }
    
// memory saving
    
unset($birthdaystore);

    
$birthdaybits = array();

    foreach (
$birthdaysarray AS $birthday)
    {
        
$templater vB_Template::create('forumhome_birthdaybit');
            
$templater->register('birthday'$birthday);
        
$birthdaybits[] = $templater->render();
    }

    
$birthdays implode(''$birthdaybits);
    

    
$show['birthdays'] = iif ($birthdaystruefalse);
}
else
{
    
$show['birthdays'] = false;
}

$birthdaysarray = array('birthdays' => $birthdays,
    
'show' => $show,
    );
vB_Template::preRegister('vbcms_widget_execphp_birthdays'$birthdaysarray); 
and other field is default.
After complete these step then nothing is happen. I do not know any mistake in these step.
Reply With Quote
  #9  
Old 12-16-2010, 05:25 PM
ZexTasy ZexTasy is offline
 
Join Date: Jan 2008
Posts: 34
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Did you clear the CMS cache?

Also, when no one has a birthday today, the widget won't come up ...
Reply With Quote
  #10  
Old 12-27-2010, 11:51 PM
Zweeper Zweeper is offline
 
Join Date: Jan 2005
Posts: 258
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

is it working as a forum block? (in the forum sidebar)
Reply With Quote
Reply

Thread Tools

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 07:14 PM.


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.13796 seconds
  • Memory Usage 2,365KB
  • Queries Executed 24 (?)
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
  • (1)bbcode_code
  • (1)bbcode_html
  • (3)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
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (2)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)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
  • 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_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