1

Currently i use safecracker in combination with author_only="yes" to allow members to publish and edit their own news and edit their info page.

What would be a method / procedure or what would you suggest to allow
multiple members to edit one specific entry (e.g. the info page)?

  • I can't just only remove the author_only parameter and allow all members to edit all info pages. Only assigned members should be able to edit an entry.
  • Is a relationship/playa field on the info-page a possible route? How would you check for access-privileges?

Edit: one approach is with categories but this gives more broad access to editors.
Limit Safecracker access to specific entries, using member groups and categories


Edit2: Possible solution, using a modified version of chosen_member addon
(e.g. added a method to check if logged in user is selected)

{exp:channel entries url_title="segment_3" }
  {if chosen_member_field:is_chosen=="yes"}
    {embed="group/safecracker" entry_id="{entry_id}"}
  {/if}
{/exp:channel:entries}
2
  • Where do you want to store the list of the members who will have access to the entries? In the entry itself or in a member group? Or in a global vars? – pvledoux Dec 5 '13 at 10:49
  • with the solution from edit2, it would be stored in the entry itself. i'm trying to avoid creating lots of member groups. A dedicated category group could be an option, but there are no member select custom fields for categories. – GDmac Dec 5 '13 at 19:10
1

Something like this should work. You have to make a 2 steps verification:

{!-- Ensure user is logged in --}
{if logged_out}
    {redirect="/login"}
{/if}
{!-- Check if user can view this entry --}
{exp:channel:entries
    channel="mychannel"
    disable="custom_fields|categories|category_fields|member_data|pagination|trackbacks"
    dynamic="off"
    require_entry="yes"
}
    {if no_results}{redirect="404"}{/if}
    {exp:pvl_checkif value="{member_id}" is_not_in="{authorized_members}"}{redirect="/unauthorised"}{/exp:pvl_checkif}
{/exp:channel:entries}

{safecracker....}

{authorized_members} is your field containing members list. It should be pipe delimited, or you can use an other delimiter and specify it an the delimiter="" parameter of pvl_checkif.

See the doc of pvl_checkif here.

2
  • Nice solution. Note: When not using low- or mo-variables, or my globalmembers plugin, the {if logged_out} is parsed late, and channel entries is still parsed. Note2: inside channel:entries {member_id} is {author_id}, using {logged_in_member_id} gives plugin value a string (e.g. parsed late). Note3. safecracker tag is called before your plugin (and thus before redirect), i like to avoid that (csrf hole). – GDmac Dec 6 '13 at 12:28
  • Concerning logged_out, I'm not sure, maybe with ifelse plugin from Mark Croxton (github.com/croxton/Ifelse). You can use {else} tag inside pvl_checkif to avoid safecracker parsing. For {logged_in_member_id}, devot-ee.com/add-ons/mo-variables. That makes a lot of addons, but it should work. – pvledoux Dec 6 '13 at 13:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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