Compute
Forum Replies Created
-
Forum: Plugins
In reply to: [Polylang] Api function get_default_languageOr is there a reason not to use the default lang?
Forum: Alpha/Beta/RC
In reply to: Adding fields to attachmentsUse attachment_fields_to_edit and attachment_fields_to_save. Still Works in 3.5.
Great tut here:
https://net.tutsplus.com/tutorials/wordpress/creating-custom-fields-for-attachments-in-wordpress/Forum: Plugins
In reply to: [Polylang] Polylang makes gallery failWell… Or maybe its a core issue:
https://www.ads-software.com/support/topic/doesnt-save-custom-field-selectbox-data-in-media-frameWhat would happend if you save a gallery where the images is another language than the current language?
Forum: Alpha/Beta/RC
In reply to: Doesnt save custom field data in media-frameJust updated to the latest nightly (3.5-RC1-22879) and it seems like saves my data if the field is selected first, and then unfocused afterwards.
Might be the same problem as https://core.trac.www.ads-software.com/ticket/22593
but I just wanted to let you know.Forum: Alpha/Beta/RC
In reply to: media-frame gallery doesnt just save the fieldsAwesome. Happy to give something back ??
Forum: Alpha/Beta/RC
In reply to: Doesnt save custom field data in media-frameThat is great – thank you!
Forum: Alpha/Beta/RC
In reply to: Add fields to Attachment DetailsOh same hooks. Smart..
Sorry for this silly question and thanks alot.
Forum: Plugins
In reply to: [Polylang] Polylang capabilities for every languageI did. But it ended up in a bigger hack of the polylang plugin :/
I think the best solution would be to use multisite instead. But thats too late for me now.
Forum: Plugins
In reply to: [Widget Image Field] [Plugin: Widget Image Field] Broken in FIrefoxThanks alot! Also fixet an IE bug for me ??
em_booking_validate hook works. The fix was to make $EM_Booking a global:
Full code:
// Validate and insert custom metadata add_filter( 'em_booking_validate', 'dm_booking_validate' ); function dm_booking_validate ( $result, $EM_Booking ) { global $EM_Notices, $EM_Booking; if( empty($EM_Booking->booking_meta['registration']) ) $EM_Booking->booking_meta['registration'] = array(); if( ! empty( $_REQUEST['title'] ) ) { $EM_Booking->booking_meta['registration']['title'] = wp_kses( $_REQUEST['title'], array() ); $EM_Booking->title = wp_kses( $_REQUEST['title'], array() ); } if( ! empty( $_REQUEST['name'] ) ) { $EM_Booking->booking_meta['registration']['name'] = wp_kses( $_REQUEST['name'], array() ); } else { $result = false; $EM_Notices->add_error( '<strong>Fejl</strong>: Indtast venligst dit Navn.' ); } if ( $_REQUEST['user_email'] && !is_email( $_REQUEST['user_email'] ) ) { $result = false; $EM_Notices->add_error( __( '<strong>Fejl</strong>: E-mailadressen er ikke korrekt.', 'dbem') ); } elseif ( is_email( $_REQUEST['user_email'] ) ) { $EM_Booking->booking_meta['registration']['user_email'] = wp_kses( $_REQUEST['user_email'], array() ); } else { $result = false; $EM_Notices->add_error(__( '<strong>Fejl</strong>: Indtast venligst din E-mailadresse.', 'dbem') ); } if( ! empty( $_REQUEST['company'] ) ) { $EM_Booking->booking_meta['registration']['company'] = wp_kses( $_REQUEST['company'], array() ); } else { $result = false; $EM_Notices->add_error( '<strong>Fejl</strong>: Indtast venligst din Virksomhed.' ); } if( ! empty( $_REQUEST['billingaddress'] ) ) { $EM_Booking->booking_meta['registration']['billingaddress'] = wp_kses( $_REQUEST['billingaddress'], array() ); } if( ! empty( $_REQUEST['zip'] ) ) { $EM_Booking->booking_meta['registration']['zip'] = wp_kses( $_REQUEST['zip'], array() ); } if( ! empty( $_REQUEST['city'] ) ) { $EM_Booking->booking_meta['registration']['city'] = wp_kses( $_REQUEST['city'], array() ); } if( ! empty( $_REQUEST['tlf'] ) ) { $EM_Booking->booking_meta['registration']['tlf'] = wp_kses( $_REQUEST['tlf'], array() ); } if( ! empty( $_REQUEST['ean'] ) ) { $EM_Booking->booking_meta['registration']['ean'] = wp_kses( $_REQUEST['ean'], array() ); } return $result; }
The fix was to make EM_Booking global
global $EM_Notices, $EM_Booking;
Now saves all my metadata together with the booking
Forum: Plugins
In reply to: [Polylang] Polylang capabilities for every languageI’d like to hear some comments about this feature. If anyone would be interested in it and have any suggestions about how it should work in practice?
Would love to hear your comments!Sorry for bringing this up again, but im very close.
Hooking into em_booking_validate:
add_filter( 'em_booking_validate', 'dm_booking_validate' ); function dm_booking_validate ( $result, $EM_Booking ) {
My errors and succes works great. And it also registers the signup. Only problem is that I do not get my booking_meta with me.
Im trying to do it like this:
if( ! empty( $_REQUEST['city'] ) ) { $EM_Booking->booking_meta['registration']['city'] = wp_kses( $_REQUEST['city'], array() ); }
Only thing im getting is the user_email.
returning $result
What im I doing wrong?
Sounds good. Thank you very much.
Looking forward to hear more ??
Thanks for the answer.
I still cant see other events bookings. Only if im the creator of the event or I have the rights to edit others events.
As mention before – I need a user that only can csv export the bookings of all the events created on the site.