Please, I need help!
The annonymous comments have dissapeared!

I´ve got a little snippet that tells me how many comments are posted, and the number haven´t changed there, but the comments are not there anymore!
The only comments that have remained are from registered users.

Settings:
Anonymous users can post comments without approval
Comments are allowed, the form is still there

The only change was that I disconnected the site from Settings for an hour, and then reconnected it.

What can I do?

Comments

Rosamunda’s picture

Now, I´ve tried as annonymous to post a comment, but could not post it!
after I hit "post comment" the page appears blank...

What can I do??????

I´ve also checked the database and I think I haven´t lost them...

uzbekjon’s picture

What do you mean you think you have not lost them ?! Check your database table for comments, if they are there, than you can be sure something is not right with drupal.

Have you disabled annonymous user group ?

-------------------------------
Sites for uzbeks and Uzbekistan:
Uzbek Lyrics Database
Uzbekistan Forum

Rosamunda’s picture

I mean that I didn´t knew how many there were before this thing happened.
As comments from registered users are there, I think (and I´m pretty sure) that I haven´t lost anything.

Yes, the problem is with Drupal, dunno what could have happened. Annonymous users cannot post (but the form is there).
Nope, I haven´t disable the annonymous users role.

I´ve tried reinstalling the module (using devel)
As I´ve made a few changes to the template file, I´ve "undo" those changes, replacing the new template file with the original working-without-problems one.
I even try changing the theme, to check if there was a "template" problem.

The problem is still there.

Rosamunda’s picture

Could you help me with this?

When I try to enter the "config" tab at admin/comment/configure
this error appears:

warning: array_keys() [function.array-keys]: The first argument should be an array in /home/liga/public_html/modules/user.module on line 349. 
warning: implode() [function.implode]: Bad arguments. in /home/liga/public_html/modules/user.module on line 349. 
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 DISTINCT(p.perm) FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in /home/liga/public_html/includes/database.mysql.inc on line 120. 

I´ve reinstall the module using "devel", and the warning message is still there...

Line 349 in user.module:

  // To reduce the number of SQL queries, we cache the user's permissions
  // in a static variable.
  if (!isset($perm[$account->uid])) {
Line 349=======>    $result = db_query("SELECT DISTINCT(p.perm) FROM {role} r INNER JOIN {permission} p ON p.rid = r.rid WHERE r.rid IN (%s)", implode(',', array_keys($account->roles)));

    $perm[$account->uid] = '';
    while ($row = db_fetch_object($result)) {
      $perm[$account->uid] .= "$row->perm, ";
    }
  }

Line 120 in database.mysql.inc:

  if ($debug) {
    print '<p>query: '. $query .'<br />error:'. mysql_error($active_db) .'</p>';
  }

  if (!mysql_errno($active_db)) {
    return $result;
  }
  else {
Line 120=============>    trigger_error(check_plain(mysql_error($active_db) ."\nquery: ". $query), E_USER_WARNING);
    return FALSE;
  }
}
Rosamunda’s picture

Please, Anyone?

Rosamunda’s picture

What those errors mean?

Rosamunda’s picture

Could this be a bug?
I know that claiming to have found a bug isn´t gracious, but I´ve found several people with this issue unresolved; nobody answers, nor knows what to do about it:

There are more, but this three seems to have the exact problem...

Chill35’s picture

I am a newbie and the only help that I can offer here might help some people who encounter the problem of not seeing anonymous comments, except that they would not be seeing the error you mention in admin/comment/configure.

What is particular to anonymous comments is that they may be subject to some filtering by spam modules -- such as aksimet.module. There might be a bug there : when you take your web site offline then online again, all anonymous comments may be taken off their published state to some "limbo" state, but that would show off in your admin/comment page.

I have five questions for you :

1. Are you able to access the admin/comment page without error ? (as oppsosed to admin/comment/configure)

2. Do the anonymous comments show up on admin/comment page ? Do they show up on admin/comment/list/approval ?

3. Do you have a backup of your database that's a snapshot from the time that preceeded your efforts to fix the problem ?

4. Have you installed a new module recently ?

5. Do you see anything unusual in your Drupal logs ?

Caroline

Rosamunda’s picture

Thanks for your help Caroline :-)
Here are the answers:

