Support » Plugin: Expire Users » CUSTOM REGISTRATION FROM – GRAVITY FORMS

  • Good day,

    Thank you for a great plugin, which has become essential to our business! I have one question though.

    We are using the plugin to manage the expiry for users subscribing to a trial period via a custom registration page. The form on the custom registration form is done with Gravity Forms and the User Registration add-on.

    One of your plugin settings is to “Automatically set expiry date for new users who register via the registration form.”, but that does not work if I use the custom registration form. Any ideas on how I can get this to work would be appreciated.

    Regards
    Riaan

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Did you get any help with this? I have the same issue

    Thread Starter RiaanC

    (@riaanc)

    Hi. No I did not. Currently I have to manually set the expiry date so it is not truly automated.

    If you use the default WP registration form it works just fine.

    Do you know if it works with WPForms?

    Thread Starter RiaanC

    (@riaanc)

    No sorry. I have not tested that.

    // Setup Gravity Forms Memberships Hooks
    add_action( ‘gform_user_registered’, ‘saf_cc_add_custom_user_meta’, 10, 4 );
    function saf_cc_add_custom_user_meta( $user_id, $feed, $entry, $user_pass ) {
    $time_period = trim($entry[8]);

    if($feed[‘form_id’] != 1) {
    return;
    }

    $user = get_user_by( ‘id’, $user_id );
    if(!empty($user)) {
    $current_time = current_time(‘timestamp’);
    if($time_period == ‘One Day for $15|15’) {
    $new_time = ‘+1 day’;
    } else if ($time_period == ‘One Week for $30|30’) {
    $new_time = ‘+1 week’;
    } else if( $time_period == ‘3 Months for $250|250’) {
    $new_time = ‘+3 months ‘;
    } else if ($time_period == ‘6 Months for $500|500’) {
    $new_time = ‘+6 months’;
    } else if ($time_period == ‘1 Year for $800|800’) {
    $new_time = ‘+1 year’;
    } else {
    $new_time = ”;
    }

    $time = strtotime($new_time, $current_time);
    $default_settings = array (
    ‘default_to_role’ => ‘subscriber’,
    ‘reset_password’ => false,
    ’email’ => false,
    ’email_admin’ => false,
    ‘remove_expiry’ => false,
    );

    $updated = update_user_meta($user_id, ‘_expire_user_settings’, $default_settings );
    $updated = update_user_meta($user_id, ‘_expire_user_date’, $time );
    $updated = update_user_meta($user_id, ‘_expire_user_expired’, ‘N’ );

    }
    }

    function my_expire_users_expired( $user ) {
    //may be we need it in future
    }

    add_action( ‘expire_users_expired’, ‘my_expire_users_expired’ );tions here */

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘CUSTOM REGISTRATION FROM – GRAVITY FORMS’ is closed to new replies.