Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Membership › memberships being counted wrong
- This topic has 19 replies, 3 voices, and was last updated 5 years, 3 months ago by sdel_nevo.
- AuthorPosts
- June 12, 2019 at 1:22 pm #67191sdel_nevoParticipant
Hi Guys
on my test site, I have 3 membership levels
I have 3 test vendors all on the same membership level (free account)
but the market place plugin shows the number of memberships levels incorrectly, shows I have 3 vendors on one plan, two vendors on another and 5 on the free plan
this happens when moving a vendor from one membership level to another or cancelling a membership
is it possible to get the plugin to count the number of memberships correctly
Steve
Attachments:
You must be logged in to view attached files. - June 13, 2019 at 7:49 pm #67455WCFM ForumMember
Hi,
Sure, we will fix this in next update.
Thank You
- June 13, 2019 at 8:00 pm #67462sdel_nevoParticipant
Hi guys
Brilliant, many thanks
Steve
- June 14, 2019 at 4:10 am #67539CraigParticipant
awesome! thanks for fixing this
- July 14, 2019 at 12:30 pm #72446sdel_nevoParticipant
Hi Guys
was this fix rolled out?
the memberships are still being counted wrong
I have 3 vendors all on the same membership plan (free Plan)
I have 6 membership levels,
Level 1 – 4 (are paid for plans)
The free plan is the entry level
and the cancelled plan that expires after 30 daysthis page is showing I have 6 users on the free plan? 3 users on level 2 and 2 vendors have cancelled memberships
these figures are wrong
I’m running all the latest updates
Steve
- August 1, 2019 at 1:18 pm #74735sdel_nevoParticipant
Hi Guys
this issue is still present in the latest release.
did you get a chance to look into it, I really appreciate all your hard work that goes into something like this
Steve
- August 3, 2019 at 7:02 am #74959WCFM ForumMember
Will do.
- August 4, 2019 at 6:35 am #75117sdel_nevoParticipant
Hi Guys
the problem with the count appears to be this
when testing or when on your live site you go through the process of changing membership levels, but “Do not go through the payment process” the membership is counted as being applied.
i think the membership level should only be applied After the payment has been received from the payment gateway
Steve
- August 5, 2019 at 12:45 pm #75315WCFM ForumMember
Hi,
i think the membership level should only be applied After the payment has been received from the payment gateway
– Yeah right, is user membership change without payment processing?
Thank You
- August 5, 2019 at 12:59 pm #75319sdel_nevoParticipant
Hi
yes during testing (a few versions back) the memberships were changed even without continuing through the payment gateway,
also when the admin changed the vendors level this was not counted correctly.but
since the last update if the vendor changes the membership level, but does not complete the payment the membership count does not change (which is correct)
the problem at least for us is that
currently, the count of membership levels is completely incorrect, which is fine at the moment because we have a few vendors, but I can see this becoming an issue as the site evolves.
do you have a snippet of code, that can recount the current memberships so these are shown correctly?
Steve
- August 5, 2019 at 3:24 pm #75340WCFM ForumMember
Hi,
currently, the count of membership levels is completely incorrect, which is fine at the moment because we have a few vendors, but I can see this becoming an issue as the site evolves.
– We have corrected the problem. But as you already had wrong count so it is stills showing wrong!
I will give you code snippet to fix this.
Thank You
- August 5, 2019 at 4:58 pm #75369sdel_nevoParticipant
Hi Guys
I will give you code snippet to fix this.
oh that would be brilliant, many thanks
Steve
- August 8, 2019 at 2:54 pm #75770WCFM ForumMember
Hi,
Here is that code –
add_action( 'after_wcfm_memberships', function() { $args = array( 'posts_per_page' => -1, 'offset' => 0, 'category' => '', 'category_name' => '', 'orderby' => 'date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'wcfm_memberships', 'post_mime_type' => '', 'post_parent' => '', //'author' => get_current_user_id(), 'post_status' => array('draft', 'pending', 'publish'), 'suppress_filters' => true ); $wcfm_memberships_array = get_posts( $args ); foreach($wcfm_memberships_array as $wcfm_memberships_single) { $membership_users = get_post_meta( $wcfm_memberships_single->ID, 'membership_users', true ); if( $membership_users && is_array( $membership_users ) ) { $filtered_membership_users = array(); foreach( $membership_users as $index => $membership_user ) { $fetch_user = get_userdata( $membership_user ); if( is_a( $fetch_user, 'WP_User' ) ) { $filtered_membership_users[] = $membership_user; } } update_post_meta( $wcfm_memberships_single->ID, 'membership_users', $filtered_membership_users ); } } });
Pleas add this to your site and then browse WCFM Admin Dashboard -> Memberships Page (https://ibb.co/svJRr1S) -> remove the code
Thank You
- August 8, 2019 at 3:04 pm #75775sdel_nevoParticipant
Hi guys
That’s brilliant
When I’m back in the office I will apply the code, and let you know how it goesSteve
- August 8, 2019 at 3:33 pm #75780sdel_nevoParticipantThis reply has been marked as private.
- August 9, 2019 at 12:33 pm #75943sdel_nevoParticipant
Hi Guys
when I passed the code in and browse to the memberships page, the count is still wrong,
I have 3 vendors as per the screenshot, these are all on the same plan “Free plan” but since running the code the memberships show I have 5 on this plan
it also incorrectly shows I have 2 vendors on the level 2 plane and 1 cancelled vendorSteve
Attachments:
You must be logged in to view attached files. - August 12, 2019 at 9:52 am #76232WCFM ForumMember
HI,
Please use this updated code –
add_action( 'before_wcfm_memberships', function() { $args = array( 'posts_per_page' => -1, 'offset' => 0, 'category' => '', 'category_name' => '', 'orderby' => 'date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'wcfm_memberships', 'post_mime_type' => '', 'post_parent' => '', //'author' => get_current_user_id(), 'post_status' => array('draft', 'pending', 'publish'), 'suppress_filters' => true ); $wcfm_memberships_array = get_posts( $args ); foreach($wcfm_memberships_array as $wcfm_memberships_single) { $membership_users = get_post_meta( $wcfm_memberships_single->ID, 'membership_users', true ); if( $membership_users && is_array( $membership_users ) ) { $filtered_membership_users = array(); foreach( $membership_users as $index => $membership_user ) { $fetch_user = get_userdata( $membership_user ); if( is_a( $fetch_user, 'WP_User' ) ) { $vendor_membership = get_user_meta( absint($membership_user), 'wcfm_membership', true ); if( $vendor_membership && ( absint( $vendor_membership ) == $wcfm_memberships_single->ID ) ) { $filtered_membership_users[] = $membership_user; } } } update_post_meta( $wcfm_memberships_single->ID, 'membership_users', $filtered_membership_users ); $associated_group = get_post_meta( $wcfm_memberships_single->ID, 'associated_group', true ); if( $associated_group ) { update_post_meta( $associated_group, '_group_vendors', $filtered_membership_users ); } } } });
Thank You
- August 12, 2019 at 1:01 pm #76261sdel_nevoParticipant
Hi guys
many thanks for the code, it removed the wrong memberships 🙂
however, it appears that the figures are incorrectit says I have 5 users on the free account when I only have 3 vendors on that level
is it counting customers
- August 13, 2019 at 5:38 am #76353WCFM ForumMember
Hi,
is it counting customers
– Do you have change this user roles to something else manually?
Thank You
- August 13, 2019 at 5:43 am #76354sdel_nevoParticipant
Hi guys
No I haven’t changed user roles either manually or with any plugins
Hope this help
Steve
- AuthorPosts
- You must be logged in to reply to this topic.