custom social fields
-
1. This adds a custom social field to the social fields form. (OK)
2. If the user fills out the form on his own, then the data is saved in the database and displayed on the seller’s page. (OK)
3. But the PROBLEM is that if the administrator fills in or changes the social field of the vendor, then when the administrator saves the changes , they are not written to the database. (dont ok)Could you send a working code?
add_filter('wcfm_profile_fields_social',function($fields,$user_id){ $custom_social = get_user_meta( $user_id, '_custom_social', true ); $fields["custom_social"] = array('label' => __('Custom Social', 'wc-frontend-manager') , 'type' => 'text', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'value' => $custom_social ); return $fields; },10,2); add_action( 'wcfm_profile_update','wcfmu_vendor_custom_social_update', 20, 2 ); function wcfmu_vendor_custom_social_update( $user_id, $wcfm_profile_form ) { global $WCFM, $WCFMu, $_POST; update_user_meta( $user_id, '_custom_social', $wcfm_profile_form['custom_social'] ); } add_action( 'wcfmmp_store_after_social', function( $vendor_id ) { $custom_social = get_user_meta( $vendor_id, '_custom_social', true ); if( $custom_social ) { ?> <li><a href="<?php echo wcfmmp_generate_social_url( $custom_social, 'custom_social' ); ?>" target="_blank"><i class="fab fa-whatsapp" aria-hidden="true" target="_blank"></i></a></li> <?php } }, 50 ); add_action( 'wcfm_social_url', function( $social_handle, $social ) { if( $social == 'custom_social' ) { $social_handle = 'wa.me/' . $social_handle; } return $social_handle; }, 50, 2 );
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘custom social fields’ is closed to new replies.