Hi

I discovered that cck_private_fields_get_node_privacy_status returns an array of private cck fields where theirs private-status is 0, regardless of the actual settings of the field. I looked into the code and found out, that casting "cck_private_fields_(0|1|2)" to int always results in 0.

Reading the doc at http://php.net/manual/en/language.types.string.php#language.types.string... it seems, that this is a bug. I'll try to deliver a patch the next days.

Comments

markus_petrux’s picture

Status: Active » Postponed (maintainer needs more info)

I'm not really sure what you mean. This is the code of the function cck_private_fields_get_node_privacy_status():

/**
 * Get the privacy status for the given node revision.
 */
function cck_private_fields_get_node_privacy_status($vid) {
  $fields = array();
  $result = db_query("SELECT field_name, privacy_status FROM {cck_private_fields} WHERE vid = %d", $vid);
  while ($data = db_fetch_object($result)) {
    $fields[$data->field_name] = (int)$data->privacy_status;
  }
  return $fields;
}

It reads the privacy status from the database, where the SQL statement returns a string, it cast that to an integer, but that does not seem incorrect, I think.

Could you please clarify?

stmh’s picture

Hi,

i digged a bit deeper into this issue, and the root cause was that the default-values for the various privacy options were saved as "cck_private_fields_0", "cck_private_fields_1" or "cck_private_fields_2" into the database and not as their integer-values 0,1 or 2 when a node was saved with new privacy-settings.

Instead of digging deeper into the code I installed the dev-version of the module, and now it seems to work correctly.

Sorry for the noise!

cheers,
Stephan