<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Gravity Support Forums Topic: Turn off &#039;required&#039; fields if user is Wordpress admin ??</title>
		<link>https://legacy.forums.gravityhelp.com/topic/turn-off-required-fields-if-user-is-wordpress-admin</link>
		<description>Gravity Support Forums Topic: Turn off &#039;required&#039; fields if user is Wordpress admin ??</description>
		<language>en-US</language>
		<pubDate>Mon, 20 Apr 2026 01:12:43 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>https://legacy.forums.gravityhelp.com/search.php</link>
		</textInput>
		<atom:link href="https://legacy.forums.gravityhelp.com/rss/topic/turn-off-required-fields-if-user-is-wordpress-admin" rel="self" type="application/rss+xml" />

		<item>
			<title>Chris Hajer on "Turn off &#039;required&#039; fields if user is Wordpress admin ??"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/turn-off-required-fields-if-user-is-wordpress-admin#post-96795</link>
			<pubDate>Thu, 29 Nov 2012 00:57:08 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">96795@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;There is more to gform_validation thatn you are showing here.  Is that all your code? Please see the documentation here: &#60;a href=&#34;http://www.gravityhelp.com/forums/topic/extract-file-upload-name-in-email-notification#post-69404&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/forums/topic/extract-file-upload-name-in-email-notification#post-69404&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Instead of pretending the fields are valid when logged in as an admin, no matter what was submitted, how about using the gform_pre_render filter and applying it only when the user is a logged in admin?&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Gform_pre_render&#34; rel=&#34;nofollow&#34;&#62;http://www.gravityhelp.com/documentation/page/Gform_pre_render&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;You have access to the $form object, and each field in the form has an 'isRequired' item in the array:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;// loop through all the fields
$form[&#38;#39;fields&#38;#39;][0][&#38;#39;isRequired&#38;#39;] = 0; /* or possibly &#38;#39;&#38;#39; */&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;You could set them all to 0 or clear them out if the logged in member is an admin.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Deepend on "Turn off &#039;required&#039; fields if user is Wordpress admin ??"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/turn-off-required-fields-if-user-is-wordpress-admin#post-96787</link>
			<pubDate>Thu, 29 Nov 2012 00:30:54 +0000</pubDate>
			<dc:creator>Deepend</dc:creator>
			<guid isPermaLink="false">96787@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi, I am trying to make a form that has required fields, but if user is a logged-in wordpress admin, the required fields don't need to be filled in...  I thought something like this would do it:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;#39;gform_validation_2&#38;#39;, &#38;#39;admin_override&#38;#39;, 10, 4);
function admin_override($result, $value, $form, $field){
	if ( current_user_can(&#38;#39;manage_options&#38;#39;) )
     {
        $result[&#38;quot;is_valid&#38;quot;] = true;
     } else {
        $result[&#38;quot;is_valid&#38;quot;] = false;
     };
	return $result;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;But it doesn't work, in fact it stops the form from loading all together... Can anyone please help me work this out?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
