Is there a way to allow logged in users to have their submissions published automatically, but have non-logged in users’ submissions require admin approval?
George Carvill
Hi George,
You can set the status of events created through the front-end forms, but this applies to all users.
So if you can’t allow logged-in users to use the “normal” admin-side event edit page, then you can use the following snippet to set the status:
add_filter('eventorganiser_fes_submit_event', function($event, $form) {
if (is_user_logged_in()){
$event['post_status'] = 'publish';
}
return $event;
}, 10, 2);
Stephen Harris
Thanks. But I have no idea where to put this code.
George Carvill
It’s best suited in a utility plug-in, but will work in a (child) theme’s functions.php, see https://wp-event-organiser.com/blog/tutorial/where-should-i-put-code-from-the-tutorials/ for more details.
Stephen Harris
OK. I put in the code and it works as initially expected. I did find one surprising thing:
If the user is NOT logged in, they get the “Your Event Has Been Submitted” message as expected.
But if the person IS logged in, the event is published, but the user does NOT get the confirmation message.
Maybe this is what was intended because the event is immediately visible?
As a workaround, I added text to the anti-spam section telling users what to expect.
George Carvill
Hi George,
I can’t replicate the “Your Event Has Been Submitted” message.
Stephen Harris