Skip to content

BP Include Non-Member Comments

By default, BuddyPress does not include comments from non-members (or non-logged-in users more generally) in the sitewide activity stream. This plugin records activity items for those comments.

BP Include Non-Member Comments

The plugin has been tested on version 1.1.3 of BP, as well as the 1.2 release candidate. If you want to use the plugin for 1.1.3 or lower, you will need to uncomment the first few add_action and add_filter lines in the plugin file.

Technical caveat: Non-logged-in commenters have BP user_id 0. When BP creates the activity stream, it decides whether or not to show the Delete button by checking to see whether the user_id for the currently logged in user is the same as the user_id of the person to whom the comment belongs. Presumably, though, you don’t want non-logged-in viewers of the activity stream to be able to delete items from the activity stream at all. BP’s core code is not currently set up to make it easy to remove these buttons, so I employed an ugly fix. If you have changed your theme significantly from the default, you might have to adjust the filter bp_nonmember_comment_content (near the end of the plugin) to remove the button properly.

Download the plugin here.

BP Include Non-Member Comments has been downloaded 146 times. Are you using this plugin? Consider a donation.

Version history

1.0 – February 7, 2010
Initial release

1.1 – February 22, 2010
Normalized file structure to latest BP standards (bp_init)
Fixed problem with deprecated bp_post_get_permalink

20 Comments

  1. Ray

    Cool! Does the “Visitor” button link to a visitor profile?

    Posted on 07-Feb-10 at 7:01 am | Permalink
  2. Hi Ray – No, I should have been more clear about the screenshot. It says “Visitor” because that’s the name I put in the blog comment box. The plugin inserts whatever name the commenter entered, which in turn links to the URL they entered.

    Posted on 07-Feb-10 at 7:10 am | Permalink
  3. iSimone

    Hey there Boone, good one there!

    Wouldn’t it be more appropriate to link to the comment though? there they can still click the imo. The link to the post is just a link to the top of the post i’m assuming!

    Posted on 07-Feb-10 at 7:13 am | Permalink
  4. Hi iSimone –

    Thanks!

    The “View” button goes to the comment, while the post title links to the top of the post. I just copied what happens with comment activity items created by BP core. Or are you seeing something different?

    Posted on 07-Feb-10 at 7:21 am | Permalink
  5. Ray

    Hey Boone,

    It’s good that your plugin doesn’t create a visitor profile!

    However, I do see the potential of people spamming a blog post’s comments just to put their backlink on the BP activity page.

    I guess the issue lies with the WP blog admin and how s/he deals with allowing comments.

    Posted on 07-Feb-10 at 8:12 am | Permalink
  6. I figured the same thing, Ray. If you’ve got a spammer leaving porno links all over your comments section, the problem does not lie in BP, it lies in how you manage your comment spam.

    Posted on 07-Feb-10 at 9:05 am | Permalink
  7. Wow, thanks Boone. I guess I’m officially a fan of your work now. :)

    Actually, the comments to delete are on lines 13 and 14 (not 12 and 13 like the readme.txt says).

    Posted on 07-Feb-10 at 5:43 pm | Permalink
  8. Oh, one request. When a blog post mentions another blog post it ends up pinging iteself but when displayed in the sitewide activity stream it says “[insert the name of blog post] commented on the blog post [then insert the name of the blog post that was pinged]“.

    Is there a way that could read “[name of the pinged blog post] was pinged by [name of the pinging blog post]“?

    Thanks,
    Paul

    Posted on 07-Feb-10 at 6:33 pm | Permalink
  9. miguael

    Hi Boone, great plugin-idea – I already wondered, if that is possible, because alot of commenters on our site are not logged in. GREAT & THANX!

    I installed it on my test-Site (Subdirectories, WMPU 2.9.1.1. and BP 1.2RC) and it doesn’t seem to work… There are no settings, right? Do you have any idea why it’s not working? PS: I installed wordpress in a subblog – could that cause the troubles?

    Another question: Would you make that plugin translatable? I would love to do it for german (doesn’t seem like alot of work :-) –>are your other bp-plugins translatable already? any POT-Files?)

    Posted on 07-Feb-10 at 6:44 pm | Permalink
  10. Paul – I will take a look at making the “pinged” change. I’m not sure how ping objects are handled differently from trackbacks, but it should be easy enough.

    Miguael – Not sure why it doesn’t work – the setup you describe is the same setup I used to develop it. There are no settings, it should just work. I don’t think subblog or subdirectory issues should affect anything, because the plugin activates with comment_post, which doesn’t care about URL. Do member blog comments appear on your activity stream without a problem?

    The plugin shouldn’t need any translation. I didn’t change any of the strings from the buddypress defaults, so the bp text domain should do all the translation out of the box. That’ll change if I implement Paul’s suggestion, in which case I will make sure to generate a POT. My other plugins http://wordpress.org/extend/plugins/profile/boonebgorges are a mixed bag: Group Forum Subscription is fully translatable (and ships with a handful of languages, including German) but some of the others need some TLC in order to be localized. One of these weekends.

    Posted on 08-Feb-10 at 10:14 am | Permalink
  11. iSimone

    @Boone, oh so everything is fine. Seems I missunderstood your earlier comment. Btw. another good one on the new plugin!

    Though is that not something that should be core material?

    Posted on 09-Feb-10 at 3:54 am | Permalink
  12. unknown

    i always get a blank page after commenting, than the comment is posted to the blog, but there is nothing in the activity stream

    Posted on 17-Feb-10 at 6:16 am | Permalink
  13. What version of BP are you using?

    Posted on 17-Feb-10 at 10:03 am | Permalink
  14. unknown

    1.2 final

    Posted on 17-Feb-10 at 7:47 pm | Permalink
  15. unknown

    So…
    Here is the soultion to get this plugin to work with 1.2 final.

    Replace
    $comment_link = bp_post_get_permalink( $comment->post, $wpdb->blogid ) . ‘#comment-’ . $comment_id;

    with
    $comment_link = get_permalink( $comment->comment_post_ID );

    Posted on 27-Feb-10 at 12:58 am | Permalink
  16. Thanks, unknown – I just found the problem myself, fixed it, checked it in, and then came here and read your comment! Could have saved myself a few minutes by coming here first :)

    In any case, the new version should work correctly.

    Posted on 27-Feb-10 at 1:48 am | Permalink
  17. unknown

    Actually there is still a bug, this bug is also in the bp-core. The link to the comment is wrong…

    $comment_link = get_permalink( $comment->comment_post_ID ) . ‘#comment-’ . $comment_id;

    should be
    $comment_link = get_permalink( $comment->comment_post_ID );

    Posted on 27-Feb-10 at 2:02 am | Permalink
  18. Aha. That’s close, but I think it’s better to keep $comment_link how it is and change how $activity_content is built (otherwise the View link breaks). Just uploaded a fix – thanks for the help.

    Posted on 27-Feb-10 at 3:00 am | Permalink
  19. I habe the problem that when the plugin is turned on, comments that are pending in the admin area will be displayed on the activity stream, also comments that “spam karma” detected and correctly filed under spam will appear on the front page.

    any ideas?

    Posted on 10-Mar-10 at 7:35 am | Permalink
  20. Hi ubik. You are the second person to report that problem, but I can’t seem to replicate it myself. What version of BP/WP are you using? Do you have any other plugins that affect how comments work?

    Posted on 10-Mar-10 at 8:20 am | Permalink

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*

Additional comments powered by BackType