By gnucifer on
Hi! I'm doing some modifications to the Calendar module theme. I need to have an edit and remove button in the "month-view" for each node but only want to display these buttons to users with sufficient permission to edit or delete these nodes. Is there any way to evaluate a drupal path, say /node/123/edit or node/123/delete for the current user. Like user_access but with drupal paths instead? This would really help me alot. Thanks!
Comments
What I think you want is to
What I think you want is to use node_access, something like this should help
Thank you! Thank you! Thank
Thank you! Thank you! Thank you! That was exactly what I was looking for! :)
another approach
For the more general problem of checking whether user has access to a particular path, I think this might work:
And this was exactly what
And this was exactly what I needed, thank you too!! :-)
API function
These days, you probably want to use drupal_valid_path() ?
Beware though, there are open bugs for this function in Drupal 6/7/8 at this time. It will definitely return warnings under certain conditions, and usage of dynamic paths is sketchy here.
drupal_valid_path Checks a
drupal_valid_path Checks a path exists and the current user has access to it.
https://api.drupal.org/api/drupal/includes!path.inc/function/drupal_vali...
Cheers,
TechNikh
In 30 seconds set up Automated Visual testing of your website. Zero coding. https://drupal.org/project/drulenium
Ever dreamed of styling your view, We have a solution for you. https://drupal.org/project/views_stylizer
Clickable link
Thanks and here is a clickable link for everyone!
https://api.drupal.org/api/drupal/includes!path.inc/function/drupal_valid_path/7
-----------------------------------------------
The Future is Open!
Thank you
Thank you