PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Forms limited to registered users only - correlation with their user account?

  1. christine
    Member

    Hi there,

    I am investigating using Gravity Forms for, among other things, controlling contest submissions that are only open to registered users of the site.

    I am planning on creating a form that displays or doesn't depending on whether the user is logged in, but ideally, that form would just need to consist of an "Enter the contest" button, and we would use the registered user data to contact the winner. However I'm not sure if a form that is submitted by a registered user forms some sort of correlation between their user account and the submission (eliminating the need to collect an email address again).

    Would anyone be able to tell me if this is possible?
    Thanks,
    Christine

    Posted 14 years ago on Tuesday August 17, 2010 | Permalink
  2. Christine,

    There aren't any built in permissions in Gravity Forms for regulating who sees the forms or not.

    A couple of people had a similar request and used the "member content" shortcode to display the form. You can find the link to that on this previous thread.

    http://forum.gravityhelp.com/topic/only-registered-users#post-6635

    You may be able to use one of the role manager plugins to do this as well. Gravity Forms itself has integration with the Members plugin.

    I personally prefer the shortcode method because it's simple to implement anywhere.

    To pre-populate the email address for a registered user, you simply edit the email field, click on the advanced tab then select the "User Email" from the default value field and you're good to go.

    admin screenshot

    Posted 14 years ago on Tuesday August 17, 2010 | Permalink
  3. christine
    Member

    Hi Kevin,

    I think this is a pretty good solution. Thanks for the detailed reply!

    Christine

    Posted 14 years ago on Wednesday August 18, 2010 | Permalink
  4. autocom
    Member

    Hi there. Still me, just with a new account after purchasing.

    I have the plugin up and running, but when I try and embed a form within a shortcode - either using my own ([member]) or one with the "members" plugin ([access role="editor"]) - the form shortcode doesn't run and I just get stuck with the plain text of the shortcode in my post.

    Doesn't seem to be an issue with the role shortcut, as it's displaying/not displaying correctly. Any ideas what might be causing this?
    Christine

    Posted 14 years ago on Wednesday August 18, 2010 | Permalink
  5. @autocom Depending on how those shortcodes are setup it could interfere with shortcodes running within them. I'm not familiar with the shortcode method of protecting content with the Members plugin. I would suggest using the "Content Permissions" functionality so you set the permission on the entire post/page rather than via shortcode.

    To use the Content Permissions functionality, after you activate it you then need to edit the Admin role and add the restrict_content capability so the interface appears for your role in the post/page editor.

    Also when using the Members plugin to edit Roles be sure to edit the Admin role and make sure all the Gravity Forms related capabilities are active.

    Posted 14 years ago on Wednesday August 18, 2010 | Permalink
  6. autocom
    Member

    @Carl - unfortunately I cannot block access to the entire post. The idea is to show a description of the contest to everyone, but only logged in users can submit their name. So I need some kind of conditional show/hide logic.

    Sorry to insist, but it really seems like this should be possible, considering that apparently other users have implemented it, and that the Members plugin supposedly "integrates with Gravity Forms out of the box" (from the docs). I purchased the plugin based on the need for this functionality.

    I would integrate the call for the form into the theme, but I'm not sure how to conditionally change the form ID without some kind of system of an additional piece of meta data that would match the ID of the desired form... which just seems a little ridiculously complicated.

    Any other thoughts on what might be causing the issue?

    Posted 14 years ago on Thursday August 19, 2010 | Permalink
  7. The Members plugin integrates with Gravity Forms for the purpose of Role Management. The Members plugin has other functions, but it is the Role Management that people primarily use it for.

    The reason why the Gravity Forms shortcode is not executing when wrapped in the Members access control shortcode is the Members shortcodes are most likely not setup to parse shortcodes within them. It's an issue in the Members plugin itself, not Gravity Forms.

    The Members plugin code would have to be updated so it's shortcodes call the do_shortcode function to parse any shortcodes that appear within them.

    Do a search for "do_shortcode" on this page and you will see what I am referring to:

    http://codex.wordpress.org/Shortcode_API

    Shortcodes are only parsed one level deep unless the code associated with the shortcode is explicitly told to parse any shortcodes that are enclosed within itself.

    I'll look at the Members code and see what needs to change. It's probably an easy change.

    Posted 14 years ago on Thursday August 19, 2010 | Permalink
  8. I just looked at the Members plugin and that is exactly what is going on. It isn't parsing shortcodes that appear within the Members related access control shortcodes, which is why the Form isn't being displayed. This can be fixed by changing the Members plugin.

    The file you would change is:

    members/components/shortcodes/shortcodes.php

    In that file wherever you see:

    return $content;

    Change it to:

    return do_shortcode($content);

    That should then run the content through the shortcode parsing function before outputting the content.

    Posted 14 years ago on Thursday August 19, 2010 | Permalink
  9. autocom
    Member

    @Carl, this did just the trick. Thanks so much for your help and for taking the time to look into this, it's really appreciated. I'm looking forward to using your plugin!

    Posted 14 years ago on Thursday August 19, 2010 | Permalink