Skip to:
Content

BuddyPress.org

Opened 12 years ago

Closed 11 years ago

#5059 closed defect (bug) (fixed)

Notification message close no working

Reported by: alimh's profile AliMH Owned by: boonebgorges's profile boonebgorges
Milestone: 1.9 Priority: normal
Severity: normal Version:
Component: Toolbar & Notifications Keywords: reporter-feedback
Cc:

Description

notification message close no working for my site:
wordpress 3.5.1
buddypress 1.7

solution that i found:

in file: buddypress\bp-meesages\bp-messages-template.php
line:

$closed_notices = bp_get_user_meta( $userdata, 'closed_notices', true );

change to :

$closed_notices = bp_get_user_meta( get_current_user_id(), 'closed_notices', true );

Change History (5)

#1 @boonebgorges
12 years ago

  • Keywords reporter-feedback added

Can you check that line again? https://buddypress.trac.wordpress.org/browser/tags/1.7/bp-messages/bp-messages-template.php#L595 (BP 1.7) shows that we're using $userdata->ID, which should return the same value as get_current_user_id() in all cases that I can think of.

#2 @AliMH
12 years ago

i use custom usermeta and it returned my custom usermeta value not userid,so i change it to get_current_user_id(), it's way better to use get_current_user_id here for conflicts.

#3 @boonebgorges
12 years ago

it's way better to use get_current_user_id here

That may be true, but I'm still struggling to understand your bug. Are you saying that your plugin replaces user IDs in the $userdata global? Is this what you mean by "my custom usermeta value"? If so, that seems like an unsafe thing to be doing. If not, then it's possible that there is a bug elsewhere that should be addressed - $usermeta->ID should not contain custom usermeta data.

#4 @johnjamesjacoby
12 years ago

  • Milestone changed from Awaiting Review to 1.9

$userdata should be fine here. That global is set in setup_userdata(), from inside wp_set_current_user(), meaning the ID is practically copied from one global to another. Using get_current_user_id() would also be fine here, but like Boone, I do not understand the nature of this bug.

Moving to 1.9, since this isn't a regression, and there's not enough information to warrant changing this late in 1.8 beta.

#5 @boonebgorges
11 years ago

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

In 7584:

Use bp_loggedin_user_id() in bp_messages_get_notices()

The previous use of the $userdata global was causing problems for installations
that were doing funny things with userdata. In addition, the BP wrapper is more
standard for our codebase.

Fixes #5059

Props AliMH

Note: See TracTickets for help on using tickets.