Looks like this (that is, for the "spam" link, there us HTML code visible, and not a functioning link).

* delete
* edit
* reply
* spam (99)
* mark as not spam
* report as spam

Comments

lambert-1’s picture

* delete
* edit
* reply
* spam (<a href="/admin/spam/logs/comment/36623">99</a&gt)
* mark as not spam
* report as spam

[UPDATE: Looks like above, with angle brackets, not as first posted. SOrry

kenwen’s picture

Getting the same error on one of my sites, it appears to when I upgraded. However, as far as i can see, fresh installs aren't exhibiting the bug.

jman’s picture

Yes I have the same problem - site was upgraded.

WhatTheFawk’s picture

Status: Active » Needs review
StatusFileSize
new1.48 KB

Here's a patch for this, around line 1317-1338 the code tries to put a l() link inside of another l() link. For whatever reason Drupal's l() function doesn't like that very much and the code shows up as.

<li class="spam-probability">
<span class="spam-probability">not spam (<a href="/wtf/admin/spam/logs/comment/105">43</a>)</span>
</li>

When it should be:

<li class="spam-probability">
not spam (<a href="/wtf/admin/spam/logs/comment/105">43</a>)
</li>

I don't know why it puts spans instead of making a link inside a link and I couldn't figure out how to get rid of the spans. So instead this patch simplifies the logic in that area by making the entire "not spam (49)" or "spam(99)" a link. It also uses the 'href' attribute in the arrays below instead of a l() link. This is only my second patch, I'm using Beyond Compare to make the patch file, and I still don't know if I did the first one right, so if it doesn't work here are the changes in spam.module, they are small so you can easily manually add them.

This [Line: 1317-1322]:

if (variable_get('spam_log_level', SPAM_LOG)) {
    $display_text = " (". l($p->probability, "admin/spam/logs/$type/$id") .")";
  }
  else {
    $display_text = " ($p->probability)";
  }

To:

if (variable_get('spam_log_level', SPAM_LOG)) {
      $log_link = "admin/spam/logs/$type/$id";
}

This [Line: 1330]:

$output['spam-probability'] = array('title' => t('not spam') . ($display ? $display_text : ''));

To:

$output['spam-probability'] = array('href' => $log_link, 'title' => t('not spam') . " ($p->probability)");

This [Line: 1335]:

$output['spam-probability'] = array('title' => t('spam') . ($display ? $display_text : ''));

To:

$output['spam-probability'] = array('href' => $log_link, 'title' => t('spam') . " ($p->probability)");

Please tell me if the patch works for you if not tell me how to make a patch correctly :) The part I don't get is the first few lines that have the path to the files, is this necessary?

WhatTheFawk’s picture

Title: Bad HTML generated for spam weighting in commment » Patch for Bad HTML generated on spam weighting in commment
StatusFileSize
new2.02 KB

Sigh... Ok, forget that last patch, this actually required less changes once I realized what the code was originally supposed to be doing. Also the link still didn't work in the last patch because the admin section's paths are changed a little. Here's the update.

Still fixes the same thing, if a post is checked and is not spam it will be a link called "not spam" to the log of that post. If it is spam same deal, a link called "spam" to the log. If you have the options to show the probability it will also display that inside the link in the format "(probability)". The paths should also work now, hopefully that covers everything. :)

It would probably be nice to eventually make clicking the "spam" or "not spam" buttons take you to new page that shows all logs with a certain ID like spam/104 for all the spam_logs on node 104, because there are about three logs for each node in the database, but with one link you can only go to one log. Right now its getting the highest ID'd log of the node. Which luckily I think is the most relevant log about the spam.

Manual code changes, same areas only a few lines:

This [line: 1317-1322]

if (variable_get('spam_log_level', SPAM_LOG)) {
    $display_text = " (". l($p->probability, "admin/spam/logs/$type/$id") .")";
  }
  else {
    $display_text = " ($p->probability)";
  }

To:

 if (variable_get('spam_log_level', SPAM_LOG)) {
	$log_id = db_fetch_object(db_query("SELECT sid FROM {spam_log} WHERE id = %d AND source = '%s'", $id, $type));
	$log_link = "admin/content/spam/logs/entry/$log_id->sid";
	$display_text = " ($p->probability)";
  }

This [line: 1330]

$output['spam-probability'] = array('title' => t('not spam') . ($display ? $display_text : ''));

To:

 $output['spam-probability'] = array('href' => $log_link, 'title' => t('not spam') . ($display ? $display_text : ''));

This [line: 1338]

$output['spam-probability'] = array('title' => t('not spam') . ($display ? $display_text : ''));

To:

 $output['spam-probability'] = array('href' => $log_link, 'title' => t('spam') . ($display ? $display_text : ''));

Hopefully that log_link path is correct and not something my pathauto made up, please test and tell me if it works for you.

kenwen’s picture

that works great for me.

Cheers!
Ken

jeremy’s picture

Status: Needs review » Fixed

Duplicate bug, already fixed.

Anonymous’s picture

Status: Fixed » Closed (fixed)