• Resolved rommelgracias

    (@rommelgracias)


    Hi,

    I am trying to send Paid Membership Pro’s user/member membership expiry date to a Zero BS CRM custom field called Membership Expiry using WP Fusion.

    In Custom Fields settings on WP Fusion, it finds the Zero BS CRM custom field called Membership Expiry. Ive added the meta key ‘enddate’ from PMPro to the meta field list but when I register as a new user, I dont get any data in that field. Even the log shows that there is no attempt at finding that field. I have “Push All” checked in General Settings.

    I have the following functions in my functions.php file in an attempt to make it push the data through:

    function my_wpf_filter_registration( $user_meta, $user_id ) {

    if( isset( $_POST[‘membership-expiry’] ) ) {
    $user_meta[‘enddate’] = $_POST[‘membership-expiry’];
    }
    return $user_meta;
    }
    add_filter( ‘wpf_user_register’, ‘my_wpf_filter_registration’, 10, 2 );

    add_action( ‘user_register’, ‘zerobscrm_user_register’ );
    function zerobscrm_user_register( $user_id ) {
    if ( ! empty( $_POST[‘membership-expiry’] ) ) {
    update_user_meta( $user_id, ‘enddate’, trim( sanitize_text_field($_POST[‘membership-expiry’] ) ) );
    }
    }

    Is there anything you could do to help? Im really stuck.

    Thanks
    Rommel

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author verygoodplugins

    (@verygoodplugins)

    Hi @rommelgracias ,

    As you know the free version of WP Fusion doesn’t support MemberPress…. so I can try and point you towards some ideas, but you might save yourself some effort by buying the full version, as we’ve already figured all of this stuff out and syncing the expiration date is automatic.

    Your code looks right in theory but I don’t *think* that membership-expiry is POSTed in with the registration data.

    MemberPress has a lot of different hooks depending on if the user is purchasing a subscription, a one-off transaction, or a subscription with a trial. Each one has a slightly different method of getting the expiration date.

    What we’ve done to get the expiration date out of the purchase “event” looks something like

    $txn = $event->get_data();

    if ( ‘complete’ != $txn->status ) {
    return;
    }

    if ( strtotime( $txn->expires_at ) >= 0 ) {
    $user_meta[‘enddate’] = $txn->expires_at;
    }

    This is that full function: https://pastebin.com/GMZ34JNS

    Keep in mind that’s just for a checkout, it won’t update the expiration date when a subscription renews, that has its own logic.

    And remember this *isn’t* supposed to work with WP Fusion Lite, we keep this functionality in the full version of the plugin…. so if you still can’t get it I’d suggest upgrading ??

    Jack

Viewing 1 replies (of 1 total)
  • The topic ‘Not pushing Paid Membership Pro expiry date to Zero BS CRM’ is closed to new replies.