Skip to:
Content

BuddyPress.org

Opened 5 months ago

Closed 5 months ago

#8129 closed defect (bug) (fixed)

Custom BP_FRIENDS_SLUG won't work anymore to display someone friends activities

Reported by: Maniou Owned by: imath
Milestone: 5.0.0 Priority: normal
Severity: normal Version: 3.0.0
Component: Activity Keywords: has-patch
Cc:

Description

Hi,

If you define on wp-config :

define ( 'BP_FRIENDS_SLUG', 'amis' );

You can't filter a user's friend activities on his profil page.

Without BP_FRIENDS_SLUG :
https://domain.com/members/dupond/activity/friends/ > OK

With BP_FRIENDS_SLUG defined to "amis" :
https://domain.com/members/dupond/activity/amis/ > 404

It used to work before Buddypress V3.0

Thank you for your help !

Attachments (2)

8129.patch (1.3 KB) - added by imath 5 months ago.
8129.2.patch (1.4 KB) - added by imath 5 months ago.

Download all attachments as: .zip

Change History (11)

#1 @Maniou
5 months ago

I guess the problem is relative to Late includes method in class-bp-activity-component.php

Specially to this part :

line 128 :

if ( bp_is_user() && in_array( bp_current_action(), array( 'friends', 'groups', 'favorites', 'mentions' ), true ) ) {
require $this->path . 'bp-activity/screens/' . bp_current_action() . '.php';
}

when accessing https://domain.com/members/dupond/activity/amis/
bp_current_action() is equal to "amis"
and the code can't get the screen bp-activity/screens/friends.php to load

#2 @imath
5 months ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 5.0.0
  • Version changed from 4.3.0 to 3.0.0

Hi @Maniou

Thanks a lot for your feedback. I confirm the issue and I've been able to reproduce it for the friends slug and also for the groups slug.

I'm going to check all the slug constants in every component's late_include() method to see if there are more potential issues like this one and add a patch asap.

#3 @Maniou
5 months ago

Thanks a lot @imath :) Glad to see that you are back on Buddypress !

@imath
5 months ago

#4 @imath
5 months ago

  • Keywords has-patch added; needs-patch removed

So am I @Maniou :)

I've looked every BP_Activity_Component::late_includes() methods and only found the issue there. 8129.patch is fixing the issue for me.

You're welcome to test ;) I'll probably commit it in the coming days.

#5 @Maniou
5 months ago

Thanks @imath

I've got this error : "PHP Fatal error: Uncaught Error: Call to undefined function bp_get_groups_slug()"

If it's can help you my Buddypress version is 4.3.0 and the "Groups" module is not activated.

Thanks again,

@imath
5 months ago

#6 @dcavins
5 months ago

This fix looks good to me. Thanks, @imath, for tackling it.

#7 @imath
5 months ago

Ouch! My bad!! I made a beginner's mistake. I forgot to check components were active. Thanks a lot for your test, you saved the 5.0.0-beta1 release!!

8129.2.patch should fix the issue.

Thanks for your feedback @dcavins

Last edited 5 months ago by imath (previous) (diff)

#8 @Maniou
5 months ago

Many thanks @imath :)

#9 @imath
5 months ago

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

In 12449:

Activity: make sure all late included files are successfully loaded

Using the BP_FRIENDS_SLUG or the BP_GROUPS_SLUG it is possible to customize the slug of corresponding single user's activity actions. As a result we need to map these potential customizable slugs with the filenames of PHP scripts late included.

Props Maniou

Fixes #8129

Note: See TracTickets for help on using tickets.