[EventCalendar] Re: 404 errors when not logged in.

blahalt blahalt at gmail.com
Wed Jan 11 02:04:51 UTC 2006


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..





More information about the EventCalendar mailing list