Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Beta Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
New Thread on Calendar Event Details »»
New Thread on Calendar Event
Version: 1.00, by Colin F Colin F is offline
Developer Last Online: Apr 2014 Show Printable Version Email this Page

Version: 3.0.3 Rating:
Released: 07-10-2004 Last Update: Never Installs: 19
Re-useable Code Translations Is in Beta Stage  
No support by the author.

New Thread on Calendar Event

What it does:
This rather small hack is easy: it starts a new thread in a specific forum for every Event that is posted in the calendar. On our forum it is used for discussion of partys (as it's a party calendar).

Is it complicated?
There is actually very little to change, but in that small part, there are a lot of variables to be edited which are forum specific. That might make it a bit hard for php newlings

Changes:
New files (0):
none

Changed files(1):
calendar.php

New database fields/tables(0):
none

New templates(0):
none

Changed templates(0):
none

New phrases(0):
none


Screenshots:
No visible changes

Instructions:
  • Backup all your forum files as well as your database
  • Copy the following code into your favorite PHP editing program (Dreamweaver, Wordpad, Notepad...) and edit it to fit your forums.
    PHP Code:
    $forumid 1// forumid in which to post
    $botuserid 1//userid of poster
    $botusername "EventBot"// username of poster

    $dateformat "m-d-y";
    $threadtitle "[".vbdate($dateformat$dateline_from,false,true,false,true)."] ".$title;
    $postmessage "This is an automatically generated thread for the event [b]".$title."[/b].
    More information on this event is available on [url="
    .$vboptions['bburl']."/calendar.php?".$session[sessionurl]."do=getinfo&e=".$eventid."&day=".vbdate("Y-n-j",TIMENOW,false,true,false,true)."&c=".$calendarid."]this page[/url].";
    $iconid 0;
                
    $DB_site->query("INSERT INTO " TABLE_PREFIX "thread
    (title, lastpost, forumid, open, replycount, postusername, postuserid, lastposter, dateline, iconid, visible)
    VALUES ('" 
    addslashes($threadtitle) . "', " TIMENOW ", $forumid, 1, 0, '$botusername', $botuserid, '$botusername', " TIMENOW ", $iconid, 1)
    "
    );
    $threadid $DB_site->insert_id();
                
    $DB_site->query("INSERT INTO " TABLE_PREFIX "post
    (threadid, parentid, title, username, userid, dateline, pagetext, allowsmilie, showsignature, ipaddress, iconid, visible)
    VALUES (
    $threadid, 0, '" addslashes($threadtitle) . "', '$botusername', $botuserid, " TIMENOW ", '" addslashes($postmessage) . "', 1, 0, 0, $iconid, 1)
    "
    );
    $firstpostid $DB_site->insert_id();

    $DB_site->query("UPDATE " TABLE_PREFIX "thread
    SET firstpostid = 
    $firstpostid
    WHERE threadid = 
    $threadid
    "
    );
                
    $DB_site->query("
    UPDATE " 
    TABLE_PREFIX "forum
    SET replycount = replycount +  1,
    threadcount = threadcount + 1,
    lastpost = " 
    TIMENOW ",
    lastposter = 
    $botusername,
    lastthread = '" 
    addslashes($threadtitle) . "',
    lastthreadid = 
    $threadid,
    lasticonid = 
    $iconid
    WHERE forumid = 
    $forumid
    "
    ); 
    The variables to be edited (marked green) are:
    • forumid is the forumid of the forum in which the Bot will be posting the threads to the calendar events
    • botuserid is the userid of the user that will be shown as the author of the thread. I suggest making a special user and naming him something like EventBot
    • botusername is the username of the user that will be shown as the author of the thread. Should be the username to the userid indicated in botuserid. Make sure the username is enclosed in quotation marks ("").
  • Open your calendar.php and look for
    PHP Code:
    if ($calendarinfo['neweventemail']) 
  • Above that add the code you just edited.

Show Your Support

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

Comments
  #62  
Old 05-27-2005, 12:33 PM
Torqued Torqued is offline
 
Join Date: Oct 2004
Location: Houston, TX
Posts: 180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by HeloHi
I am getting this error too. Anyone else run into this problem and figured out what is wrong with it?
which version of the code did you install?

There are about 3 different versions in this thread.
Reply With Quote
  #63  
Old 05-28-2005, 01:36 AM
HeloHi's Avatar
HeloHi HeloHi is offline
 
Join Date: Feb 2005
Posts: 42
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Torqued
which version of the code did you install?

There are about 3 different versions in this thread.

I used Collin's original code, but modified to user usernames etc ect rather than bots. I also used the rolling 24 hour method rather than the midnight-midnight method. I will try KirbyDE's method and report back on how that works. I should have done that in the first place, I just got ahead of myself I guess when the error popped up hehe.

Edit: Tried Kirby's code and it doesn't create a thread. Is it just code to replace Collin's completely, or is it supposed to be added in somewhere? I am sorry for my noobness, but I really don't know alot about this stuff. I don't think I am the only one who had this problem though...

Quote:
Originally Posted by YLP1
Newbie here...... Where would KirbeDEs code go and is his code in addition to Colin's?
I am going to integrate your checkbox hack as well, Torqued, whenever I can straighten this out. Maybe someone who has this working could just put the hacked code from their calander.php here?
Reply With Quote
  #64  
Old 05-31-2005, 09:35 AM
mfarmerhi mfarmerhi is offline
 
Join Date: Apr 2003
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Beautiful, Colin. And big thanks to Torqued for compiling everything and printing exact instructions for adding the check box option (EXACTLY what I was looking for).

Installed.

*** Edited additional question***

Been testing it. Question: What does this hack do with re-occurring events? Still only initiate one thread (the very first time you post the event), then never again, despite the fact the event reoccurs?

Because the only one extra thing I'd REALLY want:

the ability to make this only post the new thread on the actual date of the event.

That is, say you have an event on July 4th. I'd like the hack to allow me to enter a calendar event for the 4th, and then *only when it get's to the 4th* post that event.

Re-occurring events would initiate a new thread every time the event reoccurred.

Any easy way to make it do that?
Reply With Quote
  #65  
Old 05-31-2005, 02:17 PM
SamirDarji SamirDarji is offline
 
Join Date: Apr 2004
Posts: 645
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by mfarmerhi
Been testing it. Question: What does this hack do with re-occurring events? Still only initiate one thread (the very first time you post the event), then never again, despite the fact the event reoccurs?

Because the only one extra thing I'd REALLY want:

the ability to make this only post the new thread on the actual date of the event.

That is, say you have an event on July 4th. I'd like the hack to allow me to enter a calendar event for the 4th, and then *only when it get's to the 4th* post that event.

Re-occurring events would initiate a new thread every time the event reoccurred.

Any easy way to make it do that?
It's interesting that you bring up recurring events. A similar suggestion was posted for the Event Attendance hack. The problem is in how vb treats recurring events.

Recurring events seem to be the same as a regular event in the db, but with some sort of flag that allows it to show up multiple times. But with it actually being a single entry, everything associated with that event is stored only once including any hacks applied to the event listing. I don't really see any way to do it without having something to track the various dates of a recurring event or for recurring events to be re-designed so that they actually populate the calendar with multiple event listings that can be changed individually or as a whole.
Reply With Quote
  #66  
Old 05-31-2005, 05:29 PM
Torqued Torqued is offline
 
Join Date: Oct 2004
Location: Houston, TX
Posts: 180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by SamirDarji
It's interesting that you bring up recurring events. A similar suggestion was posted for the Event Attendance hack. The problem is in how vb treats recurring events.

Recurring events seem to be the same as a regular event in the db, but with some sort of flag that allows it to show up multiple times. But with it actually being a single entry, everything associated with that event is stored only once including any hacks applied to the event listing. I don't really see any way to do it without having something to track the various dates of a recurring event or for recurring events to be re-designed so that they actually populate the calendar with multiple event listings that can be changed individually or as a whole.
One way I can think of around that is to run a daily query/script that looks for events scheduled for that day and then have that process create new threads for those events.
Reply With Quote
  #67  
Old 05-31-2005, 07:18 PM
SamirDarji SamirDarji is offline
 
Join Date: Apr 2004
Posts: 645
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Torqued
One way I can think of around that is to run a daily query/script that looks for events scheduled for that day and then have that process create new threads for those events.
Actually, what would be even better is a cron that looks at the recurring events list and then makes and event entry for a particular day if one isn't present. Then any hacks related to that particular entry would work fine. The only disadvantage is that once an event listing is created this way, changing the recurring event listing won't change the spawned event listing.
Reply With Quote
  #68  
Old 05-31-2005, 08:35 PM
mfarmerhi mfarmerhi is offline
 
Join Date: Apr 2003
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by SamirDarji
Actually, what would be even better is a cron that looks at the recurring events list and then makes and event entry for a particular day if one isn't present. Then any hacks related to that particular entry would work fine. The only disadvantage is that once an event listing is created this way, changing the recurring event listing won't change the spawned event listing.
I am NOT educated in PHP, but isn't it possible to somehow just attach the date to event listings? I mean, that coding is already in there... can't the variable {event} be distinguished from the variable {event[today's_date]} ?
Reply With Quote
  #69  
Old 05-31-2005, 10:54 PM
SamirDarji SamirDarji is offline
 
Join Date: Apr 2004
Posts: 645
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by mfarmerhi
I am NOT educated in PHP, but isn't it possible to somehow just attach the date to event listings? I mean, that coding is already in there... can't the variable {event} be distinguished from the variable {event[today's_date]} ?
Probably, but then what do you do for recurring events?
Reply With Quote
  #70  
Old 06-02-2005, 01:51 AM
mfarmerhi mfarmerhi is offline
 
Join Date: Apr 2003
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by SamirDarji
Probably, but then what do you do for recurring events?
Well, store that new variable, so that it's reoccurring event[5.30.05]; next months is event[6.30.05]... you can suddenly treat them (at least each of those variables) as separate events, although, for the sake of the rest of vB, they're treated as a single event.

The cron job actually sounds promising for both of the features I'd need -- actually starting the thread on the day it's scheduled (instead of simply when you enter the data on the calendar. I mean, if you're already typing in the info, why not just copy and paste it yourself into a new thread? As it stands, this hack isn't really saving you much but 2 or 3 extra mouse clicks...).

By treating each of the reoccurring events as a separate event (even if only as a separate data item) and using the cron jobs, it's open up a whole LOT of new possibilities for this hack...
Reply With Quote
  #71  
Old 06-02-2005, 04:19 AM
SamirDarji SamirDarji is offline
 
Join Date: Apr 2004
Posts: 645
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Not a bad idea. I'm sure it would also help those of us that use the Event Attendance hack that are needing something for the recurring events.
Reply With Quote
Reply


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 02:57 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.04787 seconds
  • Memory Usage 2,344KB
  • Queries Executed 25 (?)
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
  • (2)bbcode_php
  • (9)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete