I'm looking for the best way to show 2 different blocks of info.
Default: info letting user know they need to complete an access request form ( webform )
After: Display form to user that completed access request

Should I assign the before\default text to the auth user and then add the form access with a rule\trigger?
Or, do I need a before ROLE that shows the text, and an AFTER role that shows the form?

Just trying to get the 'best use' answer without creating a ton of roles for the different forms we want to control.

Help Appreciated

Comments

semperos’s picture

Seems like this is a question of "how do I best create a programmatic context for two options related to users". You have a number of options, each with pros/cons:

  • Use built-in things like roles. Pros: no coding, part of Drupal core. Cons: If you have a lot of user "states", you probably don't want to create 50 user roles.
  • When you need to display something to the user, query the database. If it's "if this person hasn't submitted this webform, show them something", you can query the database table which contains Webform's submission data and check for an entry with the user's user id and the node id of the webform. If there's a row, that person has submitted the form, and you can show them what you need. If you get no results back, they haven't submitted it. Pros: no extra modules/functionality, just checking default database results. Cons: coding.
  • Create a small custom module with its own regular/cache table. Maybe you need to check a bunch of things to determine the right context, or for performance reasons you don't want to be querying the database for every time you need to display this variable information. You can create a small custom module with its own regular table, where you store relevant information and query it later, or you can use Drupal's caching mechanisms to do the same thing. Pros: complete flexibility and power. Cons: coding.

When I say coding as a con, I mean for the time/complexity it might add for folks not 100% comfortable coding. I think coding is a plus when it's the cleanest, most performant and most elegant solution.

bsmith451’s picture

Thanks for the input. It re-enforces what I thought, using Roles is the fast\dirty answer, coding is the proper\longer answer.

Thanks