Support

Home Forums Custom Files Add-on (EE3) Override advanced_settings.php?

Override advanced_settings.php?

Posted: July 16, 2012 at 3:00 am


emarienborg

July 16, 2012 at 3:00 am

Hi,

I’m running Event Espresso 3.1.24.3.P. Things seem to be working fine, I just have one question. Or actually two. I’ll get to that.

In the “Add new event” page, I want to change the default value of the “Additional Attendee Registration info?” dropdown. This is set in the includes/admin-files/event-management/advanced_settings.php file, and I’ve managed to succesfully alter the code her to make the change I want.

But this will break on future upgrades. So I need a different approach.

I have the custom files addon. But since the dropdown is not made in a separate function, I guess I won’t be able to override it with that?

So, then I’m wondering if there is any other way to achieve what I’m looking for?

My second question is a more long-term one:

The advanced_settings.php file is called by includes/event-management/add_new_event.php with this code:

if (file_exists(EVENT_ESPRESSO_PLUGINFULLPATH . 'includes/admin-files/event-management/advanced_settings.php')) {
            require_once(EVENT_ESPRESSO_PLUGINFULLPATH . "includes/admin-files/event-management/advanced_settings.php");
        } else {

Wouldn’t it be possible to first check for that file in e.g. /uploads/espresso/overrides/, to see if I’ve made my own version of the advanced_settings.php, and then, if it’s not present there, do the check it’s already doing? That would enable me to easily edit my own advanced settings, and also have the system fall back on the defaults if I’ve chosen not to. Just a suggestion for future versions.. 🙂

Hope to get some input from all you clever Event Espresso people! Thank you in advance 🙂


emarienborg

July 16, 2012 at 3:04 am

..in the same category of question: That would perhaps also enable me to remove all the event settings that aren’t used by the users of the site, and just confuse them? Like the alternate registration page, etc.


Josh

  • Support Staff

July 16, 2012 at 12:01 pm

In Event Espresso 3.1, the way to modify core functions and keep them from being overwritten on plugin updates was to copy over pluggable functions to the custom_functions.php file. Which left out any of the functions that were not pluggable.

In Event Espresso 3.2, many of the core admin functions have a means to add filters. So while I can’t point to a solution for 3.1, here’s how you’ll change this in 3.2 (which we hope to have an early version available for testing very soon):

Create a new function like this:

function my_change_default_addl_attendee($event){
    $event->additional_limit = 2;
    return $event;
}
add_filter( 'filter_hook_espresso_new_event_template', 'my_change_default_addl_attendee, 10, 1 );

The support post ‘Override advanced_settings.php?’ 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.

Support forum for the Custom Files add-on for EE3.
Documentation for Custom Files Add-on http://eventespresso.com/wiki/custom-files-add-on/

Status: closed

Updated by  Josh 8 years, 3 months ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!
[gravityform id=80 title=false description=false ajax=false]
<div class='gf_browser_unknown gform_wrapper' id='gform_wrapper_80' ><form method='post' enctype='multipart/form-data' id='gform_80' action='/topic/override-advanced_settings-php/'> <div class='gform_body'><ul id='gform_fields_80' class='gform_fields top_label form_sublabel_below description_below'><li id='field_80_1' class='gfield gfield_contains_required field_sublabel_below field_description_below gfield_visibility_visible' ><label class='gfield_label' for='input_80_1' >First name<span class='gfield_required'>*</span></label><div class='ginput_container ginput_container_text'><input name='input_1' id='input_80_1' type='text' value='' class='medium' aria-required="true" aria-invalid="false" /></div></li><li id='field_80_2' class='gfield gfield_contains_required field_sublabel_below field_description_below gfield_visibility_visible' ><label class='gfield_label' for='input_80_2' >Email address<span class='gfield_required'>*</span></label><div class='ginput_container ginput_container_email'> <input name='input_2' id='input_80_2' type='email' value='' class='medium' aria-required="true" aria-invalid="false" /> </div></li><li id='field_80_3' class='gfield gfield_contains_required field_sublabel_below field_description_below gfield_visibility_visible' ><label class='gfield_label' >GDPR Agreement<span class='gfield_required'>*</span></label><div class='ginput_container ginput_container_checkbox'><ul class='gfield_checkbox' id='input_80_3'><li class='gchoice_80_3_1'> <input name='input_3.1' type='checkbox' value='I consent to have this website store my submitted information so they can respond to my inquiry.' id='choice_80_3_1' /> <label for='choice_80_3_1' id='label_80_3_1'>I consent to have this website store my submitted information so they can respond to my inquiry.</label> </li></ul></div></li><li id='field_80_4' class='gfield gform_validation_container field_sublabel_below field_description_below gfield_visibility_visible' ><label class='gfield_label' for='input_80_4' >Name</label><div class='ginput_container'><input name='input_4' id='input_80_4' type='text' value='' autocomplete='off'/></div><div class='gfield_description' id='gfield_description_80_4'>This field is for validation purposes and should be left unchanged.</div></li> </ul></div> <div class='gform_footer top_label'> <input type='submit' id='gform_submit_button_80' class='gform_button button' value='Download Now' onclick='if(window["gf_submitting_80"]){return false;} if( !jQuery("#gform_80")[0].checkValidity || jQuery("#gform_80")[0].checkValidity()){window["gf_submitting_80"]=true;} ' onkeypress='if( event.keyCode == 13 ){ if(window["gf_submitting_80"]){return false;} if( !jQuery("#gform_80")[0].checkValidity || jQuery("#gform_80")[0].checkValidity()){window["gf_submitting_80"]=true;} jQuery("#gform_80").trigger("submit",[true]); }' /> <input type='hidden' class='gform_hidden' name='is_submit_80' value='1' /> <input type='hidden' class='gform_hidden' name='gform_submit' value='80' /> <input type='hidden' class='gform_hidden' name='gform_unique_id' value='' /> <input type='hidden' class='gform_hidden' name='state_80' value='WyJbXSIsIjBiNjdjZjkyMDUzOWUxOWY5Y2NiZjIwMzM4YjA1Mjk4Il0=' /> <input type='hidden' class='gform_hidden' name='gform_target_page_number_80' id='gform_target_page_number_80' value='0' /> <input type='hidden' class='gform_hidden' name='gform_source_page_number_80' id='gform_source_page_number_80' value='1' /> <input type='hidden' name='gform_field_values' value='' /> </div> </form> </div><script type='text/javascript'> jQuery(document).bind('gform_post_render', function(event, formId, currentPage){if(formId == 80) {} } );jQuery(document).bind('gform_post_conditional_logic', function(event, formId, fields, isInit){} );</script><script type='text/javascript'> jQuery(document).ready(function(){jQuery(document).trigger('gform_post_render', [80, 1]) } ); </script>
[i]
[i]