Skip to:
Content

BuddyPress.org

Opened 4 years ago

Closed 4 years ago

#8375 closed defect (bug) (fixed)

BP_Invitation_Manager::get_table_name should have a filter

Reported by: shawfactor's profile shawfactor Owned by: dcavins's profile dcavins
Milestone: 7.0.0 Priority: normal
Severity: normal Version:
Component: Core Keywords: has-patch commit
Cc:

Description

The new Buddypress invitation api is great but my setup is unusual, and there is no way of filtering the table used to store the invitations. A simple improvement would be to add a filter to the above static method.

line 364 of the following file

bp-core-admin-tools.php

would also need to be fixed as it queries the database directy. I think this is a mistake anyway and ideally should reference BP_Invitation_Manager::get_table_name() anyway.

What do you all think?

Attachments (2)

8375.1.diff (1.5 KB) - added by dcavins 4 years ago.
8375.2.diff (1.2 KB) - added by dcavins 4 years ago.
A different approach to allowing filtration of the invitations table name.

Download all attachments as: .zip

Change History (19)

#1 @dcavins
4 years ago

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

Thanks for opening this ticket. I agree that the admin tool is incorrect, and I don't see any problem with adding a filter for, uh, unusual setups. I'll add a patch and look for a 2nd opinion.

Thanks!

@dcavins
4 years ago

This ticket was mentioned in Slack in #buddypress by dcavins. View the logs.


4 years ago

#3 @imath
4 years ago

  • Keywords has-patch commit added
  • Milestone changed from Awaiting Review to 7.0.0

Hi @dcavins patch looks good 👌

#4 @dcavins
4 years ago

In 12758:

Fix admin tool reference to invitations table.

The reference to the invitations table in the repair tool should use the established function to fetch the table name.

Props shawfactor.

See #8375.

#5 @dcavins
4 years ago

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

In 12759:

Allow invitations table name to be filtered.

Add the bp_invitations_table_name filter in
BP_Invitation_Manager::get_table_name().

Fixes #8375.

#6 @shawfactor
4 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Guys thankyou but is it possible to move the filter to after

buddypress()->table_prefix is added?

or add two filters?

I ask as the if you are running running multiblog (like I am) but want some shared tables then you currently can´t share the invitations table.

You can for the full components using the meta_tables and global_tables filters e.g. for messages you can change the whole table name using:

bp_messages_global_tables
bp_messages_meta_tables

But there are no equivalents for notifications.

Thats what i am really trying to get towards, and I think for consistency this would also benefit buddypress. i guess this would also require a filter of the invitation meta table as well but as far as I can see that table is not used at all atm?

#7 @dcavins
4 years ago

Ha, I thought it would be annoying to have to strip out the buddypress()->table_prefix in most use cases, so I added the filter before the prefix was added. Can you be more specific about how you'd use the filter?

Thanks!

#8 @shawfactor
4 years ago

I run buddypress on a multisite with multiblog set to true (effectively so each site has its own budddypress). But I want to share some tables (actually all tables should be shared except the xprofile ones). This is achievable for all tables that are part of a fully fledged component as I can filter them.

eg for messages I filter

bp_messages_global_tables
bp_messages_meta_tables

With the filter replacing the local table prefix with the prefix of the root blog.

However this is currently imposssible for invitations. Therefore I need a filter after the prefix is added so I can replace the local prefix with that of the root blog and have a global invitations table

Does this make sense?

I am not sure how this works with inviation meta too, I can´t even find functions for that atm?

thankyou again.

Last edited 4 years ago by shawfactor (previous) (diff)

This ticket was mentioned in Slack in #buddypress by dcavins. View the logs.


4 years ago

This ticket was mentioned in Slack in #buddypress by imath. View the logs.


4 years ago

@dcavins
4 years ago

A different approach to allowing filtration of the invitations table name.

#11 @shawfactor
4 years ago

  • Milestone 7.0.0 deleted
  • Resolution set to worksforme
  • Status changed from reopened to closed

This looks great and is more consistent with the component setup.

#12 @shawfactor
4 years ago

any chance to add this to the 7.0 release?

#13 @imath
4 years ago

@dcavins it looks good to me, I’m just amazed the patch doesn’t include the removal of the filter we committed before 🤔. Have you refreshed your fork with latest BuddyPress trunk ?

#14 @imath
4 years ago

  • Milestone set to 7.0.0

This was scheduled for 7.0.0 milestone and it’s still the case.

#15 @imath
4 years ago

  • Resolution worksforme deleted
  • Status changed from closed to reopened

Let’s wait for the new patch to be committed to have this ticket closed.

#16 @dcavins
4 years ago

In 12770:

Revert "Allow invitations table name to be filtered."

This reverts commit r12759. We'll accomplish the
filtration of the table name in another way.

See #8375.

#17 @dcavins
4 years ago

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

In 12771:

Add BP Invitations table name to Members component.

To allow the BP Invitations table name to be filtered, add a new element, table_name_invitations, to the Members component's global_tables declaration.

Props imath.

Fixes #8375.

Note: See TracTickets for help on using tickets.