Back to vBulletin 3.5 Add-ons

Automatic Calendar Reminders
Mod Version: 1.0.3b, by Farcaster

This modification is in the archives.
vB Version: 3.5.4 Rating: (0 vote - 0 average) Installs: 7
Released: 26 Sep 2006 Last Update: 28 Sep 2006 Downloads: 13
Not Supported DB Changes Uses Plugins Template Edits Code Changes  

For 3.5.x version only.
For a 3.6.x version, go here

What does it do?

This hack allows your members to receive automatic reminders for all upcoming events in one or more calendars of their choice without having to request individual reminders for each event. In effect, this operates like a subscription to a calendar.

How does it work?

When opening a calendar, the user will be presented with an option just under the calendar title to subscribe or unsubscribe to the calendar. Members can request automatic reminders for all events on the calendar for one, two or three days in advance. Once per day, a digest of all upcoming events will be sent to the user advising them of upcoming events in the time frame they chose. (see attached screenshot)

Users can also unsubscribe from a calendar by going to the UserCP and Event Reminders section (see attached screenshot)

Example Email (uses the event reminder email template):
Dear Farcaster,

The following events are scheduled to begin soon at YOUR FORUM NAME.

Upcoming events:
************
Test Event 1 (In less than 23 hour(s))
http://YOUR_URL_HERE/calendar.php?do=getinfo&e=1
In Calendar: Calendar #1 Name
************
Test Event 3 (In less than 47 hour(s))
http://YOUR_URL_HERE/calendar.php?do=getinfo&e=3
In Calendar: Calendar #2 Name
************
Test Event 2 (In less than 47 hour(s))
http://YOUR_URL_HERE/calendar.php?do=getinfo&e=2
In Calendar: Calendar #3 Name

All the best,
YOUR FORUM NAME

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unsubscription information:

To unsubscribe from this email, please visit this page and delete any future reminders:
http://YOUR_URL_HERE/calendar.php?do=viewreminder
Upgrading from previous version:
You do not need to uninstall the previous version.

To upgrade from previous version to 1.0.3b:

1. Remove the Calendar Subscription cron job if it exists.
2. Delete the file includes/cron/calendar_reminder.php
3. Make the changes to the reminder.php file as specified in the instructions below.

Installation Instructions
- 1 XML upload
- 1 template modification
- 1 file edit

1. Use the Product Manager to import the product file product-rah_calendar_autoremind_1_0_3b.xml

3. Use the Style Manager to add the following code to the bottom of your CALENDAR_REMINDER template:
HTML Code:
<!-- calendar subscriptions table -->
<br />
<form action="calendar.php?do=dosubscriptions" method="post" name="unsubscribe">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="do" value="dosubscriptions" />
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
    <td class="tcat" colspan="3">
        Calendar Subscriptions
    </td>
</tr>
<if condition="$show['havesubscriptions']">
<tr>
    <td class="thead">
        Calendar
    </td>
    <td class="thead" nowrap="nowrap"><a href="$sorturl&order=asc&sort=reminder">$vbphrase[reminder]</a> $sortarrow[reminder]</td>
    <td class="thead" align="center"><input name="allbox" type="checkbox" value="Check All" title="$vbphrase[check_uncheck_all]" onclick="checkall(this.form);" /></td>
</tr>
$subscriptionbits
<tr>
    <td class="tfoot" colspan="5" align="$stylevar[right]"><div class="smallfont">
        $vbphrase[selected_events]
        <select name="what">
            <optgroup label="$vbphrase[delete_reminders]">
                <option value="delete">$vbphrase[delete]</option>
            </optgroup>                            
        </select>$gobutton
    </div></td>
</tr>
<else />
    <tr>
        <td class="alt1" align="center" colspan="5">
            <br />
            You have no calendar subscriptions.
            <br />
            <br />
        </td>
    </tr>
</if>
</table>
</form>
4. Open a copy of the includes/cron/reminder.php file and find the following:
PHP Code:
AND event.visible 
"); 
Replace with the following:
PHP Code:
AND event.visible 
".$calendar_subscription); 
Above that, near the top of the reminder.php file, find:
PHP Code:
$eventlist = array(); 
$eventcache = array(); 
$userinfo = array(); 
Below that add:
PHP Code:
$dsq $vbulletin->db->query_read(
        SELECT     * 
        FROM     " 
TABLE_PREFIX "datastore 
        WHERE     title = 'lastautoremind' 
"
); 
$ds $vbulletin->db->fetch_array($dsq); 

$daynumber round($timenow/86400); 

    if (
$ds['data'] < $daynumber) {
        
build_datastore('lastautoremind',$daynumber);

        
$calendar_subscription "UNION ALL
        SELECT event.eventid, event.title, recurring, recuroption, dateline_from, dateline_to, IF (dateline_to = 0, 1, 0) AS singleday,
            dateline_from AS dateline_from_user, dateline_to AS dateline_to_user, utc, recurring, recuroption, event.calendarid,
            subscribecalendar.userid, 0 as lastreminder, 0 as subscribeeventid, subscribecalendar.reminder,
            user.email, user.languageid, user.usergroupid, user.username, user.timezoneoffset, IF(user.options & 128, 1, 0) AS dstonoff,
            calendar.title AS calendar_title
        FROM " 
TABLE_PREFIX "event AS event
        INNER JOIN " 
TABLE_PREFIX "subscribecalendar AS subscribecalendar ON (subscribecalendar.calendarid = event.calendarid)
        INNER JOIN " 
TABLE_PREFIX "user AS user ON (user.userid = subscribecalendar.userid)
        LEFT JOIN " 
TABLE_PREFIX "calendar AS calendar ON (event.calendarid = calendar.calendarid)
        WHERE ((dateline_to >= 
$beginday AND dateline_from < $endday) OR (dateline_to = 0 AND dateline_from >= $beginday AND dateline_from <= $endday ))
            AND event.visible = 1"
;
    } 
(Note: If a user chooses to receive a reminder 3 days in advance, they will receive a daily reminder on each day from the 3 days out to 1 day out)

And, that's it. I hope you enjoy. Please click "" if you use this hack.

I have not tested this with 3.6.1 yet, but there shouldn't be any reason it won't work with it.

Revision History
Version 1.0.2b - Initial Release for version 3.5.x forums
Version 1.0.3b - Removed calendar_reminder.php and merged email code with existing reminder.php.

This version WILL NOT work with 3.6.x. For a 3.6.x version, go here.

Download

This modification is archived and cannot be downloaded.

Screenshots

     

Similar Mods

Calendar Enhancements Automatic Calendar Reminders vBulletin 3.6 Add-ons

vblts.ru supports vBulletin®, 2022-2024