tribe_events_tickets_metabox_advanced problems after updated to 4.1

Home Forums Calendar Products Community Events tribe_events_tickets_metabox_advanced problems after updated to 4.1

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1090897
    Robert
    Participant

    Hi,

    I’m working with your plugin on this project. I have hooked into your tribe_events_tickets_metabox_advanced to add some custom fields to the form. And after updated to 4.1 it started behaving strange. If i push the Edit button on a ticket, this advanced fields start adding multiple times. The tribe_events_tickets_metabox_advanced is called multiple times on tribe_events_tickets_ajax_ticket_edit action.

    My code:
    https://gist.github.com/bokorir/d970a976a682a7c53bb9

    After downgraded to 4.0.5 everything works fine. Is this a bug or we can’t hook in this way in the future?

    Thank you,

    Robert

    • This topic was modified 10 years, 1 month ago by Robert.
    #1091312
    George
    Participant

    Hey Robert,

    I’m genuinely sorry about your issues, and there may be indeed a bug here in our code that I will investigate—your comment about how tribe_events_tickets_metabox_advanced is called multiple times is especially worth investigating.

    However, we unfortunately cannot troubleshoot your specific code very much. I have been taking a look at it and will continue to do so for a bit, but I just wanted to be frank about the fact that reviewing your custom code is far outside the scope of support we can provide. See the “product support” section of this page for more information → http://theeventscalendar.com/terms

    Now, as noted I am giving this a bit of a look, but it is not likely we will be able to help identify a specific problem with your code. I’ll hopefully use it to identify the bug on our end, though.

    I will post an update here if any progress is made in terms of identifying the bug here.

    Thank you!
    George

    #1092645
    Robert
    Participant

    Of course I’m not asking you to check my code because it is working perfectly with early versions. So I just showing you how to replicate the problem. I’m using the same filters like you use in your plugin for Legacy support so if my code is bad your code will be buggy as well.

    #1092688
    George
    Participant

    If you leave your ticketing and The Events Calendar plugins at 4.1 on your site, and then remove your custom code that you’ve shared above temporarily, do your issues persist?

    Or do the issues themselves only show up in 4.1 when your custom code is running?

    Thank you,
    George

    #1092752
    Robert
    Participant

    My custom code adds extra fields to the add/edit ticket form. If I remove my code then the fields won’t be added. My problem is the fields are added multiple time when you click on the Edit button for a ticket. (on cpt edit page)

    If you click twice my fields will be added 3 times. If you click 5 times my fields will be added 6 times.
    And from the 5 same field only one filled with values which is coming from tribe_events_tickets_ajax_ticket_edit hook. The other fields might be added by tribe_events_tickets_metabox_advanced hook.

    And the problem appears only if I use the 4.1 version.

    #1092981
    George
    Participant

    Thanks for clarifying, Robert. I can dig into this a bit more, but before doing so, I’m just curious—what were your goals with those pre-4.1 fields?

    If they were to collect information from attendees along with their ticket purchase, then just to be clear, are you fully aware of the new built-in features for this in the 4.1 updates? These features are quite powerful, and offer many different field types you can use—text fields, checkboxes, drop-downs, etc.

    I only wanted to touch on this because the problem is still coming back to your own custom-coded fields. I will be taking a closer look at this from our end to see if it reveals a bug, for sure! No worries—but there is a limited amount of things we can do to help here, and I just wanted to clarify that it may be simpler and just-as-effective to use the new built-in fields feature.

    You can read more about the built-in features here: https://theeventscalendar.com/knowledgebase/collecting-attendee-information/

    Cheers! And stay tuned—I’m going to be testing a bit today with these problems to see what I find.

    George

    #1093136
    Robert
    Participant

    My goal is to customize your plugin a little. I’m adding location and date to the tickets and I’m selling a CPT Course. There is one course which has multiple tickets. Each ticket has location and date and you can buy the correct one provided by a form.

    Also I think it’s not my custom code because my custom code is nearly a copy of your Legacy Support part. Same hooks and code. So if my code is buggy your legacy support will behave the same way.

    #1093156
    George
    Participant

    Hey Robert,

    Can you clarify what you mean when you reference “your Legacy Support part”? Can you share a link to whatever thing you are referring to?

    Thank you!
    George

    #1093163
    Robert
    Participant

    src/Tribe/Legacy_Provider_Support.php

    	public function on_init() {
    		$this->find_active_legacy_modules();
    
    		if ( ! count( $this->active_legacy_modules ) ) {
    			return;
    		}
    
    		add_action( 'tribe_events_tickets_metabox_advanced', array( $this, 'add_fields' ), 5 );
    		add_filter( 'tribe_events_tickets_ajax_ticket_edit', array( $this, 'add_fields_ajax' ) );
    	}

    In this snipet you are doing the same as me in my custom code.

    #1093611
    George
    Participant

    Thanks for clarifying this, Robert, though unfortunately I have not made progress on figuring out why your custom code does not work.

    You will have to take the reins from here, and I’m sorry about that, but unfortunately these are issues that are too far outside the scope of our support forums.

    Yes, you are using some of the same hooks as our own code, but your callback functions are doing different things than our internal class methods. There could be simple issues at play here—for example, our own class methods run on the init WordPress action, with a priority of 100. Yours are just…attached to tribe_events_tickets_metabox_advanced, for example, but not through the init function like our class method. So that could be a factor here, for one example of how you are doing things differently—just one difference I was able to notice.

    Please read this page to learn more about our support policies → https://theeventscalendar.com/knowledgebase/what-support-is-provided-for-license-holders/

    I cannot help any further with your custom code; I’m sorry to disappoint, genuinely.

    But from here, your best options are as follows:
    • Remove all custom code and use the built-in fields.
    • Troubleshoot your own custom code.
    • Hire a developer to assist you in adding your own non-normative custom fields to the plugin. We have a list of great developers here → http://m.tri.be/18k1 (and have no affiliation with any of these folks—they’re simply some well-respected names in the community that we’ve compiled to share in situations like this one).

    If you have any further questions about your custom code, I will not be able to answer them; if there’s anything else I can try to help with, however, please let me know

    Sincerely,
    George

    #1100110
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘tribe_events_tickets_metabox_advanced problems after updated to 4.1’ is closed to new replies.