The hook_nodeapi() implementation of cck_field_perms has to be executed after the one implemented by the content module, otherwise
the content module overrides the #access = false settings made by cck_field_perms.

If cck_field_perms is installed into the same modules folder as the cck modules everything is fine. But if cck_field_perms is installed in another folder you might run into problems, since the modules are executed in the following order:

... ORDER BY weight ASC, filename ASC

To circumvent this, the modules weight has to be higher than the weight of content module. Therefore I suggest to add a .install file to the module in which the cck_field_perms_install() takes care of setting the appropriate weight for this module.:


// cck_field_perms.install

function cck_field_perms_install() {
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
    case 'pgsql':
      $weight = (int) db_result(db_query("SELECT weight FROM {system} WHERE name = 'content'"));
	  db_query("UPDATE {system} SET weight = %d WHERE name = 'cck_field_perms'", $weight + 1);
      
      break;
  }
}

However I do not know if the update statement works for pgsql!

Since the solutions to the issue described in my last two posts are suggested bug fixes, i moved this issue into the bug category and changed the status to patch.

Comments

liquidcms’s picture

Doesn't seem to help for me. I don't get cfp module doing much of anything - and weight is set to 100.

kingandy’s picture

This worked for me!

Note that if you already have the module installed (and I think that includes 'disabled but not uninstalled') then altering the .install file will accomplish jack. You have to alter the weight directly in the database. If you don't have direct database access, you can achieve this by creating a page using the PHP filter and entering the actual DB-code from the above:

      $weight = (int) db_result(db_query("SELECT weight FROM {system} WHERE name = 'content'"));
      db_query("UPDATE {system} SET weight = %d WHERE name = 'cck_field_perms'", $weight + 1);

You don't even have to commit the page, previewing it will fire the code.

For those folks too timid even for that, there's always the module-weight-controlling Module Weight module.

I'm really surprised this isn't something that you can set in the module .info file.