Support » Plugin: Events Manager - Calendar, Bookings, Tickets, and more! » php error em_posts.php => function em_map_meta_cap

  • I noticed an error while editing event posts “cannot read property of non-object in em_posts.php at line 327”.

    So I investigated what was at line 327. It’s in the “em_map_meta_cap” function, and the $post_type object seemed to be acting a bit quirky. I tried to do some direct output to see what was happening and why it was giving a non-object error. It turns out this function is being called twice, because I’m seeing two outputs, the first time round the $post_type variable is an object but the second time around the $post_type variable is null.

    Seeing that the $post_type variable is being populated based on the $args[0] variable (which should contain the post id), I tried dumping that too. And it is in fact being called twice, the first time it is correctly outputting the post id of the event being edited (in this case “1125”), whereas the second time it is outputting “1127” and therefore no longer corresponds with the event being edited and goes into error when testing for event_owner…

    Why is this function being called twice? And what argument is being passed the second time around seeing that it no longer corresponds with the correct event post id?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter cappellania.uniroma3

    (@cappellaniauniroma3)

    Just to follow up on this, I was getting this double output while there was a notification of a more recent automatic save of the event post. After updating the event post, the more recent automatic save disappeared and there was no more double call to the “em_map_meta_cap” function. I believe the “more recent automatic save” is not being taken into account somewhere in the code…

    Which version of Events Manager and WordPress are you using?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘php error em_posts.php => function em_map_meta_cap’ is closed to new replies.