Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Beta Releases

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
  #22  
Old 07-30-2004, 06:08 PM
PUPSTAHS PUPSTAHS is offline
 
Join Date: Jul 2004
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by obsidian
I do the ranged event it comes up correctly. I guess when it gets the single all day event it starts the previous day plus how ever many hours. Anyways anyone have an idea on a simple fix for it
I'm having the same problem. Links to all day events always link to the day *before* the event starts, but ranged events work fine.

Anyone got a fix?

BTW great hack colin
Reply With Quote
  #23  
Old 08-09-2004, 07:35 PM
PUPSTAHS PUPSTAHS is offline
 
Join Date: Jul 2004
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So, is anyone working on a fix for the all-day-event bug mentioned above? It would be very much appreciated by at least several users.
Reply With Quote
  #24  
Old 08-10-2004, 04:08 AM
Colin F's Avatar
Colin F Colin F is offline
 
Join Date: Jul 2004
Location: Switzerland
Posts: 1,551
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I assume this is because of the timezone settings of some users. As I'm in GMT+1, I don't have any problems with this.

I'll have a look at it tonight though...
Reply With Quote
  #25  
Old 08-10-2004, 07:08 PM
Colin F's Avatar
Colin F Colin F is offline
 
Join Date: Jul 2004
Location: Switzerland
Posts: 1,551
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've updated the first post with some info to (hopefully) fix the allday problem some users are having.

The changes are in the two calles to the function date(). These are now changed to vbdate() and some parameters were added.
Reply With Quote
  #26  
Old 08-20-2004, 08:34 AM
SamirDarji SamirDarji is offline
 
Join Date: Apr 2004
Posts: 645
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is exactly the type of hack I've been searching for. Well, all except one thing--I want the new thread to be displayed as part of the calendar event listing page. It doesn't sound too hard in theory, but you never know until you get into it. Thoughts anyone?
Reply With Quote
  #27  
Old 10-30-2004, 11:22 PM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am able to fix the problems on that one. Wish I could solve my problem with the other hack by the same author.
Reply With Quote
  #28  
Old 11-10-2004, 03:16 PM
Torqued Torqued is offline
 
Join Date: Oct 2004
Location: Houston, TX
Posts: 180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Colin F
Theoretically yes.

Try making $post[message] = $message;

Actually.. I want both. I want the $message text as well as an automated message @ the bottom of the post.. so how do I modify the code below to put a couple of blank lines between the $message and the "This is an automatically generated blah blah blah"

Quote:
$postmessage = $message."This is an automatically generated thread for the event ".$title.".
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=".$calendari d."]this page[ /url].";
Reply With Quote
  #29  
Old 11-10-2004, 03:24 PM
Colin F's Avatar
Colin F Colin F is offline
 
Join Date: Jul 2004
Location: Switzerland
Posts: 1,551
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Torqued
Actually.. I want both. I want the $message text as well as an automated message @ the bottom of the post.. so how do I modify the code below to put a couple of blank lines between the $message and the "This is an automatically generated blah blah blah"
Change this:
Code:
 $postmessage = $message."This is an automatically generated thread for the event ".$title.".
to this:
Code:
 $postmessage = $message."


This is an automatically generated thread for the event ".$title.".
Not sure if that works though.... you might also be able to use /n
Reply With Quote
  #30  
Old 11-10-2004, 03:34 PM
Lionel Lionel is offline
 
Join Date: Dec 2001
Location: Delray Beach, Florida
Posts: 3,277
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I used \n to insert a blank line
Reply With Quote
  #31  
Old 11-19-2004, 01:46 PM
obsidian's Avatar
obsidian obsidian is offline
 
Join Date: Apr 2003
Location: Austin Tx
Posts: 52
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there a way to move the forum jump dropdown into this and use it as a selection box for where to post the thread? Reason I ask is that I now have a couple calendars for different groups. I would like to be for the people to post their events on their private calendar and have this hack post the thread in their private forum.
Reply With Quote
Reply

Thread Tools

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 03:28 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.04676 seconds
  • Memory Usage 2,328KB
  • 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_code
  • (2)bbcode_php
  • (4)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