Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM › New links to social profiles
- This topic has 4 replies, 3 voices, and was last updated 5 years ago by PATselov.
- AuthorPosts
- October 5, 2019 at 5:29 am #85218veltolo12Participant
Hello! Please add to the plugin new social profiles: Vkontakte (RU) and Ondoklassniki (RU)
It means that the seller could specify links to these social networks in his profile.
Thank you! 🙂 - October 11, 2019 at 12:27 pm #86229WCFM ForumMember
Hi,
Such code will help you to add custom social option –
add_filter( 'wcfm_profile_fields_social', function( $social_fields, $vendor_id ) { $vk = get_user_meta( $vendor_id, '_wcfm_social_vk', true ); $telegram = get_user_meta( $vendor_id, '_wcfm_social_telegram', true ); $viber = get_user_meta( $vendor_id, '_wcfm_social_viber', true ); $social_fields["vk"] = array('label' => __('VK', 'wc-frontend-manager') , 'type' => 'text', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'value' => $vk ); $social_fields["telegram"] = array('label' => __('Telegram', 'wc-frontend-manager') , 'type' => 'text', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'value' => $telegram ); $social_fields["viber"] = array('label' => __('Viber', 'wc-frontend-manager') , 'type' => 'text', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'value' => $viber ); return $social_fields; }, 50, 2 ); add_action( 'wcfm_profile_update', function( $vendor_id, $wcfm_profile_form ) { if( isset( $wcfm_profile_form['vk'] ) ) { update_user_meta( $vendor_id, '_wcfm_social_vk', $wcfm_profile_form['vk'] ); } if( isset( $wcfm_profile_form['telegram'] ) ) { update_user_meta( $vendor_id, '_wcfm_social_telegram', $wcfm_profile_form['telegram'] ); } if( isset( $wcfm_profile_form['viber'] ) ) { update_user_meta( $vendor_id, '_wcfm_social_viber', $wcfm_profile_form['viber'] ); } }, 50, 2 ); add_action( 'wcfmmp_store_after_social', function( $vendor_id ) { $vk = get_user_meta( $vendor_id, '_wcfm_social_vk', true ); $telegram = get_user_meta( $vendor_id, '_wcfm_social_telegram', true ); $viber = get_user_meta( $vendor_id, '_wcfm_social_viber', true ); if( $vk ) { ?> <li><a href="<?php echo wcfmmp_generate_social_url( $vk, 'vk' ); ?>" target="_blank"><i class="fab fa-vk" aria-hidden="true" target="_blank"></i></a></li> <?php } if( $telegram ) { ?> <li><a href="<?php echo wcfmmp_generate_social_url( $telegram, 'telegram' ); ?>" target="_blank"><i class="fab fa-telegram" aria-hidden="true" target="_blank"></i></a></li> <?php } if( $viber ) { ?> <li><a href="<?php echo wcfmmp_generate_social_url( $viber, 'mixer' ); ?>" target="_blank"><i class="fab fa-viber" aria-hidden="true" target="_blank"></i></a></li> <?php } }, 50 );
Add this code to your child theme’s functions.php
In case you do not have child theme then add code using this plugin –Â https://wordpress.org/plugins/code-snippets/Thank You
- October 11, 2019 at 6:01 pm #86336veltolo12Participant
wow, thank you very much, everything works!
- October 14, 2019 at 11:24 am #86760WCFM ForumMember
You are always welcome 🙂
Let me know if there’s anything else we can help you with.
Can we ask for a favor? Would you mind taking a few minutes to review our plugin at https://wordpress.org/support/plugin/wc-multivendor-marketplace/reviews/ and let others know about your 5 Star experience with WCFM Marketplace. Also, follow us on Twitter https://twitter.com/wcfmmp for more exciting news, important updates, and irresistible offers.  - October 22, 2019 at 10:06 am #88203PATselovParticipant
Your code
add_filter( 'wcfm_profile_fields_social', function( $social_fields, $vendor_id ) { $vk = get_user_meta( $vendor_id, '_wcfm_social_vk', true ); $telegram = get_user_meta( $vendor_id, '_wcfm_social_telegram', true ); $viber = get_user_meta( $vendor_id, '_wcfm_social_viber', true ); $social_fields["vk"] = array('label' => __('VK', 'wc-frontend-manager') , 'type' => 'text', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'value' => $vk ); $social_fields["telegram"] = array('label' => __('Telegram', 'wc-frontend-manager') , 'type' => 'text', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'value' => $telegram ); $social_fields["viber"] = array('label' => __('Viber', 'wc-frontend-manager') , 'type' => 'text', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'value' => $viber ); return $social_fields; }, 50, 2 ); add_action( 'wcfm_profile_update', function( $vendor_id, $wcfm_profile_form ) { if( isset( $wcfm_profile_form['vk'] ) ) { update_user_meta( $vendor_id, '_wcfm_social_vk', $wcfm_profile_form['vk'] ); } if( isset( $wcfm_profile_form['telegram'] ) ) { update_user_meta( $vendor_id, '_wcfm_social_telegram', $wcfm_profile_form['telegram'] ); } if( isset( $wcfm_profile_form['viber'] ) ) { update_user_meta( $vendor_id, '_wcfm_social_viber', $wcfm_profile_form['viber'] ); } }, 50, 2 ); add_action( 'wcfmmp_store_after_social', function( $vendor_id ) { $vk = get_user_meta( $vendor_id, '_wcfm_social_vk', true ); $telegram = get_user_meta( $vendor_id, '_wcfm_social_telegram', true ); $viber = get_user_meta( $vendor_id, '_wcfm_social_viber', true ); if( $vk ) { ?> <li><a href="<?php echo wcfmmp_generate_social_url( $vk, 'vk' ); ?>" target="_blank"><i class="fab fa-vk" aria-hidden="true" target="_blank"></i></a></li> <?php } if( $telegram ) { ?> <li><a href="<?php echo wcfmmp_generate_social_url( $telegram, 'telegram' ); ?>" target="_blank"><i class="fab fa-telegram" aria-hidden="true" target="_blank"></i></a></li> <?php } if( $viber ) { ?> <li><a href="<?php echo wcfmmp_generate_social_url( $viber, 'mixer' ); ?>" target="_blank"><i class="fab fa-viber" aria-hidden="true" target="_blank"></i></a></li> <?php } }, 50 );
But there are two problems:
1. During setup during registration, data added to these fields is not saved.
2. The display of the fields does not correspond to the display of the remaining fields in the list. The image is attached.Attachments:
You must be logged in to view attached files.
- AuthorPosts
- The topic ‘New links to social profiles’ is closed to new replies.