New links to social profiles

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM New links to social profiles

Viewing 4 reply threads
  • Author
    Posts
    • #85218
      veltolo12
      Participant

      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! 🙂

    • #86229
      WCFM Forum
      Member

      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

    • #86336
      veltolo12
      Participant

      wow, thank you very much, everything works!

    • #86760
      WCFM Forum
      Member

      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.  

    • #88203
      PATselov
      Participant

      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.
Viewing 4 reply threads
  • The topic ‘New links to social profiles’ is closed to new replies.