Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save spivurno/a9d80f6afb5cd46cf8c2 to your computer and use it in GitHub Desktop.
Save spivurno/a9d80f6afb5cd46cf8c2 to your computer and use it in GitHub Desktop.
Gravity Wiz // Gravity Forms // Skip Registration for Logged in Users
<?php
/**
* Skip Registration for Logged In Users
* http://gravitywiz.com/2012/04/24/skip-user-registration-for-logged-in-users/
* Works for GF User Registration 3.0 and greater.
*/
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;
}
@Critter
Copy link

Critter commented Jul 11, 2016

I cannot get the maybe_delay_feeds method to fire. The maybe_skip_validation fires, but not the top.
GF 2.02
GF UserReg 3.3

any suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment