<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][12728] trunk/src: BP Types: introduce type metadata registration & add a Member type one</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://buddypress.trac.wordpress.org/changeset/12728">12728</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://buddypress.trac.wordpress.org/changeset/12728","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>imath</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2020-09-21 01:09:16 +0000 (Mon, 21 Sep 2020)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>BP Types: introduce type metadata registration & add a Member type one
- Introduces the `bp_register_type_meta()` function to register metadata for the Type taxonomies.
- Introduces the `bp_get_type_metadata_schema()` to get common to all types metadata properties.
- Adds the `bp_register_type_metadata` hook. Hook to it to register the Member type metadata.
- Introduces the `bp_get_default_taxonomies()` to list the BuddyPress default taxonomies (BP Email & Member Type taxonomies).
- Improves `bp_register_default_taxonomies()` so that it use the previous point new function.
- Adds labels and arguments to the Member Type taxonomy.
- Introduces the `bp_get_taxonomy_common_args()` to retrieve common BP Taxonomy arguments.
- Introduces the `bp_get_email_tax_type_args()` & `bp_get_member_type_tax_args()` so that the BP Email & the Member type taxonomies use it to retrieve its arguments enjoying the previous point new function.
Props mercime, DJPaul, dcavins, boonebgorges, tw2113, sbrajesh
See <a href="http://buddypress.trac.wordpress.org/ticket/7179">#7179</a>
See <a href="http://buddypress.trac.wordpress.org/ticket/7181">#7181</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcbpcorebpcoreactionsphp">trunk/src/bp-core/bp-core-actions.php</a></li>
<li><a href="#trunksrcbpcorebpcoredependencyphp">trunk/src/bp-core/bp-core-dependency.php</a></li>
<li><a href="#trunksrcbpcorebpcorefunctionsphp">trunk/src/bp-core/bp-core-functions.php</a></li>
<li><a href="#trunksrcbpcorebpcoretaxonomyphp">trunk/src/bp-core/bp-core-taxonomy.php</a></li>
<li><a href="#trunksrcbpmembersbpmembersfunctionsphp">trunk/src/bp-members/bp-members-functions.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcbpcorebpcoreactionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-core/bp-core-actions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-core/bp-core-actions.php 2020-09-21 00:42:58 UTC (rev 12727)
+++ trunk/src/bp-core/bp-core-actions.php 2020-09-21 01:09:16 UTC (rev 12728)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -82,9 +82,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'bp_init', 'bp_add_permastructs', 40 );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * The bp_register_taxonomies hook - Attached to 'bp_init' @ priority 2 above.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * The bp_register_taxonomies hooks - Attached to 'bp_init' @ priority 2 above.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'bp_register_taxonomies', 'bp_register_member_types' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+add_action( 'bp_register_taxonomies', 'bp_register_type_metadata', 20 );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Late includes.
</span></span></pre></div>
<a id="trunksrcbpcorebpcoredependencyphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-core/bp-core-dependency.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-core/bp-core-dependency.php 2020-09-21 00:42:58 UTC (rev 12727)
+++ trunk/src/bp-core/bp-core-dependency.php 2020-09-21 01:09:16 UTC (rev 12728)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -96,6 +96,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Fire the 'bp_register_type_metadata' action, where plugins should register metadata for their custom BuddyPress types.
+ *
+ * @since 7.0.0
+ */
+function bp_register_type_metadata() {
+
+ /**
+ * Fires inside the 'bp_register_type_metadata' function, where plugins should register metadata for their custom BuddyPress types.
+ *
+ * @since 7.0.0
+ */
+ do_action( 'bp_register_type_metadata' );
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Fire the 'bp_register_post_types' action, where plugins should register post types.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.5.0
</span></span></pre></div>
<a id="trunksrcbpcorebpcorefunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-core/bp-core-functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-core/bp-core-functions.php 2020-09-21 00:42:58 UTC (rev 12727)
+++ trunk/src/bp-core/bp-core-functions.php 2020-09-21 01:09:16 UTC (rev 12728)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2937,6 +2937,41 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /** Taxonomies *****************************************************************/
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Returns the BP Taxonomy common arguments.
+ *
+ * @since 7.0.0
+ *
+ * @return array The BP Taxonomy common arguments.
+ */
+function bp_get_taxonomy_common_args() {
+ return array(
+ 'public' => false,
+ 'show_in_rest' => false,
+ 'query_var' => false,
+ 'rewrite' => false,
+ 'show_in_menu' => false,
+ 'show_tagcloud' => false,
+ 'show_ui' => bp_is_root_blog() && bp_current_user_can( 'bp_moderate' ),
+ );
+}
+
+/**
+ * Returns the BP Taxonomy common labels.
+ *
+ * @since 7.0.0
+ *
+ * @return array The BP Taxonomy common labels.
+ */
+function bp_get_taxonomy_common_labels() {
+ return array(
+ 'bp_type_name' => _x( 'Name', 'BP Type name label', 'buddypress' ),
+ 'bp_type_singular_name' => _x( 'Singular name', 'BP Type singular name label', 'buddypress' ),
+ 'bp_type_has_directory' => _x( 'Add Type-Filtered Directory View', 'BP Type has directory checkbox label', 'buddypress' ),
+ 'bp_type_directory_slug' => _x( 'Custom type directory slug', 'BP Type slug label', 'buddypress' ),
+ );
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Output the name of the email type taxonomy.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.5.0
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2998,7 +3033,116 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * Return arguments used by the email type taxonomy.
+ *
+ * @since 7.0.0
+ *
+ * @return array
+ */
+function bp_get_email_tax_type_args() {
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /**
+ * Filters emails type taxonomy args.
+ *
+ * @since 7.0.0
+ *
+ * @param array $value Associative array (key => arg).
+ */
+ return apply_filters(
+ 'bp_register_email_tax_type',
+ array_merge(
+ array(
+ 'description' => _x( 'BuddyPress email types', 'email type taxonomy description', 'buddypress' ),
+ 'labels' => bp_get_email_tax_type_labels(),
+ 'meta_box_cb' => 'bp_email_tax_type_metabox',
+ ),
+ bp_get_taxonomy_common_args()
+ )
+ );
+}
+
+/**
+ * Returns the default BuddyPress type metadata schema.
+ *
+ * @since 7.0.0
+ *
+ * @param boolean $suppress_filters Whether to suppress filters. Default `false`.
+ * @param string $type_taxonomy Optional. the Type's taxonomy name.
+ * @return array The default BuddyPress type metadata schema.
+ */
+function bp_get_type_metadata_schema( $suppress_filters = false, $type_taxonomy = '' ) {
+ $schema = array(
+ 'bp_type_name' => array(
+ 'description' => __( 'The name of your type, at the plural form.', 'buddypress' ),
+ 'type' => 'string',
+ 'single' => true,
+ 'sanitize_callback' => 'sanitize_text_field',
+ ),
+ 'bp_type_singular_name' => array(
+ 'description' => __( 'The name of your type, at the singular form.', 'buddypress' ),
+ 'type' => 'string',
+ 'single' => true,
+ 'sanitize_callback' => 'sanitize_text_field',
+ ),
+ 'bp_type_has_directory' => array(
+ 'description' => __( 'Add a list of members matching the member type available on the Members Directory page (e.g. site.url/members/type/teacher/).', 'buddypress' ),
+ 'type' => 'boolean',
+ 'single' => true,
+ 'sanitize_callback' => 'absint',
+ ),
+ 'bp_type_directory_slug' => array(
+ 'label' => __( 'Custom type directory slug', 'buddypress' ),
+ 'description' => __( 'If you want to use a slug that is different from the Member Type ID above, enter it here.', 'buddypress' ),
+ 'type' => 'string',
+ 'single' => true,
+ 'sanitize_callback' => 'sanitize_title',
+ ),
+ );
+
+ if ( true === $suppress_filters ) {
+ return $schema;
+ }
+
+ /**
+ * Filter here to add new meta to the BuddyPress type metadata.
+ *
+ * @since 7.0.0
+ *
+ * @param array $schema Associative array (name => arguments).
+ * @param string $type_taxonomy The Type's taxonomy name.
+ */
+ return apply_filters( 'bp_get_type_metadata_schema', $schema, $type_taxonomy );
+}
+
+/**
+ * Registers a meta key for BuddyPress types.
+ *
+ * @since 7.0.0
+ *
+ * @param string $type_tax The BuddyPress type taxonomy.
+ * @param string $meta_key The meta key to register.
+ * @param array $args Data used to describe the meta key when registered. See
+ * {@see register_meta()} for a list of supported arguments.
+ * @return bool True if the meta key was successfully registered, false if not.
+ */
+function bp_register_type_meta( $type_tax, $meta_key, array $args ) {
+ $taxonomies = wp_list_pluck( bp_get_default_taxonomies(), 'component' );
+
+ if ( ! isset( $taxonomies[ $type_tax ] ) ) {
+ return false;
+ }
+
+ // register_term_meta() was introduced in WP 4.9.8.
+ if ( ! function_exists( 'register_term_meta' ) ) {
+ $args['object_subtype'] = $type_tax;
+
+ return register_meta( 'term', $meta_key, $args );
+ }
+
+ return register_term_meta( $type_tax, $meta_key, $args );
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /** Email *****************************************************************/
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre></div>
<a id="trunksrcbpcorebpcoretaxonomyphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-core/bp-core-taxonomy.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-core/bp-core-taxonomy.php 2020-09-21 00:42:58 UTC (rev 12727)
+++ trunk/src/bp-core/bp-core-taxonomy.php 2020-09-21 01:09:16 UTC (rev 12728)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -15,32 +15,57 @@
</span><span class="cx" style="display: block; padding: 0 10px"> defined( 'ABSPATH' ) || exit;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Returns default BuddyPress taxonomies.
+ *
+ * @since 7.0.0
+ *
+ * @return array The BuddyPress default taxonomies.
+ */
+function bp_get_default_taxonomies() {
+ $taxonomies = array(
+ // Member Type.
+ bp_get_member_type_tax_name() => array(
+ 'object' => 'user',
+ 'component' => 'members',
+ 'args' => bp_get_member_type_tax_args(),
+ ),
+ // Email type.
+ bp_get_email_tax_type() => array(
+ 'object' => bp_get_email_post_type(),
+ 'component' => 'core',
+ 'args' => bp_get_email_tax_type_args(),
+ ),
+ );
+
+ /**
+ * This filter should only be used by built-in BuddyPress Components.
+ *
+ * @since 7.0.0
+ *
+ * @param array $taxonomies The taxonomy arguments used for WordPress registration.
+ */
+ return apply_filters( 'bp_get_default_taxonomies', $taxonomies );
+}
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Register our default taxonomies.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.2.0
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function bp_register_default_taxonomies() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Member Type.
- register_taxonomy( bp_get_member_type_tax_name(), 'user', array(
- 'public' => false,
- ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $taxonomies = bp_get_default_taxonomies();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Email type.
- register_taxonomy(
- bp_get_email_tax_type(),
- bp_get_email_post_type(),
- apply_filters( 'bp_register_email_tax_type', array(
- 'description' => _x( 'BuddyPress email types', 'email type taxonomy description', 'buddypress' ),
- 'labels' => bp_get_email_tax_type_labels(),
- 'meta_box_cb' => 'bp_email_tax_type_metabox',
- 'public' => false,
- 'query_var' => false,
- 'rewrite' => false,
- 'show_in_menu' => false,
- 'show_tagcloud' => false,
- 'show_ui' => bp_is_root_blog() && bp_current_user_can( 'bp_moderate' ),
- ) )
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ foreach ( $taxonomies as $taxonomy_name => $taxonomy_params ) {
+ if ( ! isset( $taxonomy_params['object'] ) || ! isset( $taxonomy_params['args'] ) ) {
+ continue;
+ }
+
+ register_taxonomy(
+ $taxonomy_name,
+ $taxonomy_params['object'],
+ $taxonomy_params['args']
+ );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'bp_register_taxonomies', 'bp_register_default_taxonomies' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="trunksrcbpmembersbpmembersfunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/bp-members/bp-members-functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/bp-members/bp-members-functions.php 2020-09-21 00:42:58 UTC (rev 12727)
+++ trunk/src/bp-members/bp-members-functions.php 2020-09-21 01:09:16 UTC (rev 12728)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2646,6 +2646,92 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Returns labels used by the member type taxonomy.
+ *
+ * @since 7.0.0
+ *
+ * @return array
+ */
+function bp_get_member_type_tax_labels() {
+
+ /**
+ * Filters Member type taxonomy labels.
+ *
+ * @since 7.0.0
+ *
+ * @param array $value Associative array (name => label).
+ */
+ return apply_filters(
+ 'bp_get_member_type_tax_labels',
+ array(
+ 'name' => _x( 'Member types', 'Member type taxonomy name', 'buddypress' ),
+ 'singular_name' => _x( 'Member type', 'Member type taxonomy singular name', 'buddypress' ),
+ 'search_items' => _x( 'Search Member types', 'Member type taxonomy search items label', 'buddypress' ),
+ 'popular_items' => _x( 'Most used Member types', 'Member type taxonomy popular items label', 'buddypress' ),
+ 'all_items' => _x( 'All Member types', 'Member type taxonomy all items label', 'buddypress' ),
+ 'edit_item' => _x( 'Edit Member type', 'Member type taxonomy edit item label', 'buddypress' ),
+ 'view_item' => _x( 'View Member type', 'Member type taxonomy view item label', 'buddypress' ),
+ 'update_item' => _x( 'Update Member type', 'Member type taxonomy update item label', 'buddypress' ),
+ 'add_new_item' => _x( 'Add new Member type', 'Member type taxonomy add new item label', 'buddypress' ),
+ 'new_item_name' => _x( 'New Member type name', 'Member type taxonomy new item name label', 'buddypress' ),
+ 'separate_items_with_commas' => _x( 'Separate Member types with commas', 'Member type taxonomy separate items with commas label', 'buddypress' ),
+ 'add_or_remove_items' => _x( 'Add or remove Member types', 'Member type taxonomy add or remove items label', 'buddypress' ),
+ 'choose_from_most_used' => _x( 'Choose from the most used Member types', 'Member type taxonomy choose from most used label', 'buddypress' ),
+ 'not_found' => _x( 'No Member types found', 'Member type taxonomy not found label', 'buddypress' ),
+ 'no_terms' => _x( 'No Member types', 'Member type taxonomy no terms label', 'buddypress' ),
+ 'items_list_navigation' => _x( 'Member types list navigation', 'Member type taxonomy items list navigation label', 'buddypress' ),
+ 'items_list' => _x( 'Member types list', 'Member type taxonomy items list label', 'buddypress' ),
+ 'back_to_items' => _x( 'Back to all Member types', 'Member type taxonomy back to items label', 'buddypress' ),
+ // Specific to BuddyPress.
+ 'bp_type_id_label' => _x( 'Member Type ID', 'BP Member type ID label', 'buddypress' ),
+ 'bp_type_id_description' => _x( 'Enter a lower-case string without spaces or special characters (used internally to identify the member type).', 'BP Member type ID description', 'buddypress' ),
+ )
+ );
+}
+
+/**
+ * Returns arguments used by the Member type taxonomy.
+ *
+ * @since 7.0.0
+ *
+ * @return array
+ */
+function bp_get_member_type_tax_args() {
+
+ /**
+ * Filters Member type taxonomy args.
+ *
+ * @since 7.0.0
+ *
+ * @param array $value Associative array (key => arg).
+ */
+ return apply_filters(
+ 'bp_get_member_type_tax_args',
+ array_merge(
+ array(
+ 'description' => _x( 'BuddyPress Member types', 'Member type taxonomy description', 'buddypress' ),
+ 'labels' => array_merge( bp_get_member_type_tax_labels(), bp_get_taxonomy_common_labels() ),
+ ),
+ bp_get_taxonomy_common_args()
+ )
+ );
+}
+
+/**
+ * Registers the Member type metadata.
+ *
+ * @since 7.0.0
+ */
+function bp_register_member_type_metadata() {
+ $type_taxonomy = bp_get_member_type_tax_name();
+
+ foreach ( bp_get_type_metadata_schema( false, $type_taxonomy ) as $meta_key => $meta_args ) {
+ bp_register_type_meta( $type_taxonomy, $meta_key, $meta_args );
+ }
+}
+add_action( 'bp_register_type_metadata', 'bp_register_member_type_metadata' );
+
+/**
</ins><span class="cx" style="display: block; padding: 0 10px"> * Register a member type.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.2.0
</span></span></pre>
</div>
</div>
</body>
</html>