Home › Forums › Ticket Products › Event Tickets Plus › Custom Select Field
- This topic has 8 replies, 3 voices, and was last updated 8 years, 8 months ago by
Mike.
-
AuthorPosts
-
June 19, 2017 at 4:44 pm #1300248
Mike
ParticipantHey everyone! So i am fairly new to customizing the The Events Calendar. I have the TEC Pro with Events Tickets Pro. I found the place to customize the select field event-ticket-plus > src > views > meta > select.php.
i am creating a website for a client who is putting together a car show events website. the participants can submit their cars they have in stock and showcase them on their profiles.
I’ve written a php function that dynamically pulls their car information and makes them into options for a dropdown form using the information they provided in that list in a foreach loop.
so my question is…how do I create my own select.php without having to override the current template? I want to have those drop downs as they register for each ticket without having to manually input there cars in a regular text box (the client is adamant about this feature).
here is my code. Right now i have it as a shortcode for testing purposes!
function getcarsdata() { $user_id = wp_get_current_user(); $cars = bp_get_profile_field_data('field=Cars&user_id='.bp_loggedin_user_id()); $car = explode('|', $cars); echo '<h2>Testing loop</h2> <form><select>'; foreach($car as $key =>$carname) { echo '<option value="'.$carname.'"> ' .$carname. '</option>'; } echo '</select></form>end of loop'; } add_shortcode ('usercars', 'getcarsdata');June 21, 2017 at 3:46 pm #1301400Cliff
MemberHi, Mike.
Thinking outside any current limitations, my suggestion would be to use a custom post type, like “user-cars” and then let each user add their own “posts” to this custom post type, and then you could have an Attendee Information field specific to their “user-cars” posts. This would allow them to edit the posts, add new (bought new car), delete (sold car), etc.
However, I don’t think this functionality is currently possible. Here are my thoughts:
- /wp-content/plugins/event-tickets-plus/src/Tribe/Meta/Field/Abstract_Options_Field.php would like be utilized
- but /wp-content/plugins/event-tickets-plus/src/Tribe/Meta/Field/Abstract_Field.php __construct() isn’t filterable and therefore that list of field types is hard-coded (unless you want to try to override this entire class or its constructor)
Instead of that, you might be able to do the select.php template override like you have been and then detect which field you’re on and say “if currently rendering User Cars field, load this <select>, else load the default <select>”
I think that last option should work for you.
Please let me know how this goes.
June 23, 2017 at 12:51 pm #1302480Mike
Participantyeah thats what i am thinking now after looking at how all this works. it might be easier that way than trying to force it. now i just got to have the template work
June 24, 2017 at 9:32 pm #1303223Cliff
MemberI’m glad I could help (at least I think I did) in some way.
There’s currently a known bug that overriding the files in the /wp-content/plugins/event-tickets-plus/src/views/meta/ directory will not work, unfortunately.
I’ll mark this ticket as Pending Fix, which means this thread should receive a reply once the applicable fix has been released. I cannot guarantee when it will be fixed as it’s in the development team’s hands now. They need to assign it, code it, test it, and schedule it for release.
I apologize for this issue and appreciate your understanding and patience.
July 5, 2017 at 3:11 pm #1316503Mike
Participantany word on the bug issue relating to this template override issue with the meta field?
July 11, 2017 at 9:41 am #1319631Cliff
MemberMike, I had to check with our developers and was told it’s on the soon-to-do list. Other than that, I can’t provide more information because we do not provide ETAs.
August 1, 2017 at 3:36 pm #1329135Victor
MemberHello Mike!
Just replied to your other thread but also wanted to share it with you here: A new maintenance release (for the Week of 24 July 2017) is out, including a fix for this issue 🙂
Find out more about this release → https://theeventscalendar.com/maintenance-release-week-24-july-2017/
Please update the plugins and let us know if the fix works for your site.
Best,
VictorAugust 23, 2017 at 9:35 am #1339187Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Custom Select Field’ is closed to new replies.
