diff --git a/inc/class-wp-object.php b/inc/class-wp-object.php index 1f39f67..239f734 100644 --- a/inc/class-wp-object.php +++ b/inc/class-wp-object.php @@ -53,6 +53,10 @@ public function render_meta_table( string $title = '', bool $hide_empty = false $meta = (array) get_comment_meta( $this->object_id ); break; + case 'bp-group': + $meta = (array) groups_get_groupmeta( $this->object_id, '', false ); + break; + case 'fm-term-meta': if ( function_exists( 'fm_get_term_meta' ) ) { $term = get_term( $this->object_id ); diff --git a/inc/objects/class-bp-group.php b/inc/objects/class-bp-group.php new file mode 100644 index 0000000..44aca4e --- /dev/null +++ b/inc/objects/class-bp-group.php @@ -0,0 +1,60 @@ +object_id = (int) sanitize_text_field( wp_unslash( $_GET['gid'] ?? 0 ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended + + // Group meta. + add_meta_box( + 'meta-inspector-bp-group-meta', + __( 'Meta', 'meta-inspector' ), + [ $this, 'render_meta' ], + get_current_screen()->id, + 'normal' + ); + } + + /** + * Render a table of group meta. + */ + public function render_meta() { + $this->render_meta_table(); + } +} diff --git a/inc/objects/class-comment.php b/inc/objects/class-comment.php index c420f5a..801f0c7 100644 --- a/inc/objects/class-comment.php +++ b/inc/objects/class-comment.php @@ -8,7 +8,7 @@ namespace Meta_Inspector; /** - * Inspect meta for users. + * Inspect meta for comments. */ class Comment extends WP_Object { use Singleton; @@ -28,7 +28,7 @@ protected function __construct() { } /** - * Add meta boxes to the post edit screen. + * Add meta boxes to the comment edit screen. */ public function add_meta_boxes() { @@ -40,7 +40,7 @@ public function add_meta_boxes() { // Store comment ID. $this->object_id = get_comment_ID(); - // Post meta. + // Comment meta. add_meta_box( 'meta-inspector-comment-meta', __( 'Comment Meta', 'meta-inspector' ), @@ -51,7 +51,7 @@ public function add_meta_boxes() { } /** - * Render a table of post meta. + * Render a table of comment meta. */ public function render_meta() { $this->render_meta_table(); diff --git a/meta-inspector.php b/meta-inspector.php index b84e813..81bc01d 100755 --- a/meta-inspector.php +++ b/meta-inspector.php @@ -6,7 +6,7 @@ * Author URI: https://alley.com * Text Domain: meta-inspector * Domain Path: /languages - * Version: 1.1.0 + * Version: 1.1.1 * * @package Meta_Inspector */ @@ -26,6 +26,7 @@ require_once __DIR__ . '/inc/objects/class-user.php'; require_once __DIR__ . '/inc/objects/class-comment.php'; require_once __DIR__ . '/inc/objects/class-fm-term-meta.php'; +require_once __DIR__ . '/inc/objects/class-bp-group.php'; // Initalize classes. add_action( @@ -46,5 +47,10 @@ function() { Comment::instance(); // Legacy FM Term Meta Data support. Fm_Term_Meta::instance(); + + // BuddyPress support. + if ( class_exists( 'BuddyPress' ) ) { + BP_Group::instance(); + } } );