Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Ultimate › Followings module
- This topic has 9 replies, 2 voices, and was last updated 5 years, 9 months ago by WCFM Forum.
- AuthorPosts
- February 1, 2019 at 4:14 pm #46201FuBenduParticipant
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
- February 4, 2019 at 6:43 am #46486WCFM ForumMember
Hi,
1. Is there documentation on the followings module?
– Sorry, No it’s very straight forward2. 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
- February 6, 2019 at 12:44 pm #46872FuBenduParticipant
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 - February 7, 2019 at 12:20 pm #47015WCFM ForumMember
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
- February 14, 2019 at 10:21 am #48132FuBenduParticipant
Hi there
You proposed below but it is not working.
add_filter( ‘wcfm_is_allow_followings_email’, ‘__return_false’ )
any help pls?
Thanks
b - February 14, 2019 at 10:31 am #48148WCFM ForumMember
Hi,
From where you want to hide email? Customer’s following list or vendor’s followers list!
Thank You
- February 14, 2019 at 10:33 am #48151FuBenduParticipant
I want followers to stop receiving emails each time the vendor adds a new product.
Thank you - February 14, 2019 at 10:39 am #48158WCFM ForumMember
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
- February 14, 2019 at 2:08 pm #48215FuBenduParticipant
thank you
- February 14, 2019 at 3:54 pm #48242WCFM ForumMember
You are welcome 🙂
- AuthorPosts
- The topic ‘Followings module’ is closed to new replies.