[buddypress-trac] [BuddyPress Trac] #8713: Group type meta is not set on group types registered in code
buddypress-trac
noreply at wordpress.org
Wed Jun 22 02:05:58 UTC 2022
#8713: Group type meta is not set on group types registered in code
--------------------------+-----------------------------
Reporter: sjregan | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Groups | Version: 10.3.0
Severity: normal | Keywords:
--------------------------+-----------------------------
Group types may be registered in database via WP Admin (Groups -> Group
Types), or registered via code using bp_groups_register_group_type().
Additional options or meta-data may be associated with group types via
'bp_get_group_type_tax_labels' and 'bp_get_type_metadata_schema' filters.
Regardless of how the group type is registered, the meta-data may be
edited in WP Admin.
The group type objects returned from bp_groups_get_group_types() will have
additional properties for the meta-data if the type has been registered in
database via GUI, but group types registered via code will not have the
additional object properties.
bp_groups_get_group_types() calls bp_get_taxonomy_types(), which does
fetch the correct meta-data for group types registered via code, however
it does not assign the fetched values to the final group type object. It
does set the default group type properties from the database, just not
meta-data properties registered via filters.
Steps to reproduce:
* Register group type via Groups -> Group Types GUI.
* Register another group type via bp_groups_register_group_type()
* Add additional group type properties via 'bp_get_group_type_tax_labels'
and 'bp_get_type_metadata_schema' filters
* Observe both group types are visible in GUI and the additional
properties can be saved and edited
* Compare the differences in the properties on the objects returned by
bp_groups_get_group_types()
In the following results from bp_groups_get_group_types (), group type
'house' is via code, and 'test' is via GUI. 'example_metadata_option' and
'another_example_metadata_option' are custom group type meta-data.
{{{
$types = {array} [2]
house = {stdClass} [10]
has_directory = "1"
show_in_create_screen = "1"
show_in_list = "1"
description = "House"
create_screen_checked = true
labels = {array} [2]
name = "Houses"
singular_name = "House"
code = true
db_id = {int} 22
name = "house"
directory_slug = "house"
test = {stdClass} [24]
db_id = {int} 25
labels = {array} [2]
singular_name = "test"
name = "tests"
name = "test"
has_directory = "1"
directory_slug = "test"
show_in_create_screen = "1"
show_in_list = "1"
example_metadata_option = "1"
another_example_metadata_option = "1"
}}}
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/8713>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list