Support

Home Forums Event Espresso Premium How to correctly commit changes to the addons?

How to correctly commit changes to the addons?

Posted: November 15, 2016 at 11:33 am

Viewing 9 reply threads


MundoDigitalis

November 15, 2016 at 11:33 am

Hello,

Recently I have changed the number of options available in the barcode scanner addon. To avoid any issues with the people who use the scanners, we have limited the scannign to “Lookup” and “Checkin”.

To do this I have changed the EED_Barcode_Scanner.module.php file to only have the 2 options in the $action_options array.

My question is, how do I do this correctly? I have now changed the code, so when the next update happens, the changes will be undone.

Thanks


Josh

  • Support Staff

November 15, 2016 at 11:52 am

In order to make that change correctly, there’d first need to be a filter hook there. That’s something we can make a ticket for and assign to a developer.


Josh

  • Support Staff

December 20, 2016 at 11:55 am

Hi there,

Update: There’s a new filter hook in the most recent release of the ticket scanning add-on. Here’s an example of how to use the new hook:

add_filter( 'FHEE__EED_Barcode_Scanner__scanner_form__action_options', 'my_remove_action_options_barcode_scanner' );
function my_remove_action_options_barcode_scanner( $options ) {
    unset( $options[1] );
    $options = array_values( $options );
    return $options;
}

You can add the above to a functions plugin or into your WordPress theme’s functions.php file.


thomaspointbeach

December 20, 2016 at 4:00 pm

1. This is in version 1.0.9.p doesn’t seem to be in the changelog for version 1.0.10.p, is this the correct version, or is there a version in the wings we are waiting on?

2. Will this work for adding actions as well? (are the actions called using do_action or something?)


thomaspointbeach

December 21, 2016 at 7:33 am

*This is **not** in version 1.0.9.p


Josh

  • Support Staff

December 21, 2016 at 7:43 am

This was actually added in 1.0.10.p, which is the current version of the barcode scanner add-on.

WRT your second question, someone could use the filter hook to add more options to the $action_options array. Beyond that, they’d need a way to wire those options up to do new things.


thomaspointbeach

December 21, 2016 at 8:58 am

Interesting, I will look in to it. First (and I know this is another ticket) but this system makes it all but impossible to update an add-on via the command-line… :-/


Josh

  • Support Staff

December 21, 2016 at 9:10 am

By “this system” are you referring to the license key system?

Since you have access to the github repo, you can update an add-on by cd-ing into its directory and run:
git pull

If you have suggestions on how to make it possible to serve updates via the command line, that don’t involve using Git, you can open an issue on Github and the developers can investigate further.


thomaspointbeach

December 21, 2016 at 9:14 am

Ah, yes. I am actually managing my repos separate from my web directory for security reasons. Also, executing a git-pull would not trigger the update filters, which would be problematic if there were migrations that needed to occur.

I will look to see if there are any WP hooks the system can use to determine if an update was requested via WP Cli.


thomaspointbeach

December 21, 2016 at 9:52 am

I have created the GH Issue.

Viewing 9 reply threads

The support post ‘How to correctly commit changes to the addons?’ 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