1. Are you able to access the admin/comment page without error ? (as oppsosed to admin/comment/configure)
Yes, without erros

2. Do the anonymous comments show up on admin/comment page ? Do they show up on admin/comment/list/approval ?
nope, they does not appear there

3. Do you have a backup of your database that's a snapshot from the time that preceeded your efforts to fix the problem ?
yes :-)

4. Have you installed a new module recently ?
yes: Usernodes, nodeprofile, and nodefamily. I´ve disabeled them and the problem persists.

5. Do you see anything unusual in your Drupal logs ?
Just the errors that I´ve posted earlier in this discussion.

Thanks for your help!
Rosamunda

Chill35’s picture

I have absolutely nothing concrete to base my hunch on, but I get the feeling that the problem has to do with a module that creates a problem when it's disabled... it does something to the database when it's enabled (installed), then when it's disabled, it does something un-kosher to the database that creates a problem (database error) when reading anonymous comments from then on, whether said module is enabled or disabled. Just keep that hunch in mind (LOL).

Now with a more scientific approach...

- Have you tried reverting to the database snap shot before your efforts to fix with contributed modules ENABLED ? Or any state that you know worked ?

I hope that someone with real exprience will step in soon, because really I am a newbie.

It worries me because that error has been reported before, and either it solved itself "mysteriously" or not, or someone found a solution but did not report how he/she worked it out...

Caroline

Rosamunda’s picture

Thanks again for your efforts Caroline!
I´ve tried what you said, and I´ve a hunch that this is a bug...

I don´t know what to say to this...

vm’s picture

this sounds very much like a node access table problem.

what access modules are you using ? or did you test and then remove ?

ahneill’s picture

Hi-

I just had an identical issue. In my case... the anonymous comments were simply sitting in the approval queue in administer> comments. All I had to do was check them and publish them and voila!...

Hopefully this may help

art

Chill35’s picture

But you did not get the error (?).

And you did see the comments in the approval queue.

The problem is not identical.

Caroline

ahneill’s picture

agreed. "identical" was not the right choice of words... "Some identical symptoms" is more accurate. As I said, I was simply offering the story anecdotally, and likely the solution for this iteration is different(though the knowledge of approval could be helpful to those who happen upon this discussion in the future as a good first step).

And yes, if the answer to Caroline's question 2 above is as follows, then it is likely not the same solution as simply approving the comments, though the symptoms of the original problem were the same(ie anonymous comments not showing up, etc.)...

"2. Do the anonymous comments show up on admin/comment page ? Do they show up on admin/comment/list/approval ?"
"nope, they does not appear there"

assuming that response meant admin/comment/list/approval was checked and no comments appeared unapproved, then yes, this situation has its own issues beyond access control, comment approval issues. HOWEVER, for future visitors to this thread, it might help to reinforce that certain combinations of settings in access control and understanding of comment approval are necessary to proper display of anonymous comments to all users.

wishing you luck on this one,

Art

Chill35’s picture

The most common issue with the symptom of not seeing comments after posting them is the one you just described. You did well in bringing this up. I am sorry if I sounded dry with my comment. I went short on words hence lacked clarity.

To add to your comment : when I test my web site locally, my aksimet module fails to check the comments I submit (as a non-admin) so I get that symptom myself. I post a comment as Joe Bloe (unverified) and the comment ends up in the approval queue, and unless I think of that, I may wrongly assume that I failed to submit the comment in the 1st place. The same happens if I post a comment as an authentificated user when authentificated users are submitted to aksimet check.

Thank you much!

Caroline

Rosamunda’s picture

Thanks for your help and time in trying to solve this.
I haven´t get any progress yet, I mean, the problem is still here.

I have disabled the modules, changed the theme, but nothing seems to solve this.
The problem is that people here seems not to care for a problem like this, that looks like a bug to me now.

It happened several times before me (I´ve posted some links above), and I´ve email those users to see if, besides the fact that their posts weren´t answered here, they have found any solution.

The result was negative aswell (they are still looking for a solution)

So, I´ve decided to move on with this mysterious bug, and reinstall my whole site, using my backup. The other choice that I´ve got is the upgrade, I´m gonna try that too.

The thing is that this could happen again, to anyone. It´s pretty mysterious, and nobody knows how to solve this in a certain way.

