Skip Registration for Logged In Users

Skip registration if the user is logged in.

Read the Walkthrough

Code

Filename: gw-skip-registration-for-logged-in-users-gt3.php

<?php
/**
 * Gravity Wiz // Gravity Forms // Skip Registration for Logged In Users
 * https://gravitywiz.com/skip-user-registration-for-logged-in-users/
 *
 * Skip registration if the user is logged in. Works for GF User Registration 3.0 and greater.
 *
 * Plugin Name: Gravity Forms - Skip Registration for Logged In Users
 * Plugin URI:  https://gravitywiz.com/skip-user-registration-for-logged-in-users/
 * Description: Skip registration if the user is logged in.
 * Author: Gravity Wiz
 * Version: 0.1
 * Author URI: https://gravitywiz.com/
 */
add_filter( 'gform_is_delayed_pre_process_feed', 'maybe_delay_feeds', 10, 4 );
function maybe_delay_feeds( $is_delayed, $form, $entry, $slug ) {
	if ( is_user_logged_in() && $slug == 'gravityformsuserregistration' ) {
		return gf_user_registration()->has_feed_type( 'create', $form );
	}

	return $is_delayed;
}

add_action( 'gform_pre_process', 'maybe_skip_validation' );
function maybe_skip_validation( $form ) {
	if ( is_user_logged_in() && function_exists( 'gf_user_registration' ) && gf_user_registration()->has_feed_type( 'create', $form ) ) {
		remove_filter( 'gform_validation', array( gf_user_registration(), 'validate' ) );
	}
	return $form;
}

Comments

  1. Kenny Waddell
    Kenny Waddell August 30, 2024 at 10:21 am

    This snippet can be used to overcome an issue when using the Skip Registration for existing e-mail snippet. The issue appears when you try to use the GF User Registration Add-on and the Update User Feed. The feed fails / hangs with a Feed processing is delayed, not processing feed for entry #. However using this snippet it processes the feed correctly. Thanks Wizards your work is outstanding.

    Reply
    1. Samuel Bassah
      Samuel Bassah Staff September 2, 2024 at 5:39 am

      Hi Kenny,

      You’re welcome. Thanks for the kind words. Glad to know how the snippet is useful to you.

      Best,

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.