decompiled

The life and times of Jonathan Kern

WPListCal

WPListCal

Current Stable Version: 1.3.5
Current Development Version: None
Requires WP Version: 2.7
Tested up to WP Version: 3.0-alpha

Download Stable Release

Installation | Usage | FAQ | Changelog | Comments

WPListCal allows you to list upcoming events on your blog in a list or table format.  It plugs straight into the Wordpress admin pages to let you keep track of events just like posts and pages.  You can then list events on a page or post using a shortcode, show events in your sidebar with a widget, or incorporate events into your theme files using a PHP function call.

Documentation and Bugs

Looking for information on how to install and use WPListCal? Did you find a bug in the plugin? Visit the WPListCal Development Site. Please don’t comment on this page for bug reports or feature requests. I won’t accept them here.

Version Guide

WordPress 2.7 or later → Use WPListCal 1.3.5 (current stable release)
WordPress 2.5-2.6.3 → Use WPListCal 1.0.8.2
WordPress 2.0.3-2.3.3 → Use WPListCal 1.0.2

The Future

Through the comments below, I’ve gotten lots of feature requests and bug reports and I appreciate them. I’ll continue development on WPListCal whenever I have time.

On many occasions, I’ve said that version 1.1 will bring support for categories and some other interesting features. I’ve decided to push those features off to 2.0 since the switch to WordPress 2.7 is becoming more than just a sub-point release. Don’t worry though, you don’t have to wait for 1.3-1.9 before I do 2.0…I’ll probably just skip a bunch. This versioning scheme just made more sense than rev’ing the 1.0 tree over and over

Feature Requests

Here is a list of current feature requests that I’ve gotten (and that I remember). Post comments if you have more.

Contributing

Many people have tried to provide code modifications in the comments section below. Sadly, WordPress doesn’t like this much and generally garbles code in comments. If you have a patch that you’d like to submit, please either upload a zip file of it somewhere and link to it, or use pastie and I’ll try to grab it before it expires. Generally, I won’t approve comments with modifications in them since I don’t want to provide support for mod’d versions of WPListCal. That said, if your modification provides significant value and is complete, I’ll seriously consider putting it into the plugin.

Installation

  1. Upload the wplistcal folder to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress

Upgrade

  1. DO NOT DEACTIVATE THE PREVIOUS VERSION OF THE PLUGIN! Doing so could remove all your events.
  2. Upload the wplistcal folder to the /wp-content/plugins/ directory
  3. Deactivate and then activate the plugin in the ‘Plugins’ menu in WordPress

Usage

  1. Change the default settings on the WPListCal options page
  2. If you want to list your events on a page or post, use the [wplistcal] shortcode. Use the parameters in the example below. Leave out parameters to default to the options defined in the WPListCal settings page. (1.2 or later only)
    • Example: [wplistcal display_mode="list" event_format="%NAME%" date_format="M j, Y g:ia" max_events="-1" show_past_events="false" advance_days="-1" event_order="asc" hide_same_date="true" date2_time_format="g:ia" no_events_msg="No events!"]
  3. If you want to list your events on a page or post, insert the tag <!--wplistcal--> in the body of the page/post
  4. If you want to list your events somewhere in your theme files, insert <?php echo wplc_show_events(); ?>. You can set special parameters to overwrite the default options if you use the PHP function call. All parameters are optional, but you must preserve the ordering by passing in `null` for options that you want to use defaults for.
    • Display Mode (string): 'list' or 'table'
    • Event Format (string): The format of the list entries if Display Mode is set to 'list'. You can use the following variables: %NAME%, %LINK%, %LINKEDNAME%, %START%, %END%, %DESCRIPTION%, %AUTHOR%, and %EXPORTURL%.
    • Date Format (string): The format to display the start and end date and time. Uses the same date formatting that Wordpress uses.
    • Max. Events (int): The maximum number of events to display, -1 for unlimited.
    • Show Past Events (boolean): true to show all events, false to show only current and future events
    • Maximum Advanced Notice (int): How many days in advance to display events, -1 for unlimited.
    • Event Order (string): ‘asc’ to show the closest event first or ‘desc’ to show the furthest event first.
    • Hide Same Date (boolean): Format the end date with the format string defined in the next parameter if it is on the same day as the start date.
    • Date 2 Time Format (string): If Hide Same Date is enabled, use this format string for the end date.
    • No Events Message (string): If there are no events, show this string instead, leave blank for none.
    • Example: <?php echo wplc_show_events('list', '%LINKEDNAME%: %START% - %END%{
      %DESCRIPTION%} <a href="%EXPORTURL%">(export)</a>', 'M j, Y g:ia', -1, false, 30, 'asc', true, 'g:ia', 'Sorry, no events'); ?>

