expired memberships

WordPress Business Themes Forums Responsive Themes Dating Theme expired memberships Reply To: expired memberships

Discontinued - The forum content is out of date. For theme support please use our support desk here.

WordPress Business Themes Forums Responsive Themes Dating Theme expired memberships Reply To: expired memberships

  • JamesD
    JamesD
    Super Guru 1,345 points

    Hello All,

    Try adding this to your _functions.php 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.

    March 19, 2019 at 9:18 pm
  • Didn't find what you were after?

    Chat with us now

    or contact our support team