Opened 15 years ago
Closed 15 years ago
#1048 closed defect (bug) (fixed)
Xprofile component name improperly used in several functions
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 1.1 | Priority: | major |
Severity: | Version: | ||
Component: | Keywords: | ||
Cc: |
Description
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.
Example of conflicting component name in wp_bp_notifications