I would like that any developer could read this and say something...

Thanks again for your help!

Rosamunda

Rosamunda’s picture

Sadly, they doesn´t appear in the queue list...
Is like the database can read them, but Drupal won´t show them up.

ie. Views shows the total quantity of comments, but whan you enter the node, the comments from annonymous users are not there (only the ones posted by registered users).

Thanks for your help!

Rosamunda

Chill35’s picture

What version are you using, 4.7.4 or 4.7.5 ?

I updated that issue as well : http://drupal.org/node/71147 but I don't know the exact version of Drupal you're using.

Thanks for updating that issue to the version you're using.

Caroline

Chill35’s picture

Please update that issue as well : http://drupal.org/node/86497

vm’s picture

the issues that rosamunda linked to , are outdated 4.7.2, 4.6 and a few that have to do with a news module. The comment module one was probably never answered, because the core module works properly on a vanilla install (no contrib modules).

Which version of Drupal are you using ?

If you are going to redo the site, maybe resetting the node access table wouldnt be a bad thing to try on a back up to see if it fixes the issue you are having. It will reset the node access table back to view, giving you default drupal node access settings again. Then reset your permissions and check ?

While I understand that you don't have the persistent welcome page, the directions on how to clean the node access table and reset the permissions still apply. see: http://drupal.org/node/64114

Rosamunda’s picture

Sorry for the delay in this answer, I´ve spent the whole day in using my drupal backup to restore another copy, to check if I could relay on it... just in case :-)

I´m currently using 4.7.0, and I was thinking in upgrading it to 4.7.5...

I´ve done it: TRUNCATE node_access; and then INSERT INTO node_access (nid, gid, realm, grant_view, grant_update, grant_delete) VALUES (0, 0, 'all', 1, 0, 0);, but sadly, the problem remains...
The only thing I can do (my guess) is to give a chance to an update to 4.7.5...

Many, many thanks for your help!
Any other tip, advice, thought is more than welcome!

Rosamunda

heine’s picture

Check whether the users table still holds a record for the anonymous user (uid=0). If not, execute the following query (e.g. phpmyadmin, tab SQL, then try again):

INSERT INTO users (uid) VALUES (0);

--
The Manual | Troubleshooting FAQ | Tips for posting | How to report a security issue.

Rosamunda’s picture

Oh my!!!!!!!!!!

It worked!
It worked!
It worked!
It worked!
It worked!
It worked!
It worked!
It worked!
It worked!
It worked!
It worked!
It worked!
It worked!
It worked!
It worked!
It worked!

You´re a genius!

I love you Heine! I cannot express with words how much you´ve saved me today!!!!

Thank you very, very much!!!!
And thank you all of you that have put your energies and time to try and help me!

This problem affected me and my job a LOT, and I really appreciate your help, and your willingness to extend a hand to someone in distress (and very much stressed!).

Again, you´ve saved me form hours and hours of extra work, and I really really appreciate that.

Thank you very much to uzbekjon, Caroline (Chill35), VeryMisunderstood, art (ahneill), and special thanks to Heine, who not only saved me with this stuff here and now, but I´ve troubled him two days ago at the chat too with this issue :-D

Love you guys,
Rosamunda

Rosamunda’s picture

BTW, I´ve updated all those issues and posts, just in case other guys have the same problem.

Rosamunda
Buenos Aires | Argentina
www.ligadelconsorcista.org

Chill35’s picture

Thank you so much for taking the time to update the issues. This will certainly help at least one other person.

I am a believer in that if something can go wrong for one person, it probably will for at least 2 other people, in the same way.

I am so glad you got that resolved.

Heine is realllllllyyy goooood. He nails it. It was simple enough, simple enough to be overlooked. No anonymous user !!!

LOL...

Caroline

vm’s picture

Begs the question though, how the anon user was deleted from the database in first place.

Chill35’s picture

Yes, what do you think caused that ?

Was there some change you made ?

Caroline

Rosamunda’s picture

