vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   vBulletin CMS Widgets - Widget - Today's Birthdays (https://vborg.vbsupport.ru/showthread.php?t=255015)

ZexTasy 12-09-2010 10:00 PM

Widget - Today's Birthdays
 
1 Attachment(s)
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.

https://vborg.vbsupport.ru/attachmen...1&d=1292005895

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

Taurus1 12-11-2010 12:57 AM

Thank you! Works great.

OldSchoolDSL 12-12-2010 02:08 AM

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.

ZexTasy 12-12-2010 07:30 AM

which vb version are you using?

OldSchoolDSL 12-12-2010 07:37 AM

Quote:

Originally Posted by ZexTasy (Post 2132741)
which vb version are you using?

4.0.8 Patch Level 2

Thanks for the quick reply

OldSchoolDSL 12-12-2010 12:28 PM

Quote:

Originally Posted by OldSchoolDSL (Post 2132744)
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)

ZexTasy 12-12-2010 06:35 PM

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)

fastcom 12-16-2010 01:22 AM

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.

ZexTasy 12-16-2010 05:25 PM

Did you clear the CMS cache?

Also, when no one has a birthday today, the widget won't come up ...

Zweeper 12-27-2010 11:51 PM

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

ZexTasy 12-28-2010 10:39 AM

No, only as a CMS widget ... I haven't taken a look at how to make a forum block yet ...

Les Beeavinu 12-28-2010 10:36 PM

Hi - new to all this and registered specifically for this widget. Sadly, doesn't work, even though I've followed the comprehensive instructions. Just now showing at all - no error codes or anything.

ZexTasy 12-29-2010 10:55 PM

It doesn't show when no one has a birthday on the current day. You als might need to clear the CMS cache ...

Les Beeavinu 12-31-2010 04:57 AM

Thank you. Re-installed and all working ok now.

cws 01-18-2011 04:56 PM

Thanks, working perfect with 4.1

Miss T 01-19-2011 07:46 PM

i dont get it

im running 4.1.1 and o followed the instructions to the letter - and everything is exactly as instructed... no deviations..

but it doesnt show in the front page despite the test users bday is set to today and is showing age and birthday

does it not work for 4.1.1 ?


ok - it came out after i cleared the cache again - but it dissapears - and i have to clear cache everytime i want to show it

i LOVED it the time i saw it - i really would like for it to show all the time :)

sweetpotato 03-06-2011 03:25 PM

It works for me with 4.1.2. Thanks

hurleyint1836 03-08-2011 03:28 AM

Quote:

Originally Posted by Miss T (Post 2151623)
i dont get it

im running 4.1.1 and o followed the instructions to the letter - and everything is exactly as instructed... no deviations..

but it doesnt show in the front page despite the test users bday is set to today and is showing age and birthday

does it not work for 4.1.1 ?


ok - it came out after i cleared the cache again - but it dissapears - and i have to clear cache everytime i want to show it

i LOVED it the time i saw it - i really would like for it to show all the time :)

Same this is happening for me as well. Shows up, once refreshed, it disappears until I clear CMS cache. Any ideas? Using 4.1.2

Eq4bits 06-30-2011 06:31 PM

Works fine on 4.1.4
Of course doesn't show any for members who have chosen to 'hide' their complete bday info or 'hide' the month and day.

Any chance of having upcoming birthdays (say those in the next x number of days) show up instead of just 'today's'?

slvrswrd 07-27-2011 04:04 PM

I'm using 4.1.4 with a custom style and the widget only sometimes displays. I can't get anything consistent with any of the four major browsers.

Scitz0 08-23-2011 05:15 AM

I'm on 4.1.5 and I cant get this widget to display. Even before when I was on 4.1.2 it didn't work.
I have followed the instructions to the letter, even removed it and reinstalled several times to be sure I didn't miss anything.

I can see some post here that people only see it after clearing CMS cache but not even that helps in my case.

What can I do to help you help me?

I have checked that birthdays are activated in the settings as well, both under general settings and under usergroup settings.

dang3rzon3 04-11-2012 12:27 PM

hello,
how to use in the sidebar forum?

Tri@de 04-17-2012 08:27 AM

vb 4.1.12 don't work.

JustAskJulie 05-10-2012 06:47 PM

4.1.12 and the widget shows up but it's empty - despite a birthday showing on the "What's going on" list on forumhome.

s_cocis 11-14-2012 10:30 AM

for 4.2 ?

080208 12-05-2012 01:59 AM

I do not work in 4.2 (

petersweb 06-18-2013 12:21 AM

I am using VB 4.2.1. I cannot get the widget to show on the CMS when there are birthdays listed in the "What's Going On" section.

BGObsession 02-16-2014 05:18 PM

Uninstalled on 4.2.1 (widget block shows but does not display birthday despite test user birthday. It's not a cache clearing issue. The mod simply doesn't work.

AndroidXDA 03-04-2014 07:11 AM

Interesting, Will try this out on my 4.2.2 and get back to you.


All times are GMT. The time now is 07:13 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.01282 seconds
  • Memory Usage 1,845KB
  • 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
  • (1)bbcode_code_printable
  • (1)bbcode_html_printable
  • (3)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (29)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