Accessing CCK field data (single, multiple, or shared) from another module
Gracious developers, CCK people especially... I wrote an access control module that works with the node relativity module to cascade permissions to all nodes lower in a hierarchy. I hard-coded a query for a userreference field on a custom content type as one way to give a user access to a node (and its descendants). In generalizing this, the current stumbling block is the way CCK stores single instances in the content data table and shared instances of a field in a separate table. Is there a function for getting the data that you can just give a node type and a field name and it handles the rest? Or is there a place to check what the case is for a particular field? (Even a "column_exists()" function would do it for me, but haven't found one in PHP...) It's being developed in Drupal 5 and fixing this (as well as saving explicitly permitted users when creating a new node) is all that's needed for posting the project for general use. Many thanks, ben Agaric Design Collective Open Source Web Development http://AgaricDesign.com/ People Who Give a Damn building the infrastructure of a network for everyone http://pwgd.org/
Is there a function for getting the data that you can just give a node type and a field name and it handles the rest?
This is something I've just run into as well. I have a hardcoded to query the DB for the multiple field table, but have a TODO in there to find the right API call. Rob Roy Barreca Founder and COO Electronic Insight Corporation http://www.electronicinsight.com rob@electronicinsight.com Benjamin Melançon wrote:
Gracious developers, CCK people especially...
I wrote an access control module that works with the node relativity module to cascade permissions to all nodes lower in a hierarchy. I hard-coded a query for a userreference field on a custom content type as one way to give a user access to a node (and its descendants).
In generalizing this, the current stumbling block is the way CCK stores single instances in the content data table and shared instances of a field in a separate table.
Is there a function for getting the data that you can just give a node type and a field name and it handles the rest?
Or is there a place to check what the case is for a particular field? (Even a "column_exists()" function would do it for me, but haven't found one in PHP...)
It's being developed in Drupal 5 and fixing this (as well as saving explicitly permitted users when creating a new node) is all that's needed for posting the project for general use.
Many thanks,
ben
Agaric Design Collective Open Source Web Development http://AgaricDesign.com/
People Who Give a Damn building the infrastructure of a network for everyone http://pwgd.org/
participants (2)
-
Benjamin Melançon -
Rob Barreca