[EventCalendar] Hack/patch to wp-includes/classes.php for EC3.0.3 on WP2.0

Alex Tingle alex at firetree.net
Fri Jan 27 18:03:53 UTC 2006


Thanks very much for that hack Norman. Here's a slightly improved version. It uses the plugin's own mechanism for reading the option, to guarantee that it gets the correct result. It doesn't use a hard-coded table name. And it only requires ADDED lines, which should make it a bit easier to apply by hand for those of you stuck on Windows.

I'm still not running WP2, so can someone try this and let me know if they have any problems.

To apply on Unix, save the patch file into your 'wordpress' directory. 'cd' there, and type:

 patch -p0 < hack_for_eventcal3.0.patch

regards,

-Alex

--

On Wed, 11 Jan 2006 03:04:51 +0100
blahalt <blahalt at gmail.com> wrote:

> hi there,
> 
> i have tested the hack from Dr. Peter Troxler (thanks for the hint!)
> and it works for me!
> 
> - ec.3.0.3
> - wp.2.0
> - "events-are-normal-posts"
> 
> i only need to show "future"-posts from the event category, so i
> improve the hack from Dr. Troxler to show only these posts.
> 
> the hack is dirty, i know, but i can't wait for 3.1 :-) if you want
> to show all future-posts to users not logged in (not only posts belongs
> to event-category) the hack from Dr. Troxler should be fine for you.
> 
> 
> here's what to change:
> 
> in wp-includes/classes.php near line 664 replace:
> ----------------------------------------------------------------------------
> ------------------------
> if (mysql2date('U', $this->posts[0]->post_date_gmt) > mysql2date('U', $now))
> { //it's future dated
>  	$this->is_preview = true;
>  	if (!current_user_can('edit_post', $this->posts[0]->ID)) {
>  		$this->posts = array ( );
>  	}
> }
> ----------------------------------------------------------------------------
> ------------------------
> 
> with:
> ----------------------------------------------------------------------------
> ------------------------
> if (mysql2date('U', $this->posts[0]->post_date_gmt) > mysql2date('U', $now))
> { //it's future dated
> 	$this->is_preview = true;
> 	/* DIRTY FUTURE-POSTS HACK FOR EC3 */
> 	$ec3wp20hack_ec3cat = get_option('ec3_event_category');
> 	$ec3wp20hack_postid = $this->posts[0]->ID;
> 	$ec3wp20hack_postcat = $wpdb->get_var("SELECT category_id FROM
> `wp_post2cat` WHERE post_id = $ec3wp20hack_postid");
> 	if ((isset($ec3wp20hack_ec3cat)) AND ($ec3wp20hack_ec3cat !=
> $ec3wp20hack_postcat)) {
> 		$this->posts = array();
> 	}
> 	/* DIRTY FUTURE-POSTS HACK FOR EC3 */
> }
> ----------------------------------------------------------------------------
> ------------------------
> 
> thats all.. anybody has another hack?
> 
> ah.. backup your files & database and use it at your own risk..
> 
> 
> thanks a lot for one of the greatest wordpress plugins, Alex!!!!
> 
> 
> greetz! norman..
> 
> 
> 
> _______________________________________________
> EventCalendar mailing list
> EventCalendar at firetree.net
> http://penguin.firetree.net/cgi-bin/mailman/listinfo/eventcalendar


-- 
:: Let me solve your problems: http://www.firetree.net/consulting/
:: alex.tingle AT firetree.net  +44-7901-552763 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hack_for_eventcal3.0.patch
Type: application/octet-stream
Size: 792 bytes
Desc: not available
Url : http://penguin.firetree.net/pipermail/eventcalendar/attachments/20060127/5abd097f/hack_for_eventcal3.0.obj


More information about the EventCalendar mailing list