Skip to:
Content

BuddyPress.org

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#6489 closed defect (bug) (fixed)

Messages star action links do not work for displayed users

Reported by: johnjamesjacoby Owned by:
Milestone: 2.3.2 Priority: normal
Severity: normal Version: 2.3.0
Component: Messages Keywords: commit
Cc:

Description

bp_get_the_message_star_action_link() incorrectly assumes that links will always be for the current user. In order for this link to appear correctly for displayed users, one must explicitly pass a user ID into the function. This goes against all other links of these types.

Consequently down the line, the:

} else if ( $r['user_id'] == bp_displayed_user_domain() ) {

...check will never pass.

Attachments (1)

6489.01.patch (967 bytes) - added by johnjamesjacoby 5 years ago.

Download all attachments as: .zip

Change History (7)

#1 @r-a-y
5 years ago

  • Keywords commit added; 2nd-opinion removed
  • Version set to 2.3.0

Ugh, my bad about else if ( $r['user_id'] == bp_displayed_user_domain() ) {.

Definitely commit the patch!

In order for this link to appear correctly for displayed users, one must explicitly pass a user ID into the function.

I should point out that the messages component hardcodes the current user ID for many functions and actions. I guess this would be a good time to clean this up for v2.4.

#2 @johnjamesjacoby
5 years ago

In 9924:

Messages: Updates to bp_get_the_message_star_action_link():

  • Set default $user_id so links work on displayed users
  • Use switch vs. if/else to make $user_domain calculation more obvious
  • Bail if $user_domain cannot be calculated
  • Cast a few variables to avoid non-integer issues cascading into other methods
  • Strict boolean comparisons to ensure proper execution
  • Escape output of a few HTML attributes

This change allows for the action-link used to star a message to use the correct URL for the user_id that's passed into it. This is particularly helpful for capable community moderators that can view other user's Messages, so the links point to the correct URLs for the correct user.

See #6489. (trunk)

#3 @johnjamesjacoby
5 years ago

In 9926:

Messages: Updates to bp_get_the_message_star_action_link():

  • Set default $user_id so links work on displayed users
  • Use switch vs. if/else to make $user_domain calculation more obvious
  • Bail if $user_domain cannot be calculated
  • Cast a few variables to avoid non-integer issues cascading into other methods
  • Strict boolean comparisons to ensure proper execution
  • Escape output of a few HTML attributes

This change allows for the action-link used to star a message to use the correct URL for the user_id that's passed into it. This is particularly helpful for capable community moderators that can view other user's Messages, so the links point to the correct URLs for the correct user.

See #6489. (2.3 branch, for 2.3.2)

#4 @johnjamesjacoby
5 years ago

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

#5 @johnjamesjacoby
5 years ago

In 9931:

Messages: bring back empty local variables in bp_get_the_message_star_action_link().

See #6489. (2.3 branch, for 2.3.2)

#6 @johnjamesjacoby
5 years ago

In 9932:

Messages: bring back empty local variables in bp_get_the_message_star_action_link().

See #6489. (trunk)

Note: See TracTickets for help on using tickets.