[EventCalendar] Event Editor not saving date

Alex Tingle alex at firetree.net
Wed Oct 15 19:48:11 UTC 2008

Hi Lisa,

[Short version: I bet your DB user doesn't have INSERT privs to the
ec3_schedule table.]

Lisa C. Boyd wrote:
> Ok, here is where things get a little weird.
> Yes it saved the title when I changed it but did not save the date.
> In phpMyAdmin, I went into the ec3_schedule table and inserted a record
> for a test post I created (I looked up the post id). When I go back to
> the blog, it shows up correctly. I can then go in and edit that post and
> change the date, save it, and the date is updated to the new date and
> stays.
> http://perthfoodbank.com/?m=20081025&cat=25
> I thought maybe since I have one record in there to start with that
> maybe it would save the date on another post, but it does not.
> So perhaps something is funky with an insert command? Any ideas on what
> code I can look at?

That's a great problem report. Thank you.

The INSERT statement (admin.php about line 238) *is* a little bit funny:

         "INSERT $ec3->schedule
          (post_id, ".implode(', ',array_keys($vals)).")
          VALUES ($post_ID,".implode(', ',array_values($vals)).")"

...I really think it should be "INSERT INTO $ec3->schedule". However, I've
read the PHP manual, and it doesn't seem to mind the missing INTO - however
strictly you tell it to check the SQL.


I *did* read this on that page:

"Inserting into a table requires the INSERT  privilege for the table."

I don't know much about Wordpress-MU, but it occurs to me that it (or an
administrator) might restrict which tables each user might have access to. Are
your sure that the that Wordpress' DB user has the INSERT priv for that table?

Failing that, if you are happy to mess abiout with the code, then try changing
the code I quoted above to...

        $result = $wpdb->query(
         "INSERT $ec3->schedule
          (post_id, ".implode(', ',array_keys($vals)).")
          VALUES ($post_ID,".implode(', ',array_values($vals)).")"

(THIS WILL OBVIOUSLY BREAK YOUR WORDPRESS - so save the file first and put it
back when you've finished.)

You need the exit(0) because the last thing that happens when you've saved a
post is that WP redirects - so you never get to see any of the output.


:: 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: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://penguin.firetree.net/pipermail/eventcalendar/attachments/20081015/d89155bb/signature.pgp

More information about the EventCalendar mailing list