clickingclients
Forum Replies Created
-
1) You have not answered yet on here.
2) You have no record of a changelog.3) I found the solution
Previously I had located you plugin as throwing a note/warning in the errorlog.[19-Nov-2019 21:28:23 UTC] The woocommerce_add_order_item_meta function is deprecated since version 3.0. Replace with wc_add_order_item_meta.
[19-Nov-2019 21:28:23 UTC] woocommerce_add_order_item_meta is deprecated since version 3.0.0! Use woocommerce_new_order_item instead.I got it fixed with this code: you may like to add it into yours for future releases.
Modelled off the link below AND commented out the Plugin’s call to “woocommerce_add_order_item_meta” on line 26.
https://stackoverflow.com/questions/49863814/trying-to-save-order-item-meta-data-with-woocommerce-new-order-item-hook// Save custom data to order item meta data add_action('woocommerce_checkout_create_order_line_item', 'save_custom_order_item_meta_data', 10, 4 ); function save_custom_order_item_meta_data( $item, $cart_item_key, $values, $order ) { if( isset( $values['options'] ) ){ if( ! empty( $values['options'] ) ) { foreach ( $values['options'] as $options ) { $name = $options['name']; if ( $options['price'] > 0 ) { $name .= ' (' . wc_price( get_var_product_addition_options_price( $options['price'] ) ) . ')'; } $item->update_meta_data( $name, $options['value'] ); } } } }I got it fixed with this code: you may like to add it into yours SOLVED: "woocommerce_add_order_item_meta" warning. Culprit:: woo-custom-fields-for-variation Modelled off the link above AND commented out the Plugin's call to "woocommerce_add_order_item_meta" on line 26. // Save custom data to order item meta data add_action('woocommerce_checkout_create_order_line_item', 'save_custom_order_item_meta_data', 10, 4 ); function save_custom_order_item_meta_data( $item, $cart_item_key, $values, $order ) { if( isset( $values['options'] ) ){ if( ! empty( $values['options'] ) ) { foreach ( $values['options'] as $options ) { $name = $options['name']; if ( $options['price'] > 0 ) { $name .= ' (' . wc_price( get_var_product_addition_options_price( $options['price'] ) ) . ')'; } $item->update_meta_data( $name, $options['value'] ); } } } }
Possibly solved? If so needs code updated
Line 239: needs $value added…
$field = $this->field_item($fieldname, $value);
Line 289 need $value added
private function field_item( $fieldname, $value )
It seems lines 262-300 have vanished.
Line 251 was previous providing the “value”
private function value_display( $fieldname, $value )
Forum: Plugins
In reply to: [Participants Database] Adding Image URL to Record Update Notification EmailYes it is. Thank you.
Forum: Plugins
In reply to: [Participants Database] Adding Image URL to Record Update Notification EmailActually, on 2nd thoughts, the email address is the unique id I am looking for within PDB. So it only needs to return 1 result, rather than an array.
Forum: Plugins
In reply to: [Participants Database] Adding Image URL to Record Update Notification EmailGood stuff.
“get_admin_record_id()” is making use of that method get_record_id_by_term().
So you are suggesting to use $single=false and compare all the admins.
I was wondering that and I think it should do the trick. I’ll give it a go.
Thank you.
Forum: Plugins
In reply to: [Participants Database] Adding Image URL to Record Update Notification EmailFinished the shortcode to create the media uploaded raw URL.
I can now add the url into an email.[bg_image_link full_path=yes]
full_path is optional// Email tag for image url in PDB value add_shortcode('bg_image_link', 'cc_bg_image_link' ); function cc_bg_image_link( $atts ) { $record_id = get_admin_record_id(); $record = Participants_Db::get_participant($record_id); //need to find how to get First Record or First Participants. $full_path = (isset($atts['full_path']) && (sanitize_text_field( $atts['full_path'] ) == 'yes' )) ? get_site_url() . '/' : '/'; $uploads_path = $full_path . Participants_Db::files_location(); $img_url = $uploads_path . $record['background_image']; return $img_url; } function get_wp_admins_emails(){ $admin_list = get_users('role=Administrator'); $valid_admins = array(); $temp_email = ""; foreach ($admin_list as $this_admin) { $temp_email = $this_admin->user_email; $valid_admins[] = $temp_email; } return $valid_admins; } /** * finds the ID of a record if matching a WP admin email * * Returns the first of multiple matches * * @return int id number if valid id found * @return int|bool false if no valid id found */ function get_admin_record_id(){ $adminsEmails = get_wp_admins_emails(); foreach ($adminsEmails as $email) { $temp_id = Participants_Db::get_record_id_by_term('email', $email); if(isset($temp_id) && $temp_id > 0 ) { return $temp_id; } } return false; }
Feel free to use/adapt/critique this (perhaps there are obvious flaws I can’t see).
Thanks again!
Forum: Plugins
In reply to: [Participants Database] Adding Image URL to Record Update Notification EmailThat may be the option then.
If I can figure out a way so it’s not overwritten in updates.
Thanks again ??Forum: Plugins
In reply to: [Participants Database] Adding Image URL to Record Update Notification EmailThank you.
Having the actual image in the email isn’t ideally what I’d like.It would be great to add image URL in the body of the text.
Is that possible?
Thank you. ??
Thank you.
The post I shared above mentions WPML(4.3.1).If this is different to WPML 4.3.0 (as you have suggested):
can you please include the changes in the code for WPML(4.3.1) also?
Otherwise, thank you again ??
Thank you Sergey for your speed.
This is for WPML(4.3.1)?
To assist with understanding, can you please indicate how “It has included the fix for this issue”?
Thanks kindly.
Forum: Plugins
In reply to: [Participants Database] Prefilled form field with previous info submitted?Found it!
[pdb_record] is the perfect page!
As you’ve written:
This short only displays when accessed with a URL including the record “private id” number. It allows the user to edit and add to their own record, while others won’t have access to it. A private link to this record can be included in the “thank you” email they will receive on submission.
Thanks!
Forum: Plugins
In reply to: [Participants Database] Raw data from shortcodesThanks again. I’ll leave this here for others to learn from also.
I added the following to my child theme functions.php// Flexible wrapping and styling of PDB value add_shortcode('wrapped_value', 'cc_wrapped_value' ); function cc_wrapped_value( $atts ) { vTag = sanitize_text_field( $atts['tag'] ); vClass = sanitize_text_field( $atts['class'] ); vId = sanitize_text_field( $atts['el_id'] ); $html = '<' . vTag . ' class="' . vClass . '" id="' . vId .'">'; $html .= do_shortcode( '[pdb_single record_id=' . $atts['record_id'] . ' fields=' . $atts['fields'] . ' template=bare-value ]' ); $html .= '</' . vTag . '>'; return $html; }
Thank you.
I can confirm it has fixed it.
Awesomely quick response! Thank you.