This patch implements the hook_field_access() hook in CCK. In version 2.5 of CCK, the node object being operated on is provided as an argument to this hook function specifically for modules like CCK Field Privacy.
This removes the need for all other CCK or Views related code or hacks to handle viewing of fields in these various contexts, because that functionality is now handled through CCK's native integration automatically. This results in a massive cleanup of code and the side effect of implementing Panels integration. It will also resolve a number of other issues in the queue, virtually anything dealing with integration with another module like Content Profile, Views, or Panels.
Some specifics:
- hook_nodeapi() is gone.
- _cck_field_privacy_access_check() hook is gone.
- cck_field_privacy.views.inc is unneeded and is now gone as well.
The patch is rolled against cck_field_privacy-6.x-1.x-dev on August 17th. There is some oddness in how SVN diff chose to insert the changes due to the sheer quantity of code I removed, but it should be fine.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | cck_field_privacy-558210.patch | 13.09 KB | sarhugo |
| cck-field-privacy-access.patch | 12.84 KB | CPyle |
Comments
Comment #1
CPyle commentedComment #2
CPyle commentedIssues from the active queue that are affected by this patch:
Comment #3
bloto commentedThis patch has bugs at least for user_relationships:
First for me permission wasn't array but : a:1:{i:0;s:8:"everyone";}
1)
$permissions_arr=unserialize($permissions->permission);
if (is_array($permissions_arr))
foreach ($permissions_arr as $perm) {
2)perm is not a name of module!
$plugin_access_result = module_invoke('user_relationships_api', 'cck_field_privacy_access', $node_user, $user);
3)
and
if ($plugin_access_result === FALSE) {
should be
if ($plugin_access_result == FALSE) {
After applying these fixes it seems to work now with user_relationships.
Regards,
Tomasz
Comment #4
mattlc commentedsubcribing, much more logical than nodeapi and lighter...
For UR integration, why did you use plural_name as key for the form and permission instead of rtid ?
(May no be stabe a long time.)
Comment #5
CPyle commentedI changed nothing in this patch related to user relationships integration. The code both of you are referring to was very recently committed and comes from #377950: Integration of CCK_field_privacy with user_relationship_module . You should probably give them your reports there to look at, as it's still an in-progress feature. I appreciate your testing, though.
Comment #6
sarhugo commentedTested (with the #3 fixes) and working fine with user_relationships
Comment #7
avpadernoThe problem with the proposed patch is the compatibility with older versions of CCK. There are still 38,000 sites using a version of CCK older than 6.x-2.5.
Maybe, it would make more sense to create a branch 6.x-2 that would use the features present in branch 6.x-2 of CCK.
Comment #8
sarhugo commentedAttached updated patch, making cck_field_privacy_access hook called to all modules (not just UR)
Comment #9
vlad.k commentedThis patch works for me. I have an profile page built with Content Profile, Panles and APK. My configuration:
CCK 6.x-2.6
Content Profile 6.x-1.0-beta4
Content Field Privacy 6.x-1.x-dev
Chaos tools 6.x-1.3
Panels 6.x-3.3
Keep up the good work!
Comment #10
avpadernoI am closing this issue, which is for a not supported Drupal version.