Conditional Permissions GravityView and Members

4 Replies ·

  1. I am needing some conditional function for my website.

    Here are the user roles I have setup…

    Sales Rep
    Sales Manager
    Administrator

    I am using GravityView on a private website to capture Quotes and generate Work Orders for our factory. I am using a dropdown labeled Status or {Status:272} to move the order throughout the sales and production process.

    Here are the values of the Status dropdwon…

    Quote
    Invoiced
    Deposit Received
    Released to Production
    Ready for Delivery
    Delivered

    Once the Status of an entry is changed to “Released to Production,” I need to change the permissions of the Sales Rep. By default, I have it setup so Sales Rep role can edit gravityview entries. I need this to change once the Status of an entry is changed to Released to Production.

    I’m not good with PHP or know where this should be done… maybe functions.php

    SO…
    if Status=”Released to Production” & Member_role=”Sales Rep”…. hide the Edit button

    Can you help me with this?

  2. Justin Tadlock

    I’m not familiar with the GravityView plugin. It sounds to me (based on your description) like GravityView has a custom post type. Is “status” is a custom post status?

    WordPress’ role/cap system isn’t really designed to do this based on roles (what you’re describing). Roles are really arbitrary groupings of capabilities. It’s the capabilities that matter.

    But, it’s very possible to do this if this is just a custom post type and custom post status. I’d need the following information:

    • What is the name of the “Sales Rep” role? Is it sales_rep?
    • What is the exact name of the custom post type?
    • What is the exact name of the “Released to Production” status?

    When I say “name”, I’m referring to the name/key/slug in the code and not the user-facing label. This info should be readily available from the GravityView plugin author.


    I do want to note that I do not officially support third-party plugins, but I’ll help with this in any way I can.

  3. Matt Duncan

    GravityView uses Datatables to display Gravity Form entries. Here is a list of capabilities that can be controlled through Members plugin.

    (https://docs.gravityview.co/article/311-gravityview-capabilities)

    It looks like the names of the roles are as follows that I have setup in Members roles…

    Sales Rep = sales_rep
    Sales Manager = sales_manager
    Administrator = administrator

    The “Released to Production” status is just one of the potential values in each entry for form field {Status:272}.

    I’m sorry if I’m not knowledgeable on what is what. I’ll try to contact GravityView to help me understand what is what in their output.

  4. Justin Tadlock

    Based on the link you provided above, it looks like this is a custom post type.

    Basically, I need to know how to determine the status (via code) of the gravity view entry. That’s something that the GV plugin author can tell you. Once you get that info, just let me know.


    Honestly, this customization would be easier for the GV plugin author to tell you how to do. There’s nothing inherently related to the Members plugin here. Any code involved would be between GV and WP.