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)
-   -   Miscellaneous Hacks - VSa - Auto Birthday Greeter (https://vborg.vbsupport.ru/showthread.php?t=236131)

oly51 10-08-2010 01:35 AM

Yesterday it greeted a member who lives in Norway at ~2:00pm EST (10 hours early). Today it greeted a member who lives in IL in the US ( GMT-6) at ~10:00pm (2 hours early).
Could the program be triggering on the members time zone instead of the servers?

GeorgeB85 10-14-2010 04:35 PM

This is working incorrectly. on 4.0.7. It is posting the birthday messages roughly 25 hours late. I just had a posting for a members birthday that was yesterday, and it didn't post till almost 1am last night.

Julie 10-16-2010 09:57 AM

I've had this installed for a while now, even on 4.0, and it's been working OK, it just posted the thread too early (about an hour before midnight or so), so I just had to manually edit the date inside the thread. Which wasn't a problem, because not a lot of birthday threads were posted.

But today I had to disable it. I had two members who had a birthday, and during the night, this script posted over 100 threads :S

Hopefully there'll be an update soon, because I really like this script!

kras 10-17-2010 08:31 AM

Even though i have created translations of the phrases; It's still uses the default English phrases in the gratulations.

woffie 10-17-2010 03:46 PM

Not posting any threads. Giving up on this one.

persianpros 10-27-2010 07:07 AM

Persian Translation :cool:

By Persian Prince

kras 11-02-2010 02:57 AM

1 Attachment(s)
The original code used the vbdate()-function in a way that created bogus times, which actually is a design flaw in the function itself. However, since the Unix timestamp is independent from the default timezone settings i see no point in the original logic anyway, unless you alter the code to take advantage of vbdate's built in hourdiff mechanism, but since that mechanism uses the current users timezone you could get pretty unpredictable times.

I have altered the code so that a current UTC time is first created and then modified with the forums' timezone setttings to create a local forum time. In short, the product works fine now with the following changes.


Replace:

PHP Code:

$vsaabgreeter_servertime mktime('0'.date('H'TIMENOW),    '0'.date('i'TIMENOW), '0'.date('s'TIMENOW), '0'.date('m'TIMENOW),    '0'.date('d'TIMENOW), '0'.date('Y'TIMENOW), -1);
 
$vsaabgreeter_forumtime mktime('0'.vbdate('H'TIMENOW),    '0'.vbdate('i'TIMENOW), '0'.vbdate('s'TIMENOW), '0'.vbdate('m',    TIMENOW), '0'.vbdate('d'TIMENOW), '0'.vbdate('Y'TIMENOW), -1);
 
 
$vsaabgreeter_propertime TIMENOW;
 if (
$vsaabgreeter_servertime $vsaabgreeter_forumtime)
 {
         
$vsaabgreeter_timeoffset $vsaabgreeter_servertime $vsaabgreeter_forumtime;
         
$vsaabgreeter_propertime TIMENOW $vsaabgreeter_timeoffset 10;
 }
 else
 {
         
$vsaabgreeter_timeoffset $vsaabgreeter_forumtime $vsaabgreeter_servertime;
         
$vsaabgreeter_propertime TIMENOW $vsaabgreeter_timeoffset 10;
 }
 
 
$vsaabgreeter_execdate date('m-d'$vsaabgreeter_propertime);
 
 
$vsaabgreeter_done false;
 
$vsaabgreeter_posted $vbulletin->db->query_read(" SELECT daydone    FROM " TABLE_PREFIX "vsa_birthdaythread WHERE daydone =    '".$vbulletin->db->escape_string($vsaabgreeter_execdate)."' ");
 
 if (
$vbulletin->db->num_rows($vsaabgreeter_posted) > 0)
 {
         
$vsaabgreeter_done true;
 }
 
 
$vsaabgreeter_exechour date('H'$vsaabgreeter_propertime); 

[hr]-[/hr]

With:

PHP Code:

 $vsaabgreeter_Time = new DateTime("now", new DateTimeZone('UTC'));
 
$vsaabgreeter_offset $vbulletin->options[timeoffset];
 
$vsaabgreeter_Time->modify(($vsaabgreeter_offset >= '+' $vsaabgreeter_offset $vsaabgreeter_offset) . 'hour');
 
 
$vsaabgreeter_execdate $vsaabgreeter_Time->format('m-d');
 
 
$vsaabgreeter_done false;
 
$vsaabgreeter_posted $vbulletin->db->query_read(" SELECT daydone  FROM " TABLE_PREFIX "vsa_birthdaythread WHERE daydone =  '".$vbulletin->db->escape_string($vsaabgreeter_execdate)."' ");
 
 if (
$vbulletin->db->num_rows($vsaabgreeter_posted) > 0)
 {
         
$vsaabgreeter_done true;
 }
 
 
$vsaabgreeter_exechour $vsaabgreeter_Time->format('H'); 

[hr]-[/hr]


Note that the exclude times are still there, which by default means that no threads will be created after 20:00. These times can be altered in the array shown below


PHP Code:

 $vsaabgreeter_exchrs = array(20,21,22,23); 

[hr]-[/hr]

or removed completely by replacing:

PHP Code:

 $vsaabgreeter_exechour $vsaabgreeter_Time->format('H');
 
$vsaabgreeter_exchrs = array(20,21,22,23);
 
 if (!
$vsaabgreeter_done AND !in_array($vsaabgreeter_exechour$vsaabgreeter_exchrs)) 

[hr]-[/hr]

with

PHP Code:

 if (!$vsaabgreeter_done

[hr]-[/hr]

Attached is a file with all changes.

voglermc 11-02-2010 10:56 AM

Thanks Kras!

voglermc 11-02-2010 12:00 PM

Kras, I'm getting this error since installing your version

Warning: DateTime::modify() [datetime.modify]: Failed to parse time string (hour) at position 0 (h): The timezone could not be found in the database in [path]/includes/class_bootstrap.php(517) : eval()'d code on line 91

-=Leb=- 11-02-2010 12:19 PM

I wouldn't install it without valter's permission!


All times are GMT. The time now is 09:24 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.01552 seconds
  • Memory Usage 1,772KB
  • 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
  • (5)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete