Hi,

we're using 'Fivestar' CCK fields to allow users to vote on certain node types.

After temporarily disabling the 'Fivestar' module, all CCK Fivestar fields and widgets are gone. The 'Fivestar' module has been re-enabled.

At ./admin/content/node-type/image/fields we're now getting error messages like:

This content type has inactive fields. Inactive fields are not included in lists of available fields until their modules are enabled.
Rating (field_rating) is an inactive Fivestar Rating field that uses a Stars widget.

Neither the Fivestar- nor the CCK UI allow to "re-activate" those fields and widgets after the 'Fivestar' module has been enabled again.

There have been lots of similar reports, as well for the 'Fivestar' module (e.g. #327041: fivestar field missing after upgrade to drupal 6.6) as for many other CCK modules (e.g. #590860: Option Widget Inactive Fields , #404352: Image (field_image_cache) is an inactive image field, #467890: Date (field_date) is an inactive Datetime field, #486760: Allow removal of inactive fields when module not installed, #483084: Deleting inactive fields); so this issue obviously has two aspects: one that applies especially to the handling of 'Fivestar' CCK fields by the module itself when the module is being disabled and re-enabled; and a broader one that applies generally to CCK: the latter one is far beyond my scope of understanding so I won't be able to file a proper issue against CCK.

Quicksketch provided a workaround which requires some user frontend to MySQL like PhpMyAdmin:

- In the table "content_node_field" set the "active" column to 1 for the Fivestar field.
- In the table "content_node_field_instance" set the "widget_active" column to 1 for the Fivestar field instance.

Since we don't have PhpMyAdmin installed, a set of SQL commands would be helpful. Let's try...:

mysql> select field_name from content_node_field where active = 0;
+--------------+
| field_name   |
+--------------+
| field_rating |
+--------------+
1 row in set (0.00 sec)

mysql> select field_name from content_node_field_instance where widget_active = 0;
+--------------+
| field_name   |
+--------------+
| field_rating |
| field_rating |
+--------------+
2 rows in set (0.00 sec)

OK, that's our field. Now we tried:

mysql> UPDATE content_node_field SET active = 1 WHERE field_name='field_rating';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1  Changed: 0  Warnings: 0

mysql> UPDATE content_node_field_instance SET widget_active = 1 WHERE field_name='field_rating';
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2  Changed: 2  Warnings: 0

That seems to fix the issue for now. I hope we havn't broken anything - I wasn't ware that using Drupal would require SQL skills.

I'm setting this issue to 'critical' because

  • already entered data (meaning: votes) dissappears (meaning: can't be accessed or displayed anymore);
  • views that are based on Fivestar votes do break completely (missing/broken handler);
  • temporarily disabling a module is a common troubleshooting procedure in the Drupal world; it must not happen, that trying to resolve one issue results in reproducably causing another issue (meaning: breaks a module like "Fivestar"); and last but not least
  • neither the Fivestar- nor the CCK UI allow to "re-activate" those fields and widgets after the 'Fivestar' module has been enabled again; it is inacceptable to be forced to manipulate CCK database tables to resolve issues like this when prominent CCK developers like KarenS explicitly are advising against users to manipulate CCK database tables.

Thanks & greetings,
-asb

Comments

asb’s picture

Backside of this "hackish" approach: Now we're getting this error when creating nodes with the 'Fivestar' CCK field on it:

warning: Invalid argument supplied for foreach() in /var/www/drupal/sites/all/modules/cck/content.module on line 1022.

I'm not sure what this causes, if it is bad and I have no idea how to cleanly resolve this.

The code around line 1022 of content.module reads:

    case 'insert':
    case 'update':
      foreach ($type['tables'] as $table) {
        $schema = drupal_get_schema($table);
        $record = array();
        foreach ($schema['content fields'] as $field_name) {
          if (isset($node->$field_name)) {
            $field = content_fields($field_name, $type_name);
            // Multiple fields need specific handling, we'll deal with them later on.
            if ($field['multiple']) {
              continue;
            }
            $db_info = content_database_info($field);
            foreach ($db_info['columns'] as $column => $attributes) {
              $record[$attributes['column']] = $node->{$field_name}[0][$column];
            }
          }
        }

Edit: OK, now I know what this warning causes: Votes are no longer accepted, neither by editing the node directly nor through a VBO bulk operation ('Modify node fields'). So the current status after diabling and re-enabling 'Fivestar' module, and then fiddling with the CCK tables as described above is:

  • Fivestar CCK widgets are visible when editing the node; users that can edit node can vote; anonymous users can't vote on the Fivestar CCK widget (as before, this is a separate issue, see comment #4 in #538210: Anonymous users can view but not vote (that's what I'm after));
  • The votes are "rejected" or not "registered", they don't show up in node display; however, the ("empty") widget displays;
  • Old votes are accessible to Views; old views are working again, but they don't get updated with new votes since no new votes are coming in;

Greetings, -asb

ezra-g’s picture

Status: Active » Closed (duplicate)

Thanks for trying to help here. This is a duplicate of #583476: "inactive Fivestar Rating field that uses a Stars widget." After re-enabling fivestar. Please see the temporary solution there.