[EventCalendar] Advanced mode in admin

Darren Brown darren at officialmerchandising.com
Fri May 2 10:33:53 UTC 2008


Hi

I have just upgraded event calendar  3.1.1.rc3 with wordpress 2.5.

I wish to keep event posts seperate from normal posts so i switched advanced mode on. However when doing this all the inactive posts disappeared in admin. My events are band listings and while the bands dont play on regularly reoccuring dates we do get the same bands playing again and again so accessing and updating past event posts makes updating easier.

Looking at the code shows advanced mode should be switched off in admin in filter_admin_head() (in admin.php), or ec3_action_admin_head() (in eventcalendar3.php). Some testing showed that both of these functions are called and switch off advanced mode, however they are not called until after ec3_filter_posts_where(), where the updated advanced mode variable is required to display the posts correctly. 

I do not know much about the hooks and plugin development for wordpress, but the following works as a quick fix:


insert the following into ec3_filter_posts_where() in eventcalendar3.php

  // Turn OFF advanced mode when we're in the admin screens.   
  if (is_admin())
   $ec3->advanced=0;

eg:

function ec3_filter_posts_where(&$where)
{
  global $ec3,$wp_query,$wpdb;

  if($wp_query->is_page || $wp_query->is_single)
      return $where;
   
  // Turn OFF advanced mode when we're in the admin screens.   
  if (is_admin())
   $ec3->advanced=0;
    ........

   rest of code

  ...........
  }

Hopefully someone with more plugin experience can come up with a more elegant solution, but meanwhile i hope that this highlights the issue and gives a temporary solution to anyone who has come across the same problem

cheers

darren
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://penguin.firetree.net/pipermail/eventcalendar/attachments/20080502/a1c8b7e2/attachment.html


More information about the EventCalendar mailing list