Download & Extend

Reviews tab was showing for every content type

Project:NodeReview
Version:7.x-1.x-dev
Component:User interface
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Hi !
while setting up Nodereview in our site, we discovered that the "Reviews" tab was showing for every content type (instead of only those configured in admin/config/nodereview). As we started searching for the cause of this behaviour we found out that the path node/%/reviews in hook_menu is also used in the view review_list (we don't know if this clash causes other problems but it didn't look good). The problem is that the function used to filter permissions for the Reviews tab ( read_reviews_access($arg) ) is called from the hook's access callback, but not from the view access validator (so it's never called and the tab is shown everywhere).
Since we are already using the module views_php in our site, we fixed it by adding php code in the access settings of the view. We used
return read_reviews_access(arg(1)); . We can confirm this works as expected, but as a solution, it would add another module dependency to nodereview.
Maybe a solution that doesn't involve views_php would be to use different paths for the hook and the view, and/or just embedding the view from the hook's callback (once the access function has been called).

Comments

#1

This problem exists in the 6.x version as well.

nobody click here