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.

How to find out User role

  1. katiebegood
    Member

    Ok, I'm designing a "shop local" website. I am using Gravity Forms plus the registration and PayPal plugin to register the business and assign a package (bronze, silver or gold) to the user "role". Once they have registered and paid, they will be sent to a page to fill out their business information. This form will show them fields to fill out based on what package (role) they chose. So, I need to know how to retrieve the "role" the signed in user is to be able to set the conditional logic. Can someone tell me how I can retrieve the "role" of the signed in user. I'm sure it's pretty easy, but it's alluding me.

    Posted 13 years ago on Sunday April 29, 2012 | Permalink
  2. When you say they get sent to a page - how will they get to that page and when - meaning, is this a link that will be auto-generated, in an email, etc. I'm thinking you can just setup a field in the more detail form that is set to admin-only and then populate the form with the 3 options (in which you can use conditional logic against) and pass the value dynamically either via query string or short code.

    Posted 13 years ago on Monday April 30, 2012 | Permalink
  3. katiebegood
    Member

    What I was planning was to have a menu available to a logged in user. The menu will tell then to "create a profile" or "update a profile". So, when they got to the Gravity Form, I need to be able to retrieve their user "role" to do the conditional logic. If you can think of a better way to do this, I'm open to suggestions. I feel like I'm running in circles here.

    Here's what I need to do: I am uploading business information from a list I purchased. It will have their business name, address and phone number. If a business wants an upgraded listing, they will go to a page where they will sign up for one of the packages, thus making them a registered user with their role set to the package they purchased. They will then either find their listing (if it's there) and click on a button to "claim" the listing. This will take them to the form where they enter more information on their business. What information they can enter is based on what package they purchased. If there is not a listing for their business, they will create a new listing with a gravity form. Again, what they can enter will be based on the package they purchased.

    Any help you can give me will be GREATLY appreciated.

    Posted 13 years ago on Monday April 30, 2012 | Permalink
  4. Hi Katie,

    The user role is decent way to handle this. Here is an article that will provide the basis for the rest of my answer:

    http://gravitywiz.com/2012/03/07/gravity-forms-conditional-logic-based-on-user-login/

    In this article, it simply checks if the user is logged in or not. Since you want to apply the conditional logic based on the user's role, you'll need to go a step further.

    There is no merge tag for populating the user role (as of v.1.6.4). You'll need to activate the "Allow field to be populated dynamically" option, specify a parameter name, and then bind a function to the "gform_field_value_{parameter_name}" hook to populate that field with the user role. Here is an article specifically about this:

    http://gravitywiz.com/2012/04/30/dynamically-populating-user-role/

    Posted 13 years ago on Monday April 30, 2012 | Permalink
  5. katiebegood
    Member

    Thank you....thank you.....thank you!!!!

    That was exactly what I needed. I knew it had to be pretty easy, but I couldn't find this in a google search. Actually, I did find a site that told me how to do it, but the code didn't work whereas yours did!

    Posted 13 years ago on Friday May 4, 2012 | Permalink
  6. That's because Dave is the man! Glad you got it working.

    Posted 13 years ago on Friday May 4, 2012 | Permalink

This topic has been resolved and has been closed to new replies.