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?

  • Is member_group 1 the same as "Membership Group A"? – jcogs.eecms Jan 7 at 11:06
  • Yes - I just edited the original post to make them the same. – Todd Jan 7 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 Jan 8 at 19:25
2

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

  • I actually thought about doing that if there wasn't a good solution! – Todd Jan 7 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 Jan 7 at 21:46

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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