scooter41 Posted April 23, 2008 Share Posted April 23, 2008 I currently have a system where infinite subcats are linked simply via a parentID field The problem I am having, is I want to apply user access to a category, but need all the sub categories to be affected too. I have userID's in an 'access' field that I can search. main cat 1 - sub cat 2 - sub cat 3 - sub cat 4 - So for example if I open subcat4, is there any easy way to detect if the user has permission from main cat 1, or is it a case of looping through the parent ID's going up a level each time and seeing if the userID is present in the access field? Link to comment https://forums.phpfreaks.com/topic/102541-subcats-linked-via-a-parentid-going-backwards-through-the-subcats/ Share on other sites More sharing options...
Spaceman-Spiff Posted April 23, 2008 Share Posted April 23, 2008 Unless you have a list of all parent categories handy (or stored in some var/array associated in each subcats), you probably will need to write a recursive function to check the permissions. Link to comment https://forums.phpfreaks.com/topic/102541-subcats-linked-via-a-parentid-going-backwards-through-the-subcats/#findComment-525101 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.