PHPWordPressWordPress Snippets

Hide Gravity Forms uploads from users without login

add_filter( 'gform_permission_granted_pre_download', function() {
  // If user is logged in
	if ( is_user_logged_in() ) {
		return true;
	} else {
	  // Redirects to the homepage
		echo '<html><meta http-equiv="Refresh" content="0; url=' . site_url() . '" /></html>';
		return false;
	}
});

Leave a Reply