clickingclients
Forum Replies Created
-
I’m getting a similar thing.
One particular plugin “Participants Database” (PDB) is losing its admin settings when restoring to a fresh site.
However, if I install PDB first onto the fresh site, then use WPVivid to Restore my entire site backup… it works perfectly.
It is essentially then updating the PDB plugin at that point.However, this is an extra step I’d love to avoid.
Is this a glitch in your plugin?
FIXED: This was only a duplication as I’ve updated my code to fix the deprecated code.
PROBLEM: During checkout, your plugin Woocommerce Custom Fields For Variation seems to be resulting in the following PHP error_log warning:
” woocommerce_add_order_item_meta is deprecated since version 3.0.0! Use woocommerce_new_order_item instead.”
…..
Here is a link with more info I used to debug & fix it >> https://stackoverflow.com/questions/49863814/trying-to-save-order-item-meta-data-with-woocommerce-new-order-item-hook
Modelled off the link above AND commented out the Plugin’s call to “woocommerce_add_order_item_meta” on line 26.The details are below:
————————– ————————–It is this file: “class-product-add-to-cart.php” line 26 I have changed to (by commenting it out):
// Add meta to order :: overwritten in functions.php with save_custom_order_item_meta_data) //add_action( 'woocommerce_add_order_item_meta', 'phoen_order_item_var_meta' , 10, 2 );I then added this code in my functions.php as a fix: (you may like to add it into your plugin code)
// 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'] ); } } } }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!