error when setting binding

Sharique - May 6, 2008 - 19:18
Project:Custom review
Version:5.x-2.0-1
Component:Code
Category:bug report
Priority:critical
Assigned:Striky2
Status:closed
Description

I have enabled custom review module, and created a cck type and which has a five star field, When i set binding I get this error,

    * warning: Invalid argument supplied for foreach() in /var/www/html/dtesting/modules/node/node.module on line 521.
    * warning: implode() [function.implode]: Bad arguments. in /var/www/html/dtesting/modules/node/node.module on line 525.
    * user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE in /var/www/html/dtesting/includes/database.mysqli.inc on line 151.

---
Sharique

#1

Striky2 - May 7, 2008 - 09:11
Status:active» postponed (maintainer needs more info)

ok, I can't check that before next week.
Is your binding saved anyway? You mentioned fivestar, do you think it has something to do with that?

thx,

#2

Sharique - May 7, 2008 - 18:58

It nothing to do with five star, I have tested without five star. My binding is saved, but I don't see review link or form at full node.
---
Sharique

#3

poseidon123 - June 16, 2008 - 18:41

Ya, Striky, I am too getting same error on my localhost installation.

#4

Striky2 - June 16, 2008 - 18:55
Priority:normal» critical
Assigned to:Anonymous» Striky2

all right guys, I put that on top priority. Still don't know why it's working for me. Have to figure it out. The fact is I have to get a blank install of the module to see what's happenin'.

#5

Striky2 - June 19, 2008 - 02:40

Sorry guys, but after having tested in your configuration with the last version (reviewed node with fivestar), I've not been able to reproduce your error. The configuration is saved without error for me, and I don't know how to reproduce your bug. Maybe my little changes incoming in the new version, or the very short coming drupal 6 version will make that disappear.

As for the "nothing-appears", that's completely normal, you have to add the custom-review block to see the additional form actually appear on the nodes. Moreover, to see the reviews appear (concerning some nodes), you have to use views. There are no default "display block reviews" for now.

I'd like to have more info on your systems. Please update to the very last version of custom_review 2.1.2.

Basically, the fonction which you go through that might be responsible for the error is:

function custom_review_binding_form_submit($form_id, $form_values) {
  global $_custom_review_reviewers;

  if (empty($_custom_review_reviewers)) {
    $_custom_review_reviewers = custom_review_get_reviewers();
  }

  $created_reviews = array();
 
  //try to distinguish changing configurations from already existing ones
  //existing configuration is save in $_custom_review_reviewers
  //go through all form_values
  foreach ($form_values as $key_form_value => $val_form_value) {
    $reviewed_array_name = '';
    $reviewer_name = '';
    if (strstr($key_form_value, 'custom_review_reviewer_bind_')) {
      //it's a reviewer
      $reviewed_array_name = str_replace('_reviewer_bind', '_reviewed_bind', $key_form_value);
      $reviewer_name = substr($key_form_value, 28); //strlen('custom_review_reviewer_bind_')
    }

    if ($reviewer_name && $val_form_value) {
      //it's a reviewer not null
      foreach ($form_values[$reviewed_array_name] as $key_reviewed_type => $val_reviewed_type) {
        if ($val_reviewed_type) {
          //its a reviewer-reviewed not null
          //check if insertion is required
          if (array_key_exists($reviewer_name, $_custom_review_reviewers) && in_array($key_reviewed_type, $_custom_review_reviewers[$reviewer_name])) {
            //if reviewer_node_type/reviewed_node_type is already in the database ($custom_review) :
            //do nothing
          }
          else {
            //insert only one item
            $sql = db_query("INSERT INTO {custom_review_types} VALUES ('%s','%s')", $reviewer_name, $key_reviewed_type);
          }
        }
        else {
          //its a reviewer not null && a reviewed null
          //check if deletion is required
          if (array_key_exists($reviewer_name, $_custom_review_reviewers) && in_array($key_reviewed_type, $_custom_review_reviewers[$reviewer_name])) {
            //if reviewer_node_type/reviewed_node_type is in the database ($custom_review) :
            //delete only one item
            $sql = db_query("DELETE FROM {custom_review_types} WHERE reviewer_node_type = '%s'
            AND reviewed_node_type = '%s'", $reviewer_name, $key_reviewed_type);
          }
        }
      }
    }
    else if ($reviewer_name && !$val_val_value) {
      //it's a reviewer null
      //check if deletion is required
      if (array_key_exists($reviewer_name, $_custom_review_reviewers)) {
        //if reviewer_node_type is in the database ($custom_review) : delete (may delete many items)
        $sql = db_query("DELETE FROM {custom_review_types} WHERE reviewer_node_type = '%s'", $reviewer_name);
      }
    }
  }
  drupal_set_message('Modifications done');
}

Or

/**
* Get all the reviewers names
*
* @return $_custom_review_reviewers
* $_custom_review_reviewers is also a global var which is written by this function
*/
function custom_review_get_reviewers() {
  $sql = db_query("SELECT * FROM {custom_review_types} ORDER BY reviewer_node_type");
  $_custom_review_reviewers = array();
  while ($result = db_fetch_array($sql)) {
    $_custom_review_reviewers[$result['reviewer_node_type']][] = $result['reviewed_node_type'];
  }
  return $_custom_review_reviewers;
}

These are the only two functions called by this part of the programm, so I'm a bit curious about the error you guys get...

#6

poseidon123 - June 19, 2008 - 11:11

i think I got it, me and jdev were doing it wrong (atleast I was). I had not enabled the block and was also trying to access reviews in wrong way (I had no idea that the module created 2 demo views...)

#7

Striky2 - June 19, 2008 - 14:03
Status:postponed (maintainer needs more info)» fixed

#8

Anonymous (not verified) - July 3, 2008 - 14:04
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.