ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Permissions for Custom Fields

February 07, 2012 9:32pm

Subscribe [3]
  • #1 / Feb 07, 2012 9:32pm

    thereader

    14 posts

    Is there a way of displaying custom fields on the entry form to specific groups?

    Group A and B can post but only group A can edit a specific field.

    So an editor can come in and select yes to “Is this a homepage article?” or “Is this a slideshow article?”

    Then do an if statement on the field in the slideshow.

    Thanks for any help.

  • #2 / Feb 08, 2012 9:20am

    onedogmedia

    31 posts

    If you are using the standalone entry form, (see this page: http://expressionengine.com/legacy_docs/modules/weblog/entry_form.html), the {custom_fields} loop pulls all the custom fields out automatically to display them, without you being able to do much to control them. 

    You are able to affect how each TYPE of field is displayed (i.e. textarea, textinput, date, relationship), so if all your restricted fields are the same type then you could put an if statement around them that would restrict access to certain groups.  However it would affect all the “textarea” fields for example, and you couldn’t restrict some and not others.

    So you might do something like this inside the SAEF:

    {if textarea}
       {if member_group == 3}
          <textarea name="{field_name}" dir="{text_direction}" cols="50" rows="{rows}">{field_data}</textarea>
       {if:else}
          <!--show what they are allowed to see or leave blank-->
       {/if}
    {/if}

    However at the bottom of the page, in the last comment, it mentions being able to do away with the {custom_fields} loop and just referring to the fields directly using their database name, such as field_id_??  where ?? is the field number.  You’d have to look that ID number up in the database.

    I hope this is helpful, and others can feel free to correct me if I’m wrong!  I’ve had to do a lot of SAEF forms lately and I’ve come up against similar problems.  Good luck.

  • #3 / Feb 09, 2012 1:21pm

    Shane Eckert

    7174 posts

    Hello thereader,

    Thank you for using the ExpressionEngine forums!

    oliversitedesign’s idea is a great direction to take this idea in. Let us know how that goes.

    If this is in the Control Panel, you can create a publish layout for each user group.

    If you have any more questions, please let me know.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases