Skip to:
Content

Opened 3 years ago

Closed 2 years ago

#2854 closed idea (fixed)

Add rel=nofollow to any links in the bbPress forum profile description

Reported by: Robkk Owned by: netweb
Milestone: 2.6 Priority: normal
Severity: normal Version: 2.2
Component: Component - Users Keywords: has-patch
Cc:

Description

Spammers put their links in the forum profiles description area.

I know you cannot paste urls in the description area directly and it will not turn into a link, but you can still use html to insert a link that way.

We should just deprive any SEO benefit from spammers/spam bots that are smart enough to insert a link using html in the description area.

Attachments (4)

2854.diff (608 bytes) - added by Robkk 3 years ago.
Just added add_filter( 'bbp_get_displayed_user_field', 'bbp_rel_nofollow' ); to the filters.php file
2854-2.patch (677 bytes) - added by Robkk 3 years ago.
2854-3.patch (569 bytes) - added by Robkk 3 years ago.
Just went the simple route.
2854-4.patch (573 bytes) - added by Robkk 3 years ago.

Download all attachments as: .zip

Change History (13)

#1 @Robkk
3 years ago

Code snippet or core??

I have something like this that would basically add nofollow to any links to the users description.

function bbp_user_description() {
$user_id = bbp_get_user_id();   
$description = get_the_author_meta('description', $user_id );
$string = str_replace('href','rel="nofollow" href', $description);
  echo $string;
}

Then I can copy user-profile.php from the bbPress templates into my child theme and replace this.

<?php if ( bbp_get_displayed_user_field( 'description' ) ) : ?>

	<p class="bbp-user-description"><?php bbp_displayed_user_field( 'description' ); ?></p>

<?php endif; ?>

with this

<?php if ( bbp_get_displayed_user_field( 'description' ) ) : ?>

	<p class="bbp-user-description"><?php bbp_user_description(); ?></p>

<?php endif; ?>

#2 @espellcaste
3 years ago

+1 Really good!

@Robkk
3 years ago

Just added add_filter( 'bbp_get_displayed_user_field', 'bbp_rel_nofollow' ); to the filters.php file

#3 @Robkk
3 years ago

  • Keywords has-patch added

Didn't know it was that easy before. WIth the above patch it is also possible to show the users website or other profile fields on their profile page with no problems.

Related: #2570

Last edited 3 years ago by Robkk (previous) (diff)

@Robkk
3 years ago

#4 @tharsheblows
3 years ago

I think this would be good, too!

#5 follow-up: @Robkk
3 years ago

Here is an example of what I am talking about.

This spammer posted about 15 links on his bbpress.org profile.

https://cldup.com/XkQKiC8DHS.jpg

#6 in reply to: ↑ 5 @netweb
3 years ago

Replying to Robkk:

Here is an example of what I am talking about.

This spammer posted about 15 links on his bbpress.org profile.

Thanks, I've removed all these from the users profile.

@Robkk
3 years ago

Just went the simple route.

@Robkk
3 years ago

#7 @thebrandonallen
3 years ago

  • Keywords has-patch removed
  • Milestone changed from Awaiting Review to Under Consideration

#8 @netweb
2 years ago

  • Component changed from General to Component - Users
  • Keywords has-patch added; 2nd-opinion removed
  • Milestone changed from Under Consideration to 2.6
  • Version changed from 2.5.8 to 2.2

#9 @netweb
2 years ago

  • Owner set to netweb
  • Resolution set to fixed
  • Status changed from new to closed

In 6355:

Users: Use bbp_rel_nofollow() for users profile description in user-profile.php template.

This changeset will help curb spammers taking advantage of posting URLs in their user profile descriptions.

Props Robkk.
Fixes #2854.

Note: See TracTickets for help on using tickets.