memberships being counted wrong

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 19 reply threads
  • Author
    Posts
    • #67191
      sdel_nevo
      Participant

      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.
    • #67455
      WCFM Forum
      Member

      Hi,

      Sure, we will fix this in next update.

      Thank You

    • #67462
      sdel_nevo
      Participant

      Hi guys

      Brilliant, many thanks

      Steve

    • #67539
      Craig
      Participant

      awesome! thanks for fixing this

    • #72446
      sdel_nevo
      Participant

      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 days

      this 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

    • #74735
      sdel_nevo
      Participant

      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

    • #74959
      WCFM Forum
      Member

      Will do.

    • #75117
      sdel_nevo
      Participant

      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

    • #75315
      WCFM Forum
      Member

      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

    • #75319
      sdel_nevo
      Participant

      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

    • #75340
      WCFM Forum
      Member

      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

    • #75369
      sdel_nevo
      Participant

      Hi Guys

      I will give you code snippet to fix this.

      oh that would be brilliant, many thanks

      Steve

    • #75770
      WCFM Forum
      Member

      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

    • #75775
      sdel_nevo
      Participant

      Hi guys

      That’s brilliant
      When I’m back in the office I will apply the code, and let you know how it goes

      Steve

    • #75780
      sdel_nevo
      Participant
      This reply has been marked as private.
    • #75943
      sdel_nevo
      Participant

      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 vendor

      Steve

      Attachments:
      You must be logged in to view attached files.
    • #76232
      WCFM Forum
      Member

      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

    • #76261
      sdel_nevo
      Participant

      Hi guys

      many thanks for the code, it removed the wrong memberships 🙂
      however, it appears that the figures are incorrect

      it says I have 5 users on the free account when I only have 3 vendors on that level

      is it counting customers

    • #76353
      WCFM Forum
      Member

      Hi,

      is it counting customers

      – Do you have change this user roles to something else manually?

      Thank You

    • #76354
      sdel_nevo
      Participant

      Hi guys

      No I haven’t changed user roles either manually or with any plugins

      Hope this help

      Steve

Viewing 19 reply threads
  • You must be logged in to reply to this topic.