1

I have a view that includes the Node: Edit link field. When the view gets rendered and the user is logged-in, only an Admin can see the link. What permission settings do I need to have enabled for that link to show up in a role with custom permissions?

Additional details:

Edit link was added to view in the standard way. See screenshot: enter image description here

  • Do you want the user to be able to Edit their own content or any content? – Scott Joudry Sep 22 '13 at 19:18
1

go to:

admin/people/permissions

and check:

Content type name: Edit own content.

if you want that this role can edit ANY content of this type, not only their own conent, then check:

Content type name: Edit any content.

  • Nope... I even rebuilt post permissions afterwards. Any other ideas? – Sam Aug 6 '12 at 19:51
  • how did u add the edit link in the view? – saadlulu Aug 6 '12 at 20:00
  • I added it in standard way... see the screenshot in the question. Does that help? – Sam Aug 6 '12 at 20:08
  • make sure u checked the right content type : Edit own content, and make sure that the user that is trying to edit the content is the actual author. – saadlulu Aug 6 '12 at 20:13
  • Okay... here's the absurd thing: I made my custom role an EXACT MATCH of the editor role's default permissions. Still noting. Then I switched my test user to Editor and it works. Back to custom... no dice. At this point, the two roles are identical. What??? – Sam Aug 6 '12 at 20:19
0

Another factor to consider is whether your site is multilingual. If so, providing role access to a given content type may not be enough.

For example, if Entity Translation is used, you would want to check permissions settings under that heading on the admin/permissions/people page. This was stumping me on a site recently.

As always, exercise extreme caution as to how much control you give users. Even excepting malicious intent, a lot of things can go awry in the hands of inexperienced users.

0

If you look at the code for the Views handler on the node edit link field, it performs a simple node_access check for update permission on the node.

class views_handler_field_node_link_edit extends views_handler_field_node_link {

  /**
   * Renders the link.
   */
  function render_link($node, $values) {
    // Ensure user has access to edit this node.
    if (!node_access('update', $node)) {
      return;
    }

    $this->options['alter']['make_link'] = TRUE;
    $this->options['alter']['path'] = "node/$node->nid/edit";
    $this->options['alter']['query'] = drupal_get_destination();

    $text = !empty($this->options['text']) ? $this->options['text'] : t('edit');
    return $text;
  }
}

So it's not something with Views -- other users just don't have permission to edit the content. And giving "Edit Any Content" permission to all users is not a good idea.

If you want to display the link regardless of whether or not they have access, just create a new Custom Field that is formatted as a link to the edit screen:

1) Click Add Fields for the view

2) Add the node NID number, and a Custom Text Field

3) make sure the node NID number is listed before the Custom Text field so that you can use it as a replacement.

4) Add a a custom field with the below value:

<a href="/node/[nid]/edit">Edit</a>

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.