Skip to:
Content

BuddyPress.org

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4331 closed defect (bug) (wontfix)

Author's Name in Activity Action does not change upon changing the name from settings

Reported by: gagan0123's profile gagan0123 Owned by:
Milestone: Priority: normal
Severity: normal Version: 1.5.6
Component: Activity Keywords:
Cc:

Description

Scenario:
*user1 creates a new activity, and action says "User Nicename has created an activity"
*user1 goes to settings and change his/her name to User Nicename2
*user1 creates a new activity and action says "User Nicename2 has created an activity" while the earlier activity still says "User Nicename has created an activity"

I've made a workaround for this situation by using a shortcode for showing user nicename instead of making it static html for a plugin I've been developing for BuddyPress.

Change History (2)

#1 @boonebgorges
12 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

The reason the activity action doesn't change is because activity actions are stored as strings in the database at the time of creation. They are not generated dynamically on every page load - this would require a large amount of overhead. See, eg, #3063.

There are a few ways to work around this restriction:

(a) Put a filter on 'bp_get_activity_action_pre_meta' or 'bp_get_activity_action' and do your own dynamic action generation on the fly. (It may be more efficient to hook to 'bp_has_activities' and loop through all of $activities_template->activites at once.)
(b) Hook to the user displayname change action (I'm sure there are several places to hook) with a function that looks up all activity with the relevant user_id, and rebuilds the activity action accordingly (even just a str_replace() would probably work).

Doing either of these in BP itself would not scale very well for medium-to-large sites (at least not without some major architectural changes), but either would be perfectly appropriate for a plugin.

Going to close as wontfix for the moment. If you have a better idea about how this might be done without adding huge amounts of overhead, please share. Thanks!

#2 @funnycat777
12 years ago

I would like to try your workaround, but I'm not sure what and how to amend it.
Which workaround is better? What template should I amend?

Note: See TracTickets for help on using tickets.