Followings module

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!

Viewing 9 reply threads
  • Author
    Posts
    • #46201
      FuBendu
      Participant

      Hi there

      1. Is there documentation on the followings module?

      2. How can a following be created programmatically?

      3. How can I call the follow/followers section featured in shop page?

      4. How can I programmatically get the number of followers of a vendor?

      5. Is there a way to control emails? When and how?

      For example, I want to automatically make users become followers of vendors when they purchase.

      Many thanks

    • #46486
      WCFM Forum
      Member

      Hi,

      1. Is there documentation on the followings module?
      – Sorry, No it’s very straight forward

      2. How can a following be created programmatically?

      3. How can I call the follow/followers section featured in shop page?

      4. How can I programmatically get the number of followers of a vendor?

      – Use this to get vendor’s followers list –

      get_user_meta( $vendor_id, '_wcfm_followers_list', true );

      5. Is there a way to control emails? When and how?

      For example, I want to automatically make users become followers of vendors when they purchase.

      – Please check this function how following/followers are updated. Hope this will helpful your purpose –

      function wcfmu_vendors_followers_update() {
      		global $WCFM, $WCFMu, $wpdb, $_POST;
      		
      		$user_id   = absint( $_POST['user_id'] );
      		$vendor_id = absint( $_POST['vendor_id'] );
      		$count     = absint( $_POST['count'] );
      				      
      		if( $user_id && $vendor_id ) {
      			$user_data   = get_userdata( $user_id );
      			$vendor_data = get_userdata( $vendor_id );
      			
      			// Update Vendor Followers List
      			$followers_arr = get_user_meta( $vendor_id, '_wcfm_followers_list', true );
      			if( $followers_arr && is_array( $followers_arr ) ) {
      				$followers_arr[] = $user_id;
      			} else {
      				$followers_arr = array($user_id);
      			}
      			update_user_meta( $vendor_id, '_wcfm_followers_list', $followers_arr );
      			
      			// Update User Following List
      			$user_following_arr = get_user_meta( $user_id, '_wcfm_following_list', true );
      			if( $user_following_arr && is_array( $user_following_arr ) ) {
      				$user_following_arr[] = $vendor_id;
      			} else {
      				$user_following_arr = array( $vendor_id );
      			}
      			update_user_meta( $user_id, '_wcfm_following_list', $user_following_arr );
      			
      			// Update WCfM Followers Table
      			$wcfm_add_follower    = "INSERT into {$wpdb->prefix}wcfm_following_followers 
      																( <code>user_id</code>, <code>user_name</code>, <code>user_email</code>, <code>follower_id</code>, <code>follower_name</code>, <code>follower_email</code>, <code>notify</code> )
      																VALUES
      																( {$vendor_id}, '{$vendor_data->display_name}', '{$vendor_data->user_email}', {$user_id}, '{$user_data->display_name}', '{$user_data->user_email}', 1 )";
      			$wpdb->query($wcfm_add_follower);
      			
      			// Direct message
      			$wcfm_messages = __( 'Congrats! Recently you got a new follower.', 'wc-frontend-manager-ultimate' );
      			$WCFM->wcfm_notification->wcfm_send_direct_message( -1, $vendor_id, 1, 0, $wcfm_messages, 'new_follower' );
      		}
      		echo "done";
      		die;
      	}

      Thank You

    • #46872
      FuBendu
      Participant

      Done thanks – Happy to share the working code.

      Now,

      1 – I need to disable all emails that come out of the followings module. Any handy filter?

      2 – I need to disable (remove) below action but cannot get it to work. Any help pls.
      line 121 from plugins/wc-frontend-manager-ultimate/core/class-wcfmu-vendor-followers.php
      add_action( ‘wcv_after_main_header’, array( &$this, ‘after_wcv_store_header’ ), 16 );

      Thanks
      B

    • #47015
      WCFM Forum
      Member

      Hi,

      1. Please add this –

      add_filter( 'wcfm_is_allow_followings_email', '__return_false' );

      2. Just hide using this CSS –

      #wcfm_followers { display: none; }

      Thank You

    • #48132
      FuBendu
      Participant

      Hi there
      You proposed below but it is not working.
      add_filter( ‘wcfm_is_allow_followings_email’, ‘__return_false’ )
      any help pls?
      Thanks
      b

    • #48148
      WCFM Forum
      Member

      Hi,

      From where you want to hide email? Customer’s following list or vendor’s followers list!

      Thank You

    • #48151
      FuBendu
      Participant

      I want followers to stop receiving emails each time the vendor adds a new product.
      Thank you

    • #48158
      WCFM Forum
      Member

      OK, then I was totally misunderstood your requirement.

      Please use this code for the purpose –

      add_filter( 'wcfm_is_allow_followers_new_product_notification', '__return_false' );

      Thank You

    • #48215
      FuBendu
      Participant

      thank you

    • #48242
      WCFM Forum
      Member

      You are welcome 🙂

Viewing 9 reply threads
  • The topic ‘Followings module’ is closed to new replies.