daymobrew
Forum Replies Created
-
But it does, sort of.
Using 3.24 generates a warning in the browser console. I expect that version 3.24 will eventually no longer be available. Changing to v=3 will future proof you.Ok, so it’s workaround time.
I have it working as desired when I temporarily change the “Guest Default User” (under Anonymous Event Submissions) to a user that has ‘publish_events’ permissions. After calling EM_Event->save() I change back to the use that does not have ‘publish_events’ permissions.
Here is an excerpt of the modified code:
// Change anonymous submission user to allow the event be published. $anon_user = get_option('dbem_events_anonymous_user'); update_option('dbem_events_anonymous_user', 1); // Set to a user that can publish events. $save_return = $EM_Event->save(); // Set back to originally set anon user. update_option('dbem_events_anonymous_user', $anon_user);I don’t think that I can do that. My script runs outside of WordPress – I invoke the script directly so if I used add_filter() where would the triggering code be?
Or are you suggesting that I add_filter() in addition to the above code and use $this to set the $event_slug? That filter seems to be run after all the database updates are complete.
I am curious why $event_slug is not set during the initial EM_Event->save(). Is it because the event owner is the anonymous user that I have set to not be able to publish events?
I added the following code after the $EM_Event->save() call:
$args = array( 'ID' => $EM_Event->post_id, 'post_author' => $author_id, 'post_status' => 'publish', ); wp_update_post( $args );It seems to have worked. I will investigate further tomorrow.
Yes.
See screenshot of settings and resulting pending events with the specified user.
Maybe I could add a filter for the ’em_event_save’ filter and change the owner and post status at that point.
Or simply use wp_update_post() when save() returns.My code is run as a standalone script (using: define(‘WP_USE_THEMES’, false);).
So, as the user is not logged in, I think that the is_user_logged_in() check in the save() function is setting the event owner to the ‘dbem_events_anonymous_user’ setting. That user cannot publish events (for obvious reasons).Could I change the user after it is saved and publish it via my code?
The events are added and the post_id and event_id increment as expected.
Forum: Plugins
In reply to: [Mailchimp List Subscribe Form] Fatal Error on PHP 5.5Jasper – I made the fix before I saw the official fix. Great minds think alike 🙂
Forum: Plugins
In reply to: [Mailchimp List Subscribe Form] !!! Fatal ErrorFix works for me.
Forum: Plugins
In reply to: [Mailchimp List Subscribe Form] Not working in local environmentWhat version of PHP is on your local site and on your live site?
I changed /wp-content/plugins/mailchimp/lib/mailchimp/mailchimp.php line 21 from
public function get($endpoint, $count = 10, $fields = [])
to
public function get($endpoint, $count = 10, $fields = array())
Forum: Plugins
In reply to: [Mailchimp List Subscribe Form] Fatal Error on PHP 5.5I changed line 21 of lib/mailchimp/mailchimp.php from:
public function get($endpoint, $count = 10, $fields = [])
to
public function get($endpoint, $count = 10, $fields = array())
and it looks good to me.
I did get further by changing the location ID to 74 (I found that ID in the EM_LOCATIONS table). With that working I changed the ‘format’ to one that would be easy for me to parse.
$args = array('location'=>74, 'scope'=>'future', 'format'=>"#_EVENTNAME|#_{Y-m-d}|#_EVENTTIMES\n", 'format_header'=>null, 'format_footer'=>null); $venue_events = em_get_events( $args, true ); var_dump( $venue_events );This does give me a string that I can parse (explode by “\n” and then by “|”) but an actual PHP list would be better.
The ‘array’=>1 argument still breaks things – either it is not supposed to work or is broken.
I think that the EM_Events::output() function should check that $EM_Event is an object before calling line 195:
$output .= $EM_Event->output($format);Forum: Plugins
In reply to: [Staff Directory] Update – error 500What is the fatal error?
Can you look at your server logs and copy the error messages here.One could argue that Divi is breaking the plugin 😉
Forum: Plugins
In reply to: [Staff Directory] Update – error 500@japp: What is the error message?
What version of PHP is your site on?Forum: Plugins
In reply to: [Staff Directory] Update – error 500I had a mistake in my code – I was checking for an empty string instead of a non-empty string.
Adam has committed a change on GitHub
https://github.com/adamtootle/staff-directory/blob/master/classes/staff-directory-shortcode.phpHe changed:
if(!empty(self::photo_url_shortcode())){
to:
$photo_url = self::photo_url_shortcode();
if(!empty($photo_url)){