wael_elsaid
Forum Replies Created
-
Hey @zokkoz I’ve figured out a solution for this issue. Here is the code snippet:
add_action(‘wp_ajax_wcfmvm_vendor_approval_response_update’, ‘wcfmvm_vendor_approval_response_update’);
function wcfmvm_vendor_approval_response_update() {
global $WCFM, $WCFMvm, $_POST, $wpdb;if ( ! check_ajax_referer( 'wcfm_ajax_nonce', 'wcfm_ajax_nonce', false ) ) { wp_send_json_error( esc_html__( 'Invalid nonce! Refresh your page and try again.', 'wc-frontend-manager' ) ); wp_die(); } if ( !current_user_can( 'manage_woocommerce' ) && !current_user_can( 'shop_staff' ) ) { wp_send_json_error( esc_html__( 'You don’t have permission to do this.', 'woocommerce' ) ); wp_die(); } $wcfm_vendor_approval_response_form_data = array(); parse_str($_POST['wcfm_vendor_approval_response_form'], $wcfm_vendor_approval_response_form_data); $wcfm_vendor_approval_response_form_data = wc_clean( $wcfm_vendor_approval_response_form_data ); if( isset( $wcfm_vendor_approval_response_form_data['wcfm_vendor_approval_message_id'] ) && isset($wcfm_vendor_approval_response_form_data['wcfm_vendor_approval_member_id']) ) { $message_id = absint( $wcfm_vendor_approval_response_form_data['wcfm_vendor_approval_message_id'] ); $member_id = absint( $wcfm_vendor_approval_response_form_data['wcfm_vendor_approval_member_id'] ); if( $member_id && $message_id ) { $member_user = new WP_User(absint($member_id)); $approval_status = $wcfm_vendor_approval_response_form_data['wcfm_vendor_approval_response_status']; // delete_user_meta( $member_id, 'wcfm_membership_application_status' ); // Continue with your existing logic... if( $approval_status == 'approve' ) { // Check existing roles $existing_roles = $member_user->roles; // If the vendor role is not already assigned, add it if ( ! in_array( 'wcfm_vendor', $existing_roles ) ) { $member_user->add_role( 'wcfm_vendor' ); } // Add your approval logic here (register vendor, store subscription data, etc.) $paymode = get_user_meta( $member_id, 'wcfm_membership_paymode', true ); if( !$paymode ) $paymode = 'bank_transfer'; // $has_error = $WCFMvm->register_vendor( $member_id ); $membership_id = get_user_meta( $member_id, 'wcfm_membership', true ); if( $membership_id ) { $subscription = (array) get_post_meta( $membership_id, 'subscription', true ); $subscription_type = isset( $subscription['subscription_type'] ) ? $subscription['subscription_type'] : 'one_time'; $subscription_pay_mode = isset( $subscription['subscription_pay_mode'] ) ? $subscription['subscription_pay_mode'] : 'by_wcfm'; if( ($paymode != 'paypal') && ($paymode != 'stripe') ) { $WCFMvm->store_subscription_data( $member_id, $paymode, '', $paymode.'_subscription', 'Completed', '' ); if( ( $subscription_type == 'recurring' ) && ( $subscription_pay_mode == 'by_wcfm' ) ) { $WCFMvm->store_subscription_data( $member_id, $paymode.'_subs', '', $paymode.'_reccuring_subscription', 'Completed', '' ); } } } } else { $wcfm_membership_options = get_option( 'wcfm_membership_options', array() ); $membership_reject_rules = array(); if( isset( $wcfm_membership_options['membership_reject_rules'] ) ) $membership_reject_rules = $wcfm_membership_options['membership_reject_rules']; $vendor_reject_rule = isset( $membership_reject_rules['vendor_reject_rule'] ) ? $membership_reject_rules['vendor_reject_rule'] : 'same'; $send_notification = isset( $membership_reject_rules['send_notification'] ) ? $membership_reject_rules['send_notification'] : 'yes'; if( $send_notification == 'yes' ) { if( !defined( 'DOING_WCFM_EMAIL' ) ) define( 'DOING_WCFM_EMAIL', true ); // Switch language context… if( apply_filters( 'wcfm_allow_wpml_email_translation', true ) ) { do_action('wpml_switch_language_for_email', $member_user->user_email); } $rejection_reason = wcfm_stripe_newline( $wcfm_vendor_approval_response_form_data['wcfm_vendor_rejection_reason'] ); $rejection_reason = esc_sql( $rejection_reason ); $reject_notication_subject = wcfm_get_option( 'wcfm_membership_reject_notication_subject', '{site_name}: Vendor Application Rejected' ); $reject_notication_content = wcfm_get_option( 'wcfm_membership_reject_notication_content', '' ); if( !$reject_notication_content ) { $reject_notication_content = "Hi {first_name}, <br /><br /> Sorry to inform you that, your vendor application has been rejected. <br /><br /> <strong><i>{rejection_reason}</i></strong> <br /><br /> Thank You"; } $subject = str_replace( '{site_name}', get_bloginfo( 'name' ), $reject_notication_subject ); $subject = apply_filters( 'wcfm_email_subject_wrapper', $subject ); $message = str_replace( '{first_name}', $member_user->first_name, $reject_notication_content ); $message = str_replace( '{rejection_reason}', $rejection_reason, $message ); $message = apply_filters( 'wcfm_email_content_wrapper', $message, __( 'Vendor Application Rejected', 'wc-multivendor-membership' ) ); wp_mail( $member_user->user_email, $subject, $message ); // switch language back if( apply_filters( 'wcfm_allow_wpml_email_translation', true ) ) { do_action('wpml_restore_language_from_email'); } } if( apply_filters( 'wcfm_is_allow_delete_vendor_reject_user', true ) ) { $membership_id = get_user_meta( $member_id, 'temp_wcfm_membership', true ); if( ( $membership_id != -1 ) && ( $membership_id != '-1' ) ) { $vendor_reject_rule = get_post_meta( $membership_id, 'vendor_reject_rule', true ) ? get_post_meta( $membership_id, 'vendor_reject_rule', true ) : $vendor_reject_rule; } delete_user_meta( $member_id, 'temp_wcfm_membership' ); delete_user_meta( $member_id, 'wcfm_membership_application_status' ); if( $vendor_reject_rule == 'delete' ) { wp_delete_user( $member_id ); } } } // Vendor Approval message mark read $author_id = apply_filters( 'wcfm_message_author', get_current_user_id() ); $todate = date('Y-m-d H:i:s'); /*$wcfm_read_message = "INSERT into {$wpdb->prefix}wcfm_messages_modifier (
message
,is_read
,read_by
,read_on
) VALUES ({$message_id}, 1, {$author_id}, '{$todate}')"; $wpdb->query($wcfm_read_message);*/ // Vendor Approval message mark read $wpdb->query( $wpdb->prepare("DELETE FROM {$wpdb->prefix}wcfm_messages WHERE ID =%d", $message_id ) ); echo '{"status": true, "message": "' . esc_html( __( 'Vendor Approval status successfully updated.', 'wc-multivendor-membership' ) ) . '"}'; die; } } echo '{"status": false, "message": "' . esc_html( __( 'Vendor Approval status update failed.', 'wc-multivendor-membership' ) ) . '"}'; die;}
Forum: Reviews
In reply to: [Calculated fields for ACF] Good but not working on frontendThanks, Nick,
Yes, I think you can use it but of course, you will need some adjustments.Best Regards,
WaelForum: Reviews
In reply to: [Calculated fields for ACF] Good but not working on frontendThanks, Nick,
In fact, I wanted to subtract a value of a repeater field from a normal number value so I fetched all the repeater subfields values and added them then subtract the result from the number value and assign this value to the calculated field value.<script> jQuery(document).ready(function($){ let tamount = parseInt($("input#acff-post-field_61b0efb617650").val()); let sum = 0; $("table.acf-table input[type=number]").each(function(){ sum += parseInt(+$(this).val()); }); let amountdue = tamount - sum ; $("div.acf-fields.acf-form-fields.-top > div.acf-field.acf-field-number.acf-field-61b0efca17651 > div.acf-input").text(amountdue); }); </script>
Best Regards,
WaelForum: Reviews
In reply to: [Calculated fields for ACF] Good but not working on frontendIn fact, I solved this issue using Javascript to calculate the field value on the frontend on the runtime.
Forum: Reviews
In reply to: [Calculated fields for ACF] Good but not working on frontendThank you Nick for your reply and suggestions. Unfortunately, I can’t use the native ACF form as I needed in my form a repeater field to be populated and I don’t know how to use this kind of field with the native ACF forms on the frontend.
Forum: Reviews
In reply to: [Calculated fields for ACF] Good but not working on frontendHello Nick,
I am using Advanced custom fields frontend pro to show the forms on the frontend and when used a calculated field in the form, it works from the backend correctly but on the frontend didn’t work and I have to go to the backend to update the post to be shown correctly on the frontend, and by the way, I found few users had the same problem here on the support posts exactly the same.It worked thank you
It worked thank you
Didn’t work with me [wpuf_dashboard post_type=”post,ms_invoice”]
any help?I have a custom post type “ms_invoice” and the shortcode I used is “[wpuf_dashboard post_type=”ms_invoice”]”
but nothing appear in the frontend for user
any help?- This reply was modified 5 years, 1 month ago by wael_elsaid.
Forum: Plugins
In reply to: [Tap Payment Gateway] Knet payment integration api key and issue@omarelmetany me too
if you find any other plugin please tell us here- This reply was modified 5 years, 7 months ago by wael_elsaid.
Forum: Plugins
In reply to: [YITH WooCommerce Featured Video] Issues with Product Variationsyes this issue happened with me
Forum: Plugins
In reply to: [Its Migs] Orders marked ‘pending’I have the same issue also
Is there any solution?Is this feature in the premium version only?
Forum: Plugins
In reply to: [WooCommerce] If description tab empty show custom fieldput previous snippet in child theme functions.php file