The things that I made were:
1 - Adding some profile fields (the profile module was already activated)
2 - Install Usernode, Nodeprofile and Nodefamily modules.
3 - Added some views using nodeprofiles.
4 - Didn´t created any profile template, but I did create a usernode template.
5 - Added to my template.tpl.php file a certain stuff from Views.template module (a recent one added by merlinofchaos that creates code to add to the template file).
6 - Added code to my template.tpl file to point people to their usernode instead their profile. That code was provided by the usernode module, inside the installation folder.

I think that step 6 could just push the wrong button somewhere and made all crash.
Don´t understand whow, though.

The code that I´ve added was this:

Views Stuff added to template.tpl.php (step 5):


...

/**
 * views template to output a view.
 * This code was generated by the views theming wizard
 * Date: Dom, 21/01/2007 - 22:53
 * View: Directorio
 *
 * This function goes in your template.php file
 */
function phptemplate_views_view_table_Directorio($view, $nodes, $type) {
  $fields = _views_get_fields();

  $taken = array();

  // Set up the fields in nicely named chunks.
  foreach ($view->field as $id => $field) {
    $field_name = $field['field'];
    if (isset($taken[$field_name])) {
      $field_name = $field['queryname'];
    }
    $taken[$field_name] = true;
    $field_names[$id] = $field_name;
  }

  // Set up some variables that won't change.
  $base_vars = array(
    'view' => $view,
    'view_type' => $type,
  );

  foreach ($nodes as $i => $node) {
    $vars = $base_vars;
    $vars['node'] = $node;
    $vars['count'] = $i;
    $vars['stripe'] = $i % 2 ? 'even' : 'odd';
    foreach ($view->field as $id => $field) {
      $name = $field_names[$id];
      $vars[$name] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view);
      if (isset($field['label'])) {
        $vars[$name . '_label'] = $field['label'];
      }
    }
    $items[] = _phptemplate_callback('views-table-Directorio', $vars);
  }
  if ($items) {
    return theme('item_list', $items);
  }
}
......

Usernode stuff added to template.tpl.php (Step 6)


...

/**
 * Catch the theme_username function and link to the usernode instead of linking to the userpage
 */

function phptemplate_username(&$object) {

  if ($object->uid && $object->name) {
    // Shorten the name when it is too long or it will break many tables.
    if (drupal_strlen($object->name) > 20) {
      $name = drupal_substr($object->name, 0, 15) .'...';
    }
    else {
      $name = $object->name;
    }

    if (user_access('access content') && module_exist('usernode')) {
      $nid = usernode_get_node_id($object);
      $output = l($name, 'node/'. $nid, array('title' => t('View user details.')));
    }
    else {
      $output = check_plain($name);
    }
  }
  else if ($object->name) {
    // Sometimes modules display content composed by people who are
    // not registered members of the site (e.g. mailing list or news
    // aggregator modules). This clause enables modules to display
    // the true author of the content.
    if ($object->homepage) {
      $output = l($object->name, $object->homepage);
    }
    else {
      $output = check_plain($object->name);
    }

    $output .= ' ('. t('not verified') .')';
  }
  else {
    $output = variable_get('anonymous', 'Anonymous');
  }

  return $output;
}

/**
 * Catch the theme_user_picture function and link to the usernode instead of linking to the userpage
 */

function phptemplate_user_picture(&$account) {
  if (variable_get('user_pictures', 0)) {
    if ($account->picture && file_exists($account->picture)) {
      $picture = file_create_url($account->picture);
    }
    else if (variable_get('user_picture_default', '')) {
      $picture = variable_get('user_picture_default', '');
    }

    if (isset($picture)) {
      $alt = t('%user\'s picture', array('%user' => $account->name ? $account->name : variable_get('anonymous', 'Anonymous')));
      $picture = theme('image', $picture, $alt, $alt, '', false);
      if (!empty($account->uid) && user_access('access content') && module_exist('usernode')) {
        $nid = usernode_get_node_id($account);
        $picture = l($picture, "node/$nid", array('title' => t('View user details.')), NULL, NULL, FALSE, TRUE);
      }

      return "<div class=\"picture\">$picture</div>";
    }
  }
} 
....
jodim’s picture

And thanks to all of you found the solution in less than 30 mins (INSERT INTO users (uid) VALUES (0);). I am a newbie on Drupal, and looking forward to be in a position to give back to this great community!

mattbarton.exe’s picture

I was missing the uid for anonymous--inserting the extra row fixed this problem for me.