Dependent Statements (1.2 or later only)

You can make a statement dependent on the existence of a variable by wrapping it in curly brackets. By default, the statement will only print if the first variable in the statement is not empty. You cannot have nested dependent statements.

Example 1:

The statement in the curly brackets won’t print if %LOCATION% is empty

%TITLE%{ at %LOCATION%} on %START%

Example 2:

To print a literal curly bracket, escape it with ‘^’

%NAME%{ at %LOCATION} ^{new^}

Example 3:

To skip a variable when determining the dependent variable, escape its ‘%’ characters with ‘^’. This method also works to print a literal ‘%’ inside a dependent statement. In this example, the statement in the curly brackets will print if %LOCATION% is not empty. Note that %AUTHOR% will be properly substituted even though it is escaped.

%NAME%{ hosted by ^%AUTHOR^% at %LOCATION%}

Example 4: (invalid)

This example is invalid. You cannot have nested dependent statements.

%NAME%{ at %LOCATION%{ on %START%}}

Example 5:

However, you can have multiple dependent statements in a format.

%NAME%{ hosted by %AUTHOR%}{ at %LOCATION} on %START%

Example 6:

You can also make a statement dependent on a variable without printing the variable. To do so, wrap the variable name in square brackets “[]“. You can escape the square brackets with ‘^’. In this example, the “more” link will only print if there is a description:

%NAME%{[%DESCRIPTION%] <a href="#">more</a>}

Frequently Asked Questions

