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)

jluerken 03-22-2004 07:01 AM

HTML Code:

$DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,postusername,postuserid,lastpos    ter,dateline,iconid,visible,attach) VALUES (NULL,'".addslashes(htmlspecialchars($title3))."','".time()."','$greetings_forum','1','0','".addslashes($greeter_name)."','$greeter','".addslashes($greeter_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,pagetext,allowsmilie,showsignatu    re,ipaddress,iconid,visible) VALUES (NULL,'$log_threadid','".addslashes(htmlspecialchars($title3))."','".addslashes($greeter_name)."','$greeter','".time()."','".addslashes($birthday_greeting_thread)."','1','0','127.0.0.1','0','1')");
// End Create Birthday Thread Hack

BE careful with these line if you're using table prefixes

then you have to change this:
HTML Code:

INSERT INTO thread to INSERT INTO yourprefix_thread
and this
HTML Code:

INSERT INTO post to INSERT INTO yourprefix_post
Maybe the author of this hack can change these lines to reflect installations which are using table prefixes :D

ChurchMedia 03-22-2004 07:13 AM

Quote:

Originally Posted by jluerken
Maybe the author of this hack can change these lines to reflect installations which are using table prefixes :D

Great idea! I added " . TABLE_PREFIX . " in the appropriate places. Thanks for the heads up.

:)

ryancooper 03-22-2004 12:35 PM

Strange, i ran the Happy Birthday email and got no errors but I had a birthday and gor a email :

Database error in vBulletin 3.0.0 Release Candidate 4:

Invalid SQL: INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,p ostusername,postuserid,lastpos ter,dateline,iconid,visible,attach) VALUES (NULL,'Happy Birthday to on March 21, 2004','1079867961','6','1','0','Happy Birthday','11064','Happy Birthday','1079867961','0','1','0')
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'ter,dateline,iconid,visible,attach) VALUES (NULL,'Happy Birthda

mysql error number: 1064

Any ideas what is wrong??

Thanks!

ChurchMedia 03-22-2004 02:34 PM

Be sure to change the user id,user name and forum id variables. If they don't exist you will get an error. Looks like you might have used example variables (from MK@spug.net). Let me know if you still have problems after changing these:

$greeter=1; //Your User ID
$greeter_name="Your User Name"; //Your User Name
$greetings_forum=1; //enter the forum id that you want the thread to go into

ryancooper 03-22-2004 06:13 PM

Quote:

Originally Posted by ChurchMedia
Be sure to change the user id,user name and forum id variables. If they don't exist you will get an error. Looks like you might have used example variables (from MK@spug.net). Let me know if you still have problems after changing these:

$greeter=1; //Your User ID
$greeter_name="Your User Name"; //Your User Name
$greetings_forum=1; //enter the forum id that you want the thread to go into


AAHHh YEs I didn;t read that closely enough. . . :nervous: Thanks for the reply!

ryan\

egyptsons 03-23-2004 07:51 PM

Quote:

Originally Posted by Vile
Very cool idea :)

;) nice work man

EvilLS1 04-25-2004 10:25 PM

To show the age (in years)...

In includes/cron/birthday.php find:
Code:

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

Below it add:
Code:

// Generate Age
               
                        if (!$year)
                        {
                                $year = vbdate('Y', TIMENOW, false, false);
                                $month = vbdate('n', TIMENOW, false, false);
                                $day = vbdate('j', TIMENOW, false, false);
                        }
                        if (empty($gotage["$userinfo[userid]"]))
                        {
                                $date = explode('-', $userinfo['birthday']);
                                if ($year > $date[2] AND $date[2] != '0000')
                                {
                                        $age = $year - $date[2];
                                        if ($month < $date[0] OR ($month == $date[0] AND $day < $date[1]))
                                        {
                                                $age--;
                                        }
                                        if ($age < 101)
                                        {
                                                $gotage["$userinfo[userid]"] = $age;
                                        }
                                        else
                                        {
                                                unset($age);
                                        }
                                }
                        }
                        else
                        {
                                $age = $gotage["$age[userid]"];
                        }
               
// end age

Find:
Code:

$bday_people .= "<a href=\"member.php?u=".$userinfo['userid']."\">".$username."</a>, born ".$userinfo['birthday']."\n";
Replace it with:
Code:

$bday_people .= "<a href=\"member.php?u=".$userinfo['userid']."\">".$username."</a>, Age: ".$age."\n";

ChurchMedia 04-25-2004 11:06 PM

Very cool! Thanks for that addition. Here's an addition to email the greeter when the thread is created (it will email the birthday greeting).


Find:
Code:

$greeter=1; //His User ID
The number (1) may be different.

Below that add:
Code:

$greetermail="youremail@yourdomain.com";
Change the email address to your own.

Find:
Code:

$DB_site->query("UPDATE user SET posts=posts+1 WHERE userid=$greeter");
Below that add:
Code:

// email the admin
$birthday_greeting_thread=strip_tags($birthday_greeting_thread);
vbmail_start();
vbmail($greetermail, $title3, $birthday_greeting_thread);
vbmail_end();


ChurchMedia 04-25-2004 11:18 PM

Here's an addition to give users store points for their birthday:

Find:
Code:

$bday_title .= $username.", ";
Below that add:
Code:

$DB_site->query("UPDATE user SET storep=storep+50 where userid='$userinfo[userid]'");
Be sure to change "storep" to the correct field for the store hack you are using. For the new uShop hack, look in your AdminCP to find out what to use there.

You can change the "50" to however many points you want to give for a birthday present. Be sure to mention the present in your birthday greeting. :)

lasto 04-25-2004 11:40 PM

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


All times are GMT. The time now is 10:21 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.01368 seconds
  • Memory Usage 1,759KB
  • 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
  • (10)bbcode_code_printable
  • (3)bbcode_html_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)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