<?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: Adding Custom Capability Issues</title>
		<link>https://legacy.forums.gravityhelp.com/topic/adding-custom-capability-issues</link>
		<description>Gravity Support Forums Topic: Adding Custom Capability Issues</description>
		<language>en-US</language>
		<pubDate>Sat, 04 Apr 2026 07:51:22 +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/adding-custom-capability-issues" rel="self" type="application/rss+xml" />

		<item>
			<title>Chris Hajer on "Adding Custom Capability Issues"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/adding-custom-capability-issues#post-31898</link>
			<pubDate>Fri, 05 Aug 2011 22:55:27 +0000</pubDate>
			<dc:creator>Chris Hajer</dc:creator>
			<guid isPermaLink="false">31898@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thank you for posting back.  Glad you got it worked out.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>travin on "Adding Custom Capability Issues"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/adding-custom-capability-issues#post-31894</link>
			<pubDate>Fri, 05 Aug 2011 22:13:18 +0000</pubDate>
			<dc:creator>travin</dc:creator>
			<guid isPermaLink="false">31894@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Got it, thanks for all your help.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Smith on "Adding Custom Capability Issues"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/adding-custom-capability-issues#post-31883</link>
			<pubDate>Fri, 05 Aug 2011 17:53:18 +0000</pubDate>
			<dc:creator>David Smith</dc:creator>
			<guid isPermaLink="false">31883@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi Travin,&#60;/p&#62;
&#60;p&#62;It'd go something like this:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;[php]
add_action(&#38;quot;gform_user_registered&#38;quot;, &#38;quot;add_custom_user_meta&#38;quot;, 10, 3);
function add_custom_user_meta($user_id, $config, $entry) {

if($entry[&#38;#39;form_id&#38;#39;] != 6)
    return;

wp_set_current_user( $user_id );
$user = wp_get_current_user();
$user-&#38;gt;add_cap (&#38;quot;access_s2member_ccap_test&#38;quot;);
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>travin on "Adding Custom Capability Issues"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/adding-custom-capability-issues#post-31882</link>
			<pubDate>Fri, 05 Aug 2011 17:46:03 +0000</pubDate>
			<dc:creator>travin</dc:creator>
			<guid isPermaLink="false">31882@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I hate to show my ignorance here but how do I use this code snippet? &#60;/p&#62;
&#60;p&#62;Do I put my function between the if and return, or do I add this code in my function.&#60;/p&#62;
&#60;p&#62;I know, NOOB. Thanks for the excellent support.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Smith on "Adding Custom Capability Issues"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/adding-custom-capability-issues#post-31801</link>
			<pubDate>Fri, 05 Aug 2011 07:07:07 +0000</pubDate>
			<dc:creator>David Smith</dc:creator>
			<guid isPermaLink="false">31801@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;For now you can retrieve the form ID from the $entry.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;[php]
if($entry[&#38;#39;form_id&#38;#39;] != 6)
    return;&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>travin on "Adding Custom Capability Issues"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/adding-custom-capability-issues#post-31784</link>
			<pubDate>Thu, 04 Aug 2011 18:06:50 +0000</pubDate>
			<dc:creator>travin</dc:creator>
			<guid isPermaLink="false">31784@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I finally got it. Here is the solution I used:&#60;/p&#62;
&#60;p&#62;add_action(&#34;gform_user_registered&#34;, &#34;add_custom_user_meta&#34;, 10, 3);&#60;br /&#62;
function add_custom_user_meta($user_id, $config, $entry) { &#60;/p&#62;
&#60;p&#62;wp_set_current_user( $user_id );&#60;br /&#62;
$user = wp_get_current_user();&#60;br /&#62;
$user-&#38;gt;add_cap (&#34;access_s2member_ccap_test&#34;);&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;i know the wp_set_current_user fuction returns the WP_user object, I just don't know how to access the return value as I really don't know PHP.&#60;/p&#62;
&#60;p&#62;Now, my last question here, how do I perform this routine on select registration forms?  For instance, only form 6, but not on form 8?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>travin on "Adding Custom Capability Issues"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/adding-custom-capability-issues#post-31645</link>
			<pubDate>Wed, 03 Aug 2011 19:35:09 +0000</pubDate>
			<dc:creator>travin</dc:creator>
			<guid isPermaLink="false">31645@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Been doing a little more testing with the following code:&#60;/p&#62;
&#60;p&#62;add_action(&#34;gform_user_registered&#34;, &#34;add_custom_user_meta&#34;, 10, 3);&#60;/p&#62;
&#60;p&#62;function add_custom_user_meta($user_id, $config, $entry){&#60;/p&#62;
&#60;p&#62;$user_id-&#38;gt;add_cap (&#34;access_s2member_ccap_test&#34;);&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;I get the following error:&#60;/p&#62;
&#60;p&#62;Fatal error: Call to a member function add_cap() on a non-object in /home3/freecla3/public_html/wp-content/themes/Superb/functions.php on line 502&#60;/p&#62;
&#60;p&#62;This code is what s2member uses in their code to add custom capabilities:&#60;/p&#62;
&#60;p&#62;$user-&#38;gt;add_cap (&#34;access_s2member_ccap_&#34; . $ccap);&#60;/p&#62;
&#60;p&#62;Does this help at all?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>travin on "Adding Custom Capability Issues"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/adding-custom-capability-issues#post-31629</link>
			<pubDate>Wed, 03 Aug 2011 17:00:51 +0000</pubDate>
			<dc:creator>travin</dc:creator>
			<guid isPermaLink="false">31629@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thanks.  So is what I am asking to do just not possible or what?  I tried using the instructions on wordpress.org and this site to no avail.  &#60;/p&#62;
&#60;p&#62;Thanks again for your support.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Carl Hancock on "Adding Custom Capability Issues"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/adding-custom-capability-issues#post-31624</link>
			<pubDate>Wed, 03 Aug 2011 16:47:11 +0000</pubDate>
			<dc:creator>Carl Hancock</dc:creator>
			<guid isPermaLink="false">31624@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Be aware if you are applying capabilities to users rather than roles you  may run into future issues with WordPress as they may be deprecating user capabilities in favor of role capabilities only.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>travin on "Adding Custom Capability Issues"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/adding-custom-capability-issues#post-31620</link>
			<pubDate>Wed, 03 Aug 2011 16:43:25 +0000</pubDate>
			<dc:creator>travin</dc:creator>
			<guid isPermaLink="false">31620@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Unfortunately, that won't work for my set up.  I have a free membership and a product that uses the custom capability for registration purposes.  I have to be able to add the custom capability some way other than manually.&#60;/p&#62;
&#60;p&#62;Thanks for the help, but I gotta do it the way we have previously discussed.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
