reply

Home Forums Responsive Themes Dating Theme expired memberships Reply To: expired memberships

  • JamesD
    JamesD
    March 19, 2019 at 9:18 pm

    Hello All,

    Try adding this to your and see if it helps:
    /**
    *
    * Restrict login if no active membership
    *
    * Fired by authenticate action hook.
    *
    * @access public
    *
    * @param WP_Object $user
    * @param string $username
    * @param string $password
    * @return object (either WP_Object or WP_Error)
    */
    add_filter( 'authenticate', 'check_active_account', 30, 3);
    function check_active_account($user, $username, $password) {
    global $CORE;
    $subs = get_user_meta($user->ID, 'wlt_subscription',true);
    if(is_array($subs)){
    $validate_sub = $CORE->date_timediff($subs['date_expires'],'');
    $expired = $validate_sub['expired'];
    // Display message why denied
    return ($expired)?new WP_Error( 'broke', __( "Membership Not Active", "premiumpress" ) ):$user;
    }
    }
    Note: Test it to make sure it covers the situations you need. It may need to be tweaked.