Where does WPListCal store events?
On activation time, the plugin adds a table called <prefix>_wplistcal that stores all your events.
What happens to my events when I deactivate the plugin?
On deactivation, the events table is dropped, so if you want to save your event data, back up the table before deactivating the plugin.
As of version 1.0.6, deactivation does nothing to your settings and events.
Why is WPListCal different from other Wordpress calendar plugins?
WPListCal is specialized to provide clean list or table based output for you to style or reparse any way you’d like. Other calendar plugins force you to use a gregorian calendar view which may be inappropriate for many applications.
Why do some of my events show N/A for author and create date?
Events created before upgrading to version 1.1 did not have those values set, therefore WPListCal marks them as N/A.
I am unable to make events that start or end past January 19, 2038 at 3:14:08am
This is a known bug in PHP (id# 44209) and was fixed in version 5.2.6. The specific issue was that strtotime() did not support 64-bit timestamps.
Does WPListCal use any 3rd party libraries?
Yes, WPListCal is packaged with iCalcreator which is released under the GNU LGPL
My event times are all wrong after upgrading to WordPress 2.9.
Go to WordPress General settings and reset your timezone to a city rather than a manual UTC offset.
I love WPListCal, but I’d like it to do _______.
Great, I’m glad to hear feature requests. Just post a comment below.
I love WPListCal and I’d like to buy you a beer to thank you.
Awesome, thanks. Just click the big orange Donate button above

Changelog

1.3.5

1.3.4

1.3.3

1.3.2

1.3.1

1.3

1.2.2

1.2.1

1.2

1.1.1

1.1

1.0.8.2

1.0.8.1

1.0.8

1.0.7

1.0.6

1.0.5

1.0.4

1.0.3

1.0.2

1.0.1

1.0

  1. jsherk says:

    Just a heads up, but your graphic mail page is down…
    http://www.jonathankern.com/code/graphicmail/

  2. jsherk says:

    I am currently using a plugin called Post Notification which sends out emails to subscribers everytime a new post is published. Has anybody seen a plugin that does the same thing for WPListCal? SInce wplc stores events in it’s own table, and not in the main table where regular posts are stored, Post Notification won’t do anything with the event.

    I’ll probably end up hacking Post Notification to make it work with wplc, but if anybody has already done that it would save some time.

    Thanks

  3. Daniele says:

    I think a “preview for date xx/xx/xxx” may be very useful when events are shown on weekly basis, day by day. (show 8 items in advance until expire)
    Excellent Job !!!

  4. jsherk says:

    I have made a mod to wplistcal that allows you the option to not only save your event normally, but also to save your event as a regular post in the category of your choice. Why would I do this? Because I use the Post Notification plugin, which sends out an email whenever a new post is published, but WPListCal saves it’s events in it’s own table in the database, and not as a regular post, so Post Notification can’t send it out!

    There are 3 sections of code that need to be inserted into the wplistcals admin.inc.php file:

    First one goes at the top of the file, just after the comments but before the first line of code:

    //
    //MOD by jsherk - 1 of 3 - Save Event as Post

    //Get the $_POST varibables that were sent
    $wplc_save_post_in_category = $_POST['savepostincategory']; //Was 'Save and Post in Category' clicked?
    $wplc_save_category = $_POST['savecategory']; //Which category was chosen (this is the Category ID number)?
    $wplc_save_post_type = $_POST['saveposttype']; //What post type was chosen (publish, private or draft)?

    //Make sure variables are not null
    if (empty($wplc_save_post_in_category)) {
    $wplc_save_post_in_category ='';
    }
    if (empty($wplc_save_category)) {
    $wplc_save_category ='';
    }
    if (empty($wplc_save_post_type)) {
    $wplc_save_post_type ='';
    }

    //Was the 'Save and Post to Category' button clicked? If yes then set it to TRUE.
    if ($wplc_save_post_in_category !== '') {
    $wplc_save_post_in_category = true;
    } else {
    $wplc_save_post_in_category = false;
    }

    //end MOD
    //

    The second one goes in the wplc_show_event_form function.
    Immediately after these lines…

    <input type="submit" name="save" id="save-post" value="" tabindex="17" class="button-primary" />

    …insert this code:



    <input type="submit" name="savepostincategory" id="save-post-in-category" value="" tabindex="18" class="button" />
    What's this?

      Category:

    false, 'orderby'=>'id') );
    foreach ($wplc_save_categories_list as $id=>$wplc_save_category_list) {
    echo 'cat_ID.'">'.$wplc_save_category_list->cat_name.'';
    }
    ?>


      Post Type:

    Public (published)
    Private (published)
    Draft (unpublished)



    The third goes in the wplc_process_event function.
    Immediately after these line…

    else {
    $update = "UPDATE ".$tbl_name.
    " SET event_name='".$wpdb->escape($name)."',".
    "event_link='".$wpdb->escape($link)."',".
    "event_loc='".$wpdb->escape($location)."',".
    "event_desc='".$wpdb->escape($description)."',".
    "event_start_time='".$wpdb->escape($start)."',".
    "event_end_time='".$wpdb->escape($end)."',".
    "event_allday=".$wpdb->escape($allday ? '1' : '0').",".
    "event_modified_time='".$wpdb->escape($create_mod_time)."' ".
    "WHERE id=".$wpdb->escape($postvars['id']);
    $results = $wpdb->query($update);
    }

    …insert these lines:

    //
    //MOD by jsherk - 3 of 3 - Save Event as Post

    //Get the variables from outside this function
    global $wplc_save_post_in_category, $wplc_save_category, $wplc_save_post_type;

    if ($wplc_save_post_in_category) {

    //Setup the data needed to insert the information into the db as a post
    $wplc_save_post_data = array();

    //Post Status = publish or private or draft
    $wplc_save_post_data['post_status'] = $wplc_save_post_type;

    //This is the Category ID number, and must in an array even if only one category is supplied
    $wplc_save_post_data['post_category'] = array($wplc_save_category);

    //Post Title
    $wplc_save_post_data['post_title'] = $name;

    //Start filling in the Post Content
    $wplc_save_post_data['post_content'] = '';

    //If a location was specified then include it
    if (!empty($location)) {
    $wplc_save_post_data['post_content'] .= "Location: ".$location."\n";
    }

    //If a link was specified then include it
    if (!empty($link)) {
    $wplc_save_post_data['post_content'] .= "Link: ".$link."\n";
    }

    //Make the start and end dates readable
    $wplc_save_post_data['post_content'] .= "Start: ".date('F j, Y \a\t g:ia',$start)."\n";
    $wplc_save_post_data['post_content'] .= "End: ".date('F j, Y \a\t g:ia',$end)."\n";

    //If a description was specified then include it
    if (!empty($description)) {
    $wplc_save_post_data['post_content'] .= "Description:\n".$description."\n";
    }

    //Insert it as a Post, and get the new ID
    $wplc_save_post_insert_id = wp_insert_post($wplc_save_post_data);

    }

    //end MOD
    //

    I hope somebody finds this useful… maybe it will be a standard feature in the next release… no credit to me is required… just use it if you want!

  5. jsherk says:

    PROBLEM: There is a problem with the mods I submitted above… any html code was stripped out, so the mod will NOT work as posted.

    If Johnathan wants me to send him the mod, please email me!

    If anybody else is interested, post a comment here with your email and I’ll send it to you.

  6. kochi says:

    Hi Jonathan,

    I really like this plugin, however I have a small problem …

    I can’t access the “settings” page. it keeps me getting a “Cannot load wplc-options.” error (actually there’s no link to the wpcal settings under WP setting menu too) …

    Maybe you have a clue ?

    yours,
    kochi

  7. Oleroo says:

    Is there a way of splitting the up coming events with the past events? I want to list them both separately.

    • Jonathan says:

      Yes. Just use the PHP function call in your theme files or get a plugin that lets you embed PHP directly into a post or page. The syntax is described above. For one of your lists, you can choose the appropriate settings in the options area and use the tag (<!–wplistcal–>) or the widget.

      • Mike says:

        I am also trying to have two lists. One with future events, one with past events. Using the PHP function call (or the shortcode) I am only able to display one list with future events and one with future and past. There is no way to show a list with only past (without future). Am I missing something?

  8. I would love the category option to be implemented and a way to call wplc_show_events based on category with it’s own options. For instance we run a poker league and there are two divisions. US/CAN and Europe. We would like to display the events on their respective sections of wordpress as well as display the date in the proper format mm/dd/yyyy and dd/mm/yyyy

    Thanks!!!

  9. George says:

    I’m trying to utilize wplistcal. I can activate it, but when I try click on “Settings” from the plugin page I get a page listing this error: “Cannot load wplc-options.” Any ideas?

  10. Jonathan says:

    FYI: I’m not dead. WPListCal 1.2 is now feature-complete, so I’m just working out the bugs as I find time and hope to release it soon. Among the new features, 1.2 will fix the “Cannot load wplc-options.” issue that people were seeing.

  11. Viil says:

    Hi Jonathan, thanks for sharing a useful WP plugin with us :)
    I just started using the WPListCal, and one of the issues I found is that it seems to be using the server time stamp rather than the WP application time, so since my server is several time zones away WPListCal unlists events several hours before they actually are scheduled. This is rather inconvenient as I suspect people may be visiting my website in the hours before an event starts in order to check out time and place.

  12. Jonathan says:

    FYI: WPListCal 1.2 is available for testing. Click “Get Development Release” above to try 1.2. Please report bugs here. Thanks for your help!

  13. Jack says:

    Hi,
    greate plugin, however I have a small problem with polish letters like: ąśćńżź.
    Plugin cannot add new event if one of abowe letteris in events text.
    Thanks

  14. Barisko says:

    The plugin displays the time and date in the English language.

    I tried:
    setlocale(LC_ALL, ‘nl_NL.ISO-8859-15@euro’);
    echo wplc_show_events(‘list’, ‘%START%: %LINKEDNAME%‘, ‘j M Y, G:i’, 5, false, 30, ‘asc’, true, ‘g:ia’, ‘Sorry, no events’);

    But that did not work.
    Can you help?

  15. Jonathan says:

    WPListCal 1.2 released. Go install it and let me know if you find bugs. Enjoy!

  16. Jonathan,

    I just updated to the lastest version of your plugin and now events will not show up in my site. I have 2 valid events in my list and they do not show up. I have changed nothing else in my site. Can you give me any pointers of what could be going wrong with my install?

    I am running WP 2.7.1.

    Thanks in advance,

    Patrick

    PS – please ping me via email with any input you have.

  17. Jonathan says:

    Followed up with Patrick offline. Bug is fixed in 1.2.1. For those of you who were wondering, the issue was with event display when you use table display mode and no previously set event format. I also added a POT file for translation in case anyone was interested in localizing WPListCal. Enjoy!

    • Carol says:

      Hi Jonathon – I am experiencing the same issue as Patrick Garret. I have downloaded 1.2.1 and my current events are not appearing. I have the calendar set up for a list format. I really like the functionality and ease of use of your calendar and would really like to implement it. I’d appreciate your help. Thank you very much.

  18. David Decker says:

    Hi there! Thanx for the plugin which works wonderful! — I’m glad you added localisation but my question is how the .mo/.po files should be named? — I tried wplistcal-de_DE.mo / de_DE.mo and wplistcal.mo but none of this works. Can you help out? — Thanx and greetinx, Dave from Germany :-)

  19. Yin-Yin says:

    Hello!
    I’ve started to translate your plugin in French.
    But something goes wrong: the admin page and tne events page remains in english.
    Here’s below a link to download my job if you want to see the résult.
    Traduction Française de WPListcal
    Regards…

  20. Carol says:

    Hi Johnathon – just downloaded your plugin. I added an event, viewed the site and received this Warning: “htmlspecialchars_decode() expects parameter 1 to be string, NULL given” Any idea how to adjust this? Many thanks!

  21. Merlijn says:

    Hi Jonathan!

    Thanks a lot for this great plug in! I was wondering, is there any chance of having a feature in the future that will allow us to list events over different pages. For example, you have 50 events which will be listed over 5 pages with 10 events each, and next end previous links. Or is this a request similar or close to ‘Group events by day/month/year’ ?

    Anyways, thanks a lot for this great plug in, I’ve tried out a lot of calendar plug ins, this one is really nice and clean, makes me so happy i bought you a beer :D !

    Merlijn

  22. jsherk says:

    Just a heads up again, but your graphic mail page is still down with a php WARNING message:
    Warning: imagepng() [function.imagepng]: Unable to open ‘/home/xxxxxx/public_html/blog/wp-content/uploads/graphicmail/xxxxxxxxxxxxxxxxc03e6c713f97b.png’ for writing: No such file or directory in /home/xxxxxx/jonathankern.com/wp-content/plugins/graphicmail/graphicmail.php on line 145
    /home/xxxxxx/public_html/blog/wp-content/uploads/graphicmail/xxxxxxxxxxxxxxxxxxx3e6c713f97b.png

    http://www.jonathankern.com/code/graphicmail/

  23. Marcus says:

    When I add new Event and click Save it will double or triple post. Then I have to delete one or two post? Any suggestion to solve this?

  24. Hello Jonathon. I am anxious to use your calendar! I have added a valid event but it does not appear. I am using version 1.2.1
    Any advice would be helpful. Thank you.

  25. Melvin Rivera says:

    wondering if u are working on a version that will support multiple sidebars. i am working on a site that has 12 different sidebars and would like to have the calendar on a few of them. i believe wordpress 2.8 will offer this for developers. any chance u are working on it?

Have your say



XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

If you want literal < and/or >, use &lt; and &gt; instead.