Closed (duplicate)
Project:
Flag Friend
Version:
6.x-1.0-rc2
Component:
Flag friend access
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
30 Dec 2009 at 07:53 UTC
Updated:
22 Jan 2010 at 20:50 UTC
Hey,
I'm trying to determine some visibility rules and I'm trying to determine whether or not flag_friend_access checkbox is checked on the node edit.
I.E. I'm looking for some code that more or less performs the following '$node->flag_friend_access' = TRUE or FALSE depending on whether it is checking. I have devel enabled and I don't see anything in the $node array. How do I check to see if the particular node has flag_friend_access checked or not?
Thanks!
Comments
Comment #1
rc2020 commentedAnyone? Anything?
Comment #2
Scott Reynolds commentedThere isn't one, its a bad system that I wrote. There is an issue somewhere that details, a.) creation of a table to hold the data b.) adding this to node_load.
Search around and find it. Create a patch and i will review.
Comment #3
rc2020 commentedI looked for this in the queue and I couldn't find it, so I'm marking this as active from duplicate because if no solution can be found I'll use this queue as a launching pad to create the solution meself. I'm looking through the tables on where the heck this info is stored - and I'm having trouble.
The access function uses hook_node_grants() but I don't know where that data is stored on the database tables. Ideally, yes, it would go onto the node tables, so like, $node->grants would be an array of all users accessed to view that node, or something like that.
There needs to be some way to create a conditional for access, that way it gives admins far more flexibility on where to direct users if the access returns false.
Off the top of your head, do you have any clue where this data might be stored? I'm going to check the IRC rooms to ask about hook_node_grants().
Also, as a possible workaround, I might set a cck value on the node or some value somehow to differentiate private nodes from public - but that's not the ideal solution.
Comment #4
rc2020 commentedFrom some searching, it would seem as if the access is put on the node_access table. I'm going to try my hand at writing a function for this. I don't know how to create a patch but if I can get something working I'll submit the function here, barring a better solution from someone more knowledgeable.
Comment #5
rc2020 commentedFound a solution. The data is stored on the node_access table. Here is a function I wrote an included in my flag_friend_access.module.
You can really return any value you want, TRUE/FALSE, or a message. Good for using a custom tpl.php file to control redirects.
NOTE: This function ignores OG access checks which use the same method. You'll have to modify the code to include that check, should be fairly easy.
Here's the code:
Comment #6
rc2020 commentedUpdate: Probably should use boolean values rather than 'open' or 'restricted'. I just modified the function to reflect that:
Comment #7
Scott Reynolds commentedHeres the issue: #486704: Rebuilding node_access doesn't work with flag_friend_access module