Skip to:

Opened 15 years ago

Closed 15 years ago

#1048 closed defect (bug) (fixed)

Xprofile component name improperly used in several functions

Reported by: jeffsayre's profile jeffsayre Owned by: jeffsayre's profile jeffsayre
Milestone: 1.1 Priority: major
Severity: Version:
Component: Keywords:


In trying to debug the activity filter of my Privacy Component, I came across several function calls where the label "profile" was being used in some places and the label "xprofile" in other places for the value in the component_name field. This can cause issues in retrieving, updating, and deleting the records where a calling function is searching for "xprofile" as the component name.

I've attached a graphic that shows one such discrepancy in the wp_bp_notifications table.

As an example, look at these three functions:

In bp-xprofile.php there is xprofile_action_new_wire_post() with this function call:

bp_core_add_notification( $bp->loggedin_user->id, $bp->displayed_user->id, 'profile', 'new_wire_post' );

Also in bp-xprofile.php there is xprofile_remove_screen_notifications() with this call:

bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'profile', 'new_wire_post' );

Finally, in bp-wire-templatetags.php there is bp_wire_posts_template() with this call:

bp_core_delete_notifications_for_user_by_type( $bp->loggedin_user->id, 'xprofile', 'new_wire_post' );

Obviously, this needs to be addressed.

I have not created a patch because I am not sure how you want to proceed. There are two tables in BuddyPress' core that have a component_name field. In one table, wp_bp_activity_user_activity_cached, "profile" is used for the value. In the other table, wp_bp_notifications, "xprofile" is used for that value--with the exception indicated in the attached graphic.

I understand the desire to use the label "profile" for navigation items and in URLs, but when writing to the DB, and for consistency purposes, it would be best to use the actual component name whenever writing to a field called component_name. Thus it should always say "xprofile" in the DB when referring to the xprofile component.

Attachments (1)

BP_Table_Issues.jpg (152.1 KB) - added by jeffsayre 15 years ago.
Example of conflicting component name in wp_bp_notifications

Download all attachments as: .zip

Change History (3)

15 years ago

Example of conflicting component name in wp_bp_notifications

#1 @apeatling
15 years ago

This should all be replaced with $bp->profile->id

#2 @apeatling
15 years ago

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

(In [1910]) Fixes #1048

Note: See TracTickets for help on using tickets.