vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Automatic Birthday Thread (https://vborg.vbsupport.ru/showthread.php?t=62613)

EvilLS1 04-25-2004 11:58 PM

Quote:

Originally Posted by lasto
church media one request if possible - can this be set to ignore zero posters ?

Yep. I added that and a few other options to mine.

In birthday.php find:
Code:

$birthdays = $DB_site->query("
    SELECT username, email, languageid, birthday, userid

Replace it with:
Code:

$birthdays = $DB_site->query("
        SELECT username, email, languageid, posts, userid, birthday

Find:
Code:

        $emails .= iif($emails, ', ');
        $emails .= $userinfo['username'];

Below it add:
Code:

$posts = $userinfo[posts];
Find:
Code:

// Create Birthday Thread Hack
Below it add:
Code:

if ($posts>='1')
{

You can change the "1" in the code above to whatever you want the minium posts for birthday threads to be


Find:
Code:

// End Create Birthday Thread Hack
Above it add:
Code:

}
If you also want to limit the birthday threads & emails to users who have visited the site within the time set in your admin panel for showing birthdays on forum home do this:

In birthday.php find:
Code:

$birthdays = $DB_site->query("
Above it add:
Code:

        if ($vboptions['birthdaydatecut'])
        {
                $datecut = TIMENOW - (intval($vboptions['birthdaydatecut']) * 86400);
                $activitycut = "AND lastactivity >= $datecut";
        }
        else
        {
                $activitycut = '';
        }

Find:
Code:

    (options & $_USEROPTIONS[adminemail]) AND
    usergroupid IN ($ids)
");

Replace it with:
Code:

        (options & $_USEROPTIONS[adminemail]) AND
        usergroupid IN ($ids) $activitycut
");


ChurchMedia 04-26-2004 01:57 AM

Quote:

Originally Posted by lasto
church media one request if possible - can this be set to ignore zero posters ?

Another way to do that (but not as much control) is to change:

Code:

$birthdays = $DB_site->query("
        SELECT username, email, languageid, birthday, userid
        FROM " . TABLE_PREFIX . "user
        WHERE birthday LIKE '$today-%' AND
        usergroupid IN ($ids)
");

to

Code:

$birthdays = $DB_site->query("
        SELECT username, email, languageid, birthday, userid
        FROM " . TABLE_PREFIX . "user
        WHERE birthday LIKE '$today-%' AND
        usergroupid IN ($ids) AND lastpost !=0
");

That would only select users that have posted. I haven't tested it, but it should work.

EvilLS1's version gives you a lot more options.

jp2 05-07-2004 03:55 PM

How do you turn it off??? :-S

ChurchMedia 05-07-2004 04:53 PM

Turn off what? The automatic email or the automatic thread?

jp2 05-09-2004 04:40 PM

The automatic thread.

ChurchMedia 05-09-2004 10:12 PM

Sure -- just put a \\ in front of all of the lines that relate to thread creation -- or delete everything that you hacked in.

jp2 05-10-2004 03:15 PM

Thanks! :)

jons5150 05-10-2004 09:21 PM

Parse error: parse error in /home/virtual/site1/fst/var/www/html/forums/includes/cron/birthday.php on line 86

<?php
/*================================================= =====================*\
|| ################################################## ################## ||
|| # vBulletin 3.0.1 - Licence Number XXXXXXXXXX
|| # ---------------------------------------------------------------- # ||
|| # Copyright ?2000?2004 Jelsoft Enterprises Ltd. All Rights Reserved. ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| ################################################## ################## ||
\*================================================ ======================*/

error_reporting(E_ALL & ~E_NOTICE);

if (!is_object($DB_site))
{
exit;
}

$today = date('m-d', TIMENOW);

$ids = '0';
foreach($usergroupcache AS $usergroupid => $usergroup)
{
if ($usergroup['genericoptions'] & SHOWBIRTHDAY)
{
$ids .= ",$usergroupid";
}
}

$birthdays = $DB_site->query("
SELECT username, email, languageid, birthday, userid
FROM " . TABLE_PREFIX . "user
WHERE birthday LIKE '$today-%' AND
(options & $_USEROPTIONS[adminemail]) AND
usergroupid IN ($ids)
");

vbmail_start();

while ($userinfo = $DB_site->fetch_array($birthdays))
{
$username = unhtmlspecialchars($userinfo['username']);
eval(fetch_email_phrases('birthday', $userinfo['languageid']));
vbmail($userinfo['email'], $subject, $message);
$emails .= iif($emails, ', ');
$emails .= $userinfo['username'];
$bday_people .= "<a href=\"member.php?u=".$userinfo['userid']."\">".$username."</a>, born ".$userinfo['birthday']."\n";
$bday_title .= $username.", ";


vbmail_end();

if ($emails)
{
log_cron_action('Birthday Email sent to: ' . $emails, $nextitem);
// Create Birthday Thread Hack
$birthday_greeting_thread = "Here are today's birthdays!<br><br>$bday_people";

$greeter=3; //Your User ID
$greeter_name="Jon"; //Your User Name
$greetings_forum=56; //enter the forum id that you want the thread to go into
$todays_date11= date("F j, Y", mktime (date("H")+$timeset, date("i"), date("s"), date("m"), date("d"), date("Y")));
$title3= "Happy Birthday to ";
$title3.= $bday_title;
$title3.= "on ";
$title3.=$todays_date11;
$DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,p ostusername,postuserid,lastpos ter,dateline,iconid,visible,attach) VALUES (NULL,'".addslashes(htmlspecialchars($title3))."', '".time()."','$greetings_forum','1','0','".addslas hes($greeter_name)."','$greeter','".addslashes($gr eeter_name)."','".time()."','0','1','0')");
$log_threadid=$DB_site->insert_id();
// Creating Post
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,pa getext,allowsmilie,showsignatu re,ipaddress,iconid,visible) VALUES (NULL,'$log_threadid','".addslashes(htmlspecialcha rs($title3))."','".addslashes($greeter_name)."','$ greeter','".time()."','".addslashes($birthday_gree ting_thread)."','1','0','127.0.0.1','0','1')");
// Updating Forum
$DB_site->query("UPDATE forum SET replycount=replycount+1,threadcount=threadcount+1, lastpost='".time()."',lastposter='".addslashes($gr eeter_name)."' WHERE forumid = $greetings_forum");
// Updating User's Post
$DB_site->query("UPDATE user SET posts=posts+1 WHERE userid=$greeter");
// End Create Birthday Thread Hack



/*================================================= =====================*\
|| ################################################## ##################
|| # Downloaded: 22:57, Sun May 2nd 2004
|| # CVS: $RCSfile: birthday.php,v $ - $Revision: 1.25 $
|| ################################################## ##################
\*================================================ ======================*/
?>

Onkel_Tom 06-03-2004 08:39 PM

@ Jons5150

You missed a } between the two lines
Code:

$bday_title .= $username.", ";


vbmail_end();

should be:
Code:

$bday_title .= $username.", ";
}

vbmail_end();


Onkel_Tom 06-03-2004 09:57 PM

What about Usergroups to exclude from Birthday thread ?
any idea how to do this ?

Rick 06-12-2004 03:53 AM

Nice hack.

I have it installed and working, but I am seeing all of the HTML code surrounding the birthday people. Does HTML have to be enabled in the forum for this to work properly?

Also, what do I need to do to change the subject of the thread. I have LOTS of members and having all of the user names in the subject line is way too much clutter.

Thank you.

Rick

ChurchMedia 06-16-2004 07:04 AM

Quote:

Originally Posted by Rick
Nice hack.

I have it installed and working, but I am seeing all of the HTML code surrounding the birthday people. Does HTML have to be enabled in the forum for this to work properly?

I guess so. The other option is to take out the HTML and forgo the links to their profiles. I think you could use /n for line breaks (???).

Quote:

Originally Posted by Rick
Also, what do I need to do to change the subject of the thread. I have LOTS of members and having all of the user names in the subject line is way too much clutter.

Thank you.

Rick

The easiest thing to do is replace:

$title3.= $bday_title;

with:

$title3.= "our members";

That would make the subject "Happy Birthday to our members on whateverdate".

Enjoy!

Rick 06-17-2004 11:04 PM

Thank you. That did it :D

stamos2003 06-21-2004 07:47 AM

works very fine here, thx. mate !

Onkel_Tom 06-21-2004 10:26 PM

Quote:

Originally Posted by lasto
church media one request if possible - can this be set to ignore zero posters ?
Quote:

Originally Posted by EvilLS1
Yep. I added that and a few other options to mine.

In birthday.php find:
Code:

$birthdays = $DB_site->query("
    SELECT username, email, languageid, birthday, userid

Replace it with:
Code:

$birthdays = $DB_site->query("
        SELECT username, email, languageid, posts, userid, birthday

Find:
Code:

        $emails .= iif($emails, ', ');
        $emails .= $userinfo['username'];

Below it add:
Code:

$posts = $userinfo[posts];
Find:
Code:

// Create Birthday Thread Hack
Below it add:
Code:

if ($posts>='1')
{

You can change the "1" in the code above to whatever you want the minium posts for birthday threads to be


Find:
Code:

// End Create Birthday Thread Hack
Above it add:
Code:

}
If you also want to limit the birthday threads & emails to users who have visited the site within the time set in your admin panel for showing birthdays on forum home do this:

In birthday.php find:
Code:

$birthdays = $DB_site->query("
Above it add:
Code:

        if ($vboptions['birthdaydatecut'])
        {
                $datecut = TIMENOW - (intval($vboptions['birthdaydatecut']) * 86400);
                $activitycut = "AND lastactivity >= $datecut";
        }
        else
        {
                $activitycut = '';
        }

Find:
Code:

    (options & $_USEROPTIONS[adminemail]) AND
    usergroupid IN ($ids)
");

Replace it with:
Code:

        (options & $_USEROPTIONS[adminemail]) AND
        usergroupid IN ($ids) $activitycut
");


This doesn't work for me.
If only users with zero posts has birthday on a day this addition works, but if other users with more than zero post has also birthday a greating thread is generated and also the zero posters are greated !

any idea?

Onkel_Tom 06-21-2004 10:46 PM

I fixed the problem with the following database query:
PHP Code:

$birthdays $DB_site->query("
    SELECT username, email, languageid, posts, userid, birthday
    FROM " 
TABLE_PREFIX "user
    WHERE birthday LIKE '
$today-%' AND
    (options & 
$_USEROPTIONS[adminemail]) AND
    usergroupid IN (
$ids) AND posts >20
"
); 


Blackbeard 06-28-2004 05:44 PM

iam having problems i have done the hack as in the download and today this was made as a post not as the screenie shows.
Also a side effect has happened, in my admin panel in forums and moderator the options in the controls ie edit, delete have disappeared but when i delete the post the options have reappeared.

this is how the post was displayed.

Dear Forum,<br><br>Here are today's birthdays!<br><br><a href="member.php?u=124">RUGGY</a>, born 06-28-1938
<a href="member.php?u=54">RONNIEBI</a>, born 06-28-1941

Any ideas

ChurchMedia 06-28-2004 06:08 PM

Looks like you need to turn on HTML for your birthday forum. Then the HTML code will disappear.

That second problem is a new one to me. Are you listing yourself as the poster?

Blackbeard 06-29-2004 02:12 PM

Sorted the first second one seems to have gone away strange

jluerken 07-19-2004 06:21 PM

Hi there,

the post is done very well in my 3.0.3er Version but the Thread does not get a title on the forumhome.

Take a look at my screen and you will see!

ChurchMedia 07-20-2004 05:19 AM

Quote:

Originally Posted by jluerken
Hi there,

the post is done very well in my 3.0.3er Version but the Thread does not get a title on the forumhome.

Take a look at my screen and you will see!


Hmmmm.... I'm running vB 3.0.0 and not having that problem. Double-check the code. See my screenshot from today.


(Edit)
Oh -- you said you're running 3.0.3 (you might want to update your profile). I'm not sure -- maybe that's the problem. I won't know until I upgrade to 3.0.3, which won't be for a couple of months....

jluerken 07-20-2004 05:48 AM

I checked the code (its not so much :D) and this is looking like yours!

ChurchMedia 07-20-2004 05:52 AM

Quote:

Originally Posted by jluerken
I checked the code (its not so much :D) and this is looking like yours!


Hmmmm..... I'm just not sure what the problem is, unless 3.0.3 handles something differently. Maybe someone familiar with 3.0.3 could help by looking at my code. Sorry!

Boofo 07-20-2004 08:37 AM

Quote:

Originally Posted by ChurchMedia
Hmmmm..... I'm just not sure what the problem is, unless 3.0.3 handles something differently. Maybe someone familiar with 3.0.3 could help by looking at my code. Sorry!

It's not updating the thread title or the link to the birthday thread with the last post icon. It is updating the last poster name fine, but not the other 2. It is pulling the infor from the last post made before the birthday cron job ran. Any idea what might be causing this?

ChurchMedia 07-20-2004 02:31 PM

Quote:

Originally Posted by Boofo
It's not updating the thread title or the link to the birthday thread with the last post icon. It is updating the last poster name fine, but not the other 2. It is pulling the infor from the last post made before the birthday cron job ran. Any idea what might be causing this?

That's strange. I never noticed it before, but you're right. For instance, last night it created a new birthday thread, but the title and link that shows up on the forum-home is for yesterday's birthday thread. Weird. Let me look into it and try to figure it out.

It seems to have the right title and link for new posts.... ???

Boofo 07-20-2004 06:55 PM

Quote:

Originally Posted by ChurchMedia
That's strange. I never noticed it before, but you're right. For instance, last night it created a new birthday thread, but the title and link that shows up on the forum-home is for yesterday's birthday thread. Weird. Let me look into it and try to figure it out.

It seems to have the right title and link for new posts.... ???

Yessir. Otherwise, it is normal. Just when it makes a birthday thread. Maybe the post query should be run before the thread query? ;)

Pitman 07-20-2004 07:35 PM

Quote:

Originally Posted by Boofo
Yessir. Otherwise, it is normal. Just when it makes a birthday thread. Maybe the post query should be run before the thread query? ;)

Yeah I noticed that when I first installed it, but it didn't really bother me because it usually doesn't stay the last post for long. But it changes the last poster's username but not the title ;x

Would be cool to get a fix to that though, thanks :)

ChurchMedia 07-20-2004 10:47 PM

Well, I tried switching the post and thread creation and it just creates an empty thread. I think the problem is with this line:

$log_threadid=$DB_site->insert_id();

I think the insert_id() function is no longer valid in vB3, so it enters a thread id that is NULL. So, it doesn't show up until the next day. Make sense?

Anyone know what the function insert_id() was replaced with?

jluerken 08-01-2004 10:53 AM

Quote:

Originally Posted by ChurchMedia
Well, I tried switching the post and thread creation and it just creates an empty thread. I think the problem is with this line:

$log_threadid=$DB_site->insert_id();

I think the insert_id() function is no longer valid in vB3, so it enters a thread id that is NULL. So, it doesn't show up until the next day. Make sense?

Anyone know what the function insert_id() was replaced with?

Any solutions so far?

ChurchMedia 08-01-2004 06:00 PM

Well, I've looked some code in newthread.php and I think I could re-write this hack to work correctly and streamline it a bit. I won't have time for a while, though (I've having surgery on Tuesday and will be out for a few weeks). I'll look back into it as soon as I can. :)

Thanks,

Boofo 08-07-2004 06:22 AM

Quote:

Originally Posted by ChurchMedia
Well, I've looked some code in newthread.php and I think I could re-write this hack to work correctly and streamline it a bit. I won't have time for a while, though (I've having surgery on Tuesday and will be out for a few weeks). I'll look back into it as soon as I can. :)

Thanks,

I think they are using verify_id now, like the following:

PHP Code:

$forumid verify_id('forum'$_REQUEST['forumid']); 


Bison 08-12-2004 12:28 AM

Can someone please make it so we don't have to turn on HTML in our forums?

ambrosious 08-21-2004 01:17 PM

Installed yesterday, this morning I got this,

PHP Code:

Dear Adult Barnyard,<br><br>Here are today's birthdays!<br><br><a href="member.php?u=954">Callisto</a>, born 08-21-0000 

Any ideas?

ChurchMedia 08-21-2004 06:41 PM

You have to turn on HTML for your birthday forum. That will fix it...

ambrosious 08-21-2004 07:29 PM

I can't find out where that is in CP, can you hint me?

ambrosious 08-21-2004 07:38 PM

I got it and it works beautifully!

ChurchMedia 08-21-2004 07:48 PM

In the forum manager -- then enable/disable features. See the screenshot.

ambrosious 08-21-2004 07:57 PM

Thanks! You rock!

duncan99 08-23-2004 04:04 PM

I use phrase in the birthday.php, when I test it by running cron, it works normally all the phrases show up properly, but when the cron runs in automatic mode, all phrases never show? whats the problem?

jugo 08-27-2004 12:28 PM

Quote:

Originally Posted by Bison
Can someone please make it so we don't have to turn on HTML in our forums?


OK...

I didn't want to enable HTML on my forums (for obvious reasons) so I used BBCode Instead to create the thread's post text.

***EDIT*** The BR Code works even if you do not have HTML enabled.

And it works just fine. :squareeyed: :nervous:

This is what my code looks like:

PHP Code:

    $bday_people .= "-->[url=member.php?u=".$userinfo['userid']."] ".$username."[/url], Age: ".$age."<br>"



All times are GMT. The time now is 04:17 AM.

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.01454 seconds
  • Memory Usage 1,868KB
  • 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
  • (28)bbcode_code_printable
  • (4)bbcode_php_printable
  • (15)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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