Skip to:
Content

BuddyPress.org

Opened 9 years ago

Closed 9 years ago

#6777 closed defect (bug) (fixed)

Typo in bp_activity_set_post_type_tracking_args()

Reported by: danbrellis's profile danbrellis Owned by: imath's profile imath
Milestone: 2.5 Priority: normal
Severity: minor Version: 2.2
Component: Activity Keywords: has-patch commit
Cc: dcavins

Description

The function bp_activity_set_post_type_tracking_args adds the post labels in a foreach loop, and then unsets each $arg that was passed to it.

The function says

unset( $args[ $post_type ] );

but since there is no $post_type key in the $args array, I think it should actually be:

unset( $args[ $label_type ] );

Was just poking around in the code and noticed this so sorry if I'm off base here.

Attachments (1)

6777.patch (2.1 KB) - added by imath 9 years ago.

Download all attachments as: .zip

Change History (8)

#1 @dcavins
9 years ago

  • Cc dcavins added
  • Version set to 2.4.0

Hi @danbrellis-

Thanks for your bug report! I'm not terribly familiar with this particular cul-de-sac of the BuddyPress code, but I agree with your conclusion--it looks like what's meant to happen here is those label arguments are unset so they aren't added to the $wp_post_types global.

Thanks again for taking the time to write up a report.

#2 @imath
9 years ago

  • Version changed from 2.4.0 to 2.2

@dcavins

Yes sorry for this typo error. This function is not used by BuddyPress internally but is there for plugins wishing to add BuddyPress Post type activities: https://codex.buddypress.org/plugindev/post-types-activities/#customizing-generic-activity-attributes

The goal was to only have the labels ( inside the array like 'bp_activity_admin_filter' ) in $wp_post_types[ $post_type ]->labels and not "repeated" inside $wp_post_types[ $post_type ]->bp_activity.

Last edited 9 years ago by imath (previous) (diff)

#3 @imath
9 years ago

  • Owner set to imath
  • Status changed from new to assigned

#4 @imath
9 years ago

  • Keywords needs-unit-tests added
  • Milestone changed from Awaiting Review to 2.5

#5 @imath
9 years ago

  • Keywords has-patch added; needs-patch needs-unit-tests removed

6777.patch is fixing the typo, i've added a unit test.

@imath
9 years ago

#6 @DJPaul
9 years ago

  • Keywords commit added

Tested, looks good.

#7 @imath
9 years ago

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

In 10412:

Fix a typo in the bp_activity_set_post_type_tracking_args() function

Add a unit test to check activity tracking arguments are added the same way to the post type when setting them within register_post_type() or using the bp_activity_set_post_type_tracking_args()

Props danbrellis

Fixes #6777

Note: See TracTickets for help on using tickets.