Provide convenience function to filter at the theme layer

Godmode - October 16, 2007 - 12:47
Project:Nofollow List
Version:6.x-1.0
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

I am using nofollowlist 5.x-1.1 on Drupal 5.2. As i understand, if i add sites to whitelist, all the rest of the sites not under whitelist should get a nofollow.

However its not working properly. Someone added a comment with a link, the site is not under whitelist but still didnt get nofollow added to it.

Can someone help?

#1

jbernat - October 20, 2007 - 21:49
Title:Whitelist doesnt work» Whitelist doesnt work (Nor does blacklist?)

I, too, am unable to get any rel=nofollow to appear in comments that I post.
Perhaps someone can point me to some documentation, if some exists. My
searches came up empty.

The particulars:

  1. I am running Drupal 5.2
  2. I installed the module by copying the nofollowlist folder to the modules folder.
  3. I enabled the module in the admin modules page.
  4. I clicked on the link to update.php in the modules admin page.
  5. I went to the nofollowlist module config page and specified a few domains and selected "whitelist."
  6. I posted a comment to a book page with a hyperlink outside of the whitelist (including the tags), using filtered HTML input, viewed the source, and saw no rel=nofollow.
  7. I changed the module setting to "blacklist" and added the domain of the link in the test comment.
  8. Again, I viewed the source and saw no rel=nofollow.
  9. I edited the comment and re-saved, re-viewed the source, and still no rel=nofollow.

Thanks for any help you can offer!
Jim Bernatowicz

#2

rastarr - October 23, 2007 - 06:33

Hey guys,

I had the same problem and did a little digging. The one thing I didn't do is enable the Nofollowlist filter in the set up of the various Input types.
To install - enable the module on admin/build/modules, visit your admin/settings/filters and add this to the appropriate filters (in Drupal 5.x, that's Administrator > Site Configuration > Input Formats > pick the filter you want to add it to > configure and enable).

Hope that gets you working. Good idea if the module author added this to the description a little clearer so people like me get it clear in their heads :)

#3

greggles - October 23, 2007 - 10:58

Thanks for debugging and for providing constructive feedback!

Ever since it was first created this project page has stated

You must configure the input formats and add this to a format for this module to work.

I just added a Installation Note in front of it to make it stand out more.

@godmode and @jbernat - can you confirm that this solves your problem as well? If so then that's good news.

#4

Sam-Inet - October 26, 2007 - 04:36
Title:Whitelist doesnt work (Nor does blacklist?)» Not working here.

Not working here. Either blacklist or whitelist.

Using:
Drupal -> 5.2
nofollowlist -> 5.x-1.1

My activities for blacklist were:

look for readme -> none found
install into sites/all/modules
enable module
config module for blacklist and give it 4 test URLs
give [administer nofollowlist] to a role
add to all [Input Formats] defined

* all viewing done in different browser (Firefox) than one logged into site (Opera).

clear all cache tables
look at old post with existing blacklist URL -> nofollow not found
clear all cache tables
edit old post, add more blacklist URLs -> nofollow not found
clear all cache tables
create new post with multiple blacklist URLs -> nofollow not found
clear all cache tables
create new post with blacklist URLs in teaser -> nofollow not found on /node list
clear all cache tables
config module for whitelist, delete two URLs
-> nofollow found on custom sidebar block links
-> nofollow not found on regular menu items
-> nofollow not found on anything but custom sidebar block
Clear all cache tables, drink a beer, write up a bug report.

Testing for various combinations of URL paths and attributes, Testing Link formats were:

<A HREF="http://drupal.org/node/6261" TARGET="_blank">Drupal</A>
<A HREF="http://drupal.org/" TARGET="_blank">Drupal</A>
<A HREF="http://drupal.org/">Drupal</A>

<A HREF="http://en.wikipedia.org/wiki/Global_warming_conspiracy_theory" TARGET="_blank">Global Warming Consp</A>
<A HREF="http://en.wikipedia.org/">Global Warming Consp</A>

None ever picked up nofollow attribute in any configuration.

Sam
Admin, inet-design
Managed hosting for the Drupal Content Management System

#5

Sam-Inet - October 26, 2007 - 04:45
Title:Not working here. » Whitelist and Blacklist not working.

Title fix.

I knew I should have waited to drink that beer.

#6

jbernat - November 24, 2007 - 05:32

You must configure the input formats and add this to a format for this module to work.

Yes! This was the missing piece. Thanks for pointing that out.

Jim

#7

greggles - December 9, 2007 - 21:49

@sam-inet: thanks for the very detailed report.

What happens if you edit a piece of content (change it and re-save it) or create a new node. I know that this should have a similar effect to clearing all the cache tables, but maybe it is part of the key? Thanks.

#8

greggles - December 18, 2007 - 12:50
Status:active» closed

I can't reproduce this and I've had other people (guardian in irc) confirm that it works properly for them. So I'm closing it.

This module only impacts links that are passed through the filter system. It will only work if the content is sent through the filter a second time (Drupal caches this). To confirm whether it is working, create a new node with a test url in it.

I updated the project page to clarify where/how it works.

#9

Sam-Inet - July 9, 2009 - 22:38
Version:5.x-1.1» 6.x-1.0
Status:closed» active

Hi greggles,

I'm back!.!..... (sorry for never replying, I gave up on this for D5, but figured I'd give this a go for D6)

The problem hasn't gone away, and to refine the problem, it seems to be very specifically related to the "Homepage:" links left by a commenter. Load up your favorite nofollow highlighter and head to:

http://winetest.fermentedreviews.com/cycles_gladiator_2005_cabernet_sauv...

My whitelist is:

fermentedreviews.com
www.winegiques.com
http://www.winegiques.com
winegiques.com

And I've added Nofollow List to the Input format "Filtered HTML". Both that node and comment are input format "Filtered HTML."

As you'll see, the links in the body text and the comment body to "http://www.winegiques.com" come out okay, but the link in the "Submitted by Suenarita" gets wacked with a "nofollow."

So, since this seems to be a user error, can you point me to what I need to do to get the "Submitted by" field for comments to get whitelisted correctly?

Thanks,
Sam

Site Details:
Drupal 6.13
Nofollow List 6.x-1.0

#10

greggles - July 9, 2009 - 23:55

AHA!

The module can't ever work on things in the theme layer like that. See attached screenshots for more data...

It would be possible to filter that _at the theme layer_ but that would require code to be implemented by each site.

The best we can do in this module is to provide a convenience function to themers.

I don't plan to work on this but would accept a patch (ideally that included documentation).

AttachmentSize
Cycles Gladiator 2005 Cabernet Sauvignon California | Wine Test.jpg 117.01 KB

#11

Sam-Inet - July 10, 2009 - 20:35
Status:active» closed

Well Puppy Poo!

That definitely explains why I thought NoFollow had a bug two years ago :( The number one reason the people I support need it are to whitelist commenter's homepages. Theory being, if a commenter leaves something relevant and valid, then they get a positive link.

I don't know the inner workings of this module, but I'll take a swipe at its functioning, so I can get a pointer from you as to how to patch it to do what I want. NoFollow under whitelist works something like this?

1) Every link everywhere gets nofollowed, then
2) Any content that gets filtered then gets the nofollow removed if it matches the whitelist?

And the fix would be something like:

- Adding an exposed hook (callable function) to the Nofollow module, so that passed strings get 'filtered.'
- Having the theme call the hook to pass all non-normally filtered elements to Nofollow to get 'filtered.'*

Which, and that might be grossly oversimplified, leads me to two thoughts, or maybe they're questions?

A) The new exposed function in Nofollow would only need to be 10 lines or so, as it would just be a wrapper for receiving the text, calling the exising Nofollow function(s) that does the filtering already, and returning the filtered text?

B) The second thought is to go "big." Instead of adding the Nofollow filter to input formats, is there someplace in the top most part of a theme set where the entire completed output (e.g. the whole completed webpage which currently goes to the user's browser) can be sent to the new exposed function in Nofollow? That way everything goes through Nofollow's whitelist filtering, not just bits and pieces?

If A) and B) are doable and you can point me to where B) would be in a theme, I'll gladly do the patch for this (and I'll even do the documentation :)

Thanks greggles,

Sam

*Actually, I'd probably be lazy and just wrap the entire comment.tpl.php, node.tpl.php, block.tpl.php, etc. in a call to Nofollow. Saves on trying to track down every individual element that might need filtering...

#12

Sam-Inet - July 10, 2009 - 20:43
Status:closed» active

Ehh, reopened it, so you'd see my last comment :)

Feel free to close this as, what I'm looking for is legitimately a feature request. Which I'll gladly submit in the proper place upon confirmation that A) and B) (or even *) are workable.

Best,
Sam

#13

greggles - July 11, 2009 - 00:52
Title:Whitelist and Blacklist not working.» Provide convenience function to filter at the theme layer
Category:bug report» feature request
Priority:critical» normal

I think A is possible with very few lines of code. We can re-purpose this issue as a feature request which works fine.

#14

Sam-Inet - July 18, 2009 - 22:28

Thanks greggles,

Hope you had a nice weekend. I'm currently digging through the Theme handbooks to understand how/where to make the proper hooks.* As the more I think of it, the more I like option B).

If you have time and A) isn't more than a few lines of code, can you do A)? If not, I'll dig through the Nofollow module after I get done with understanding D6 theming.

Best,
Sam

* Well, beyond just wrapping "print $submitted;" type statements.
** Beyond the scope of this request, I think I'll look into enhancing Nofollow into adding [target="_blank"] for external link references.

EDIT:

Well, this is becoming a pain, and I'm adding this as notes for myself on what I've already tried.

Doesn't work:

- Module "Submitted By" http://drupal.org/project/submitted_by , as it doesn't modify comment submitted by fields. (Nor does the production version of Token have Hour or Minute formats, so can't recreate the existing comment submitted by format.)
- Editing comment.tpl.php to change "print $submitted;" to "print 'Submitted by ' . theme('username', $comment) . ' on ' . format_date($comment->timestamp, 'custom', 'D, Y-m-d g:i' . ".");"

 
 

Drupal is a registered trademark of Dries Buytaert.