Skip to:
Content

Opened 4 years ago

Last modified 21 hours ago

#2372 reopened enhancement

@mention in wordpress post comment

Reported by: intimez Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 1.5
Component: Blogs Keywords: has-patch
Cc: mercijavier@…

Description

If a person is @mention on the buddypress side, it will send an email notification if enabled.

This does not happen when leaving a comment on a wordpress post.

Is there any way to tie it to the buddypress system or even have a wordpress post recognize it as a buddypress command?

Attachments (1)

2372.01.patch (648 bytes) - added by r-a-y 14 months ago.

Download all attachments as: .zip

Change History (15)

comment:1 intimez4 years ago

  • Type changed from enhancement to defect

It correctly link to the buddypress profile so from that we know it's picking it up but no notification is sent.

comment:2 boonebgorges3 years ago

  • Resolution set to invalid
  • Status changed from new to closed

As you confirm, @-mention linking is already working correctly.

Notifications for @-mentions were added is [3403]

comment:3 intimez3 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened
  • Version set to 1.3

@boonebgorges

I've tested this using trunk r3717 and it's not working.

Is 3403 for wordpress comment or only for buddypress? It sounds like only for buddypress so I'm reopening as my defect report is different.

comment:4 boonebgorges3 years ago

  • Milestone changed from 1.3 to 1.4
  • Type changed from defect to enhancement

You're right, this should be added. Switching to an enhancement and bumping to 1.4, as it's unlikely that the core team will have time to tackle this for 1.3.

comment:5 boonebgorges2 years ago

  • Cc djpaul removed
  • Keywords @mention comment notification removed
  • Milestone changed from 1.6 to Future Release
  • Severity set to normal

Currently, the way that content like blog comments is this:

  • They are processed as activity items, which contain an excerpt of the first sentence or two of the original content (eg, the comment)
  • If that excerpt contains an @-mention, then notifications will be processed. If the @-mentions appear after the excerpt cut, then nothing happens.

Ideally, we would be more consistent about how this works - generating @-mentions from the original content, or perhaps even storing all original content in the activity table - but that would require a substantial rewrite of the way that @-mentions are processed.

comment:6 mercime15 months ago

  • Cc mercijavier@… added

r-a-y14 months ago

comment:7 r-a-y14 months ago

  • Component changed from Core to Blogs
  • Keywords has-patch added
  • Milestone changed from Future Release to 1.8

Attached a patch to fix this problem.

Tentatively moving to 1.8, but could make its way back to 1.7 if the other devs agree.

comment:8 boonebgorges14 months ago

Definitely not for 1.7. I don't know if there would be negative repercussions from storing all blog content in wp_bp_activity like this. Needs more research.

comment:9 boonebgorges11 months ago

  • Milestone changed from 1.8 to Future Release

Preliminarily, I think it's unwise to make the change suggested by r-a-y in 2372.01.patch. If we're going to store the full content of blog comments, then we should by the same logic store the full content of blog posts and content types that we currently excerpt for activity (like forum posts). But this will grow our activity table in big ways, which will add to the already painfully slow @-mention queries; see #4018. Moreover, storing full content will cause backward compatibility problems for plugins/themes that are currently displaying the full 'content' field of activity items.

A proper solution would be to store @-mention details as some sort of structured metadata (perhaps in activitymeta? perhaps as its own datatype?), to run the full content of the source content through a filter that detects and records @-mentions based on that full content, and _then_ to create and store an excerpt. But this is beyond what we can do for 1.8.

comment:10 henrywright5 months ago

I have been giving some thought to r-a-y's patch. I don't think it would have any impact on @-mentions in blog comments when the activity component is disabled. See the following statement earlier in the bp_blogs_record_activity() function:

if ( ! bp_is_active( 'activity' ) )
    return false;

Are @-mentions in blog posts and comments currently dependent on the activity component being active?

Last edited 5 months ago by henrywright (previous) (diff)

comment:11 boonebgorges5 months ago

Are @-mentions in blog posts and comments currently dependent on the activity component being active?

Yes. @-mentions in general are dependent on the Activity component.

The problem with r-a-y's patch is not that it'll have any ill effects when activity is *disabled* (in which case it'll in fact have no effect at all), but instead when activity is *enabled*. We currently store only short excerpts of blog posts in the 'content' column of the activity table - only a few hundred characters - but storing the full text of blog posts would mean that we're storing many, many times that. This will slow down the activity table in a number of important ways. The key issue in this case is that @-mention are fetched by a LIKE query, and the performance of those kinds of queries will degrade at least linearly with the increasing size of the haystack.

comment:12 henrywright5 months ago

Hi boone. That was my point. "I don't think it will have any impact on @-mentions when activity is disabled" - here I was trying to say it wouldn't have any effect at all. I was thinking along the lines of - the solution that is taken should avoid being dependent on the activity component being active as installations that have activity disabled will lose @-mention functionality.

comment:13 henrywright5 months ago

We currently store only short excerpts of blog posts in the 'content' column of the activity table

I'm wondering why @-mention content (excerpt or full text) has to be stored at all? A lightweight approach to blog post and comment @-mentioning could be taken:

  1. At the point which the blog post or comment is successfully submitted and saved, parse the text for @-usernames maybe using preg_match_all
  1. Check the found usernames are active members
  1. Trigger a BP core notification and an email alert to all valid members receiving the mention.

This would avoid:

  1. Activity table bloat and big haystacks
  2. Activity component dependency (unless the triggering of BP core notifications is currently dependant on activity?)
  3. Performance issues due to laborious LIKE queries

comment:14 boonebgorges21 hours ago

henrywright - The issue is that when you go to view the "Mentions" tab on a user activity page, it's powered by a LIKE query on the content column of the activity table. If we don't store the content of the source item (or if we don't store *enough* of the content, as in the case of blog excerpts), the mention won't show up in that list.

Note: See TracTickets for help on using tickets.