Support

Home Forums Event Espresso Premium Auto-Set Post For A New Event To YES?

Auto-Set Post For A New Event To YES?

Posted: June 12, 2014 at 6:21 am

Viewing 2 reply threads


Astoria23

June 12, 2014 at 6:21 am

Is there a way to have a new events created set YES for “Add/Update post for this event?”

Thanks!


Tony

  • Support Staff

June 12, 2014 at 10:05 am

Hi Julie,

Currently there is no way within Event Espresso 3.1.36.5 to alter this default without modifying core.

However, with a small edit you add a filter to this to allow you to do so.

If you open up event-espresso/includes/admin-files/event-management/new_event_post.php

On line 11 you’ll find:

<?php echo select_input('create_post', $values, 'N'); ?> 

Change that to:

<?php 
$create_post = apply_filters('filter_hook_espresso_default_create_post_option', 'N');
echo select_input('create_post', $values, $create_post); 
?>

So it will look something like this – http://take.ms/AoJbn

In itself that doesn’t actually do anything. But then if we add something like this:

add_filter('filter_hook_espresso_default_create_post_option', 'ee_return_create_post');
function ee_return_create_post(){
	return 'Y';
}

To our themes functions.php file we can alter the default to our liking. ‘Y’/’N’.

I have submitted a request for this filter to be included within the next version of Event Espresso so therefore this modification should continue to work after EE updates.


Tony

  • Support Staff

June 12, 2014 at 10:46 am

@Josh pointed out that this could also be achieved with jQuery if you are unsure of the above.

You can add:

add_action('action_hook_espresso_new_event_right_column_bottom', 'my_custom_post_option_default_switcher');

function my_custom_post_option_default_switcher(){
?>
<script>
jQuery(document).ready(function($) {
$("select[name='create_post']").val("Y");
});
</script>
<?php
}

To your themes functions.php file in place of the above. The result should be the same so it depends on which you prefer.

Hope that helps.


Astoria23

June 12, 2014 at 4:23 pm

Ah thank you! Yes the JQuery solution is a much better long term solution. Thanks again!


Dean

June 13, 2014 at 4:15 am

Hi Julie,

Has this resolved your query? If so please mark the thread as resolved (top right area).

Thanks!

Viewing 2 reply threads

The support post ‘Auto-Set Post For A New Event To YES?’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso