0

I'm running a site with EE 2.11.9. I have a channel form that allows our members to update the title, description, etc. of the entry However, they can't edit the categories unless they belong to a Membership Group 1.

If a user belongs to Membership Group 1, then everything works fine. However, if they belong to Membership Group 2, then the categories are erased when they hit Submit to save the form.

Here is my code:

{if member_group == '1' }
<select name="category[]" id="categories" size="8" multiple="multiple">
    {categories show_group="12"}
        <option value="{category_id}"{selected}>{category_name}</option>
    {/categories}
</select>
{/if}

If I remove that part from the Channel form, then everything works fine (except admins can't edit the categories).

Any suggestions on how to save the current categories if you aren't an admin?

3
  • Is member_group 1 the same as "Membership Group A"? Commented Jan 7, 2019 at 11:06
  • Yes - I just edited the original post to make them the same.
    – Todd
    Commented Jan 7, 2019 at 15:09
  • It is annoying, but it is actually how the Channel API works; every time you save an entry, you must submit every piece of data, and any missing data is NULL and converted to an empty string: docs.expressionengine.com/v2/development/api/… I once wrecked 100 entries without a backup doing this. Lesson learned; always use dev servers and backups for development.
    – jrothafer
    Commented Jan 8, 2019 at 19:25

1 Answer 1

2

It's not EE related and maybe wrong. But you can hide (with css) if member_group_id != 1

2
  • I actually thought about doing that if there wasn't a good solution!
    – Todd
    Commented Jan 7, 2019 at 14:05
  • I ended up using CSS with "display:none" if the user wasn't in the proper group. Might not be the best solution, but in this case it did the trick!
    – Todd
    Commented Jan 7, 2019 at 21:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.