-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from alleyinteractive/feature/bp-group
Support for BuddyPress Group Meta
- Loading branch information
Showing
4 changed files
with
75 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
/** | ||
* Inspect groups. | ||
* | ||
* @package Meta_Inspector | ||
*/ | ||
|
||
namespace Meta_Inspector; | ||
|
||
/** | ||
* Inspect meta for a BuddyPress group. | ||
*/ | ||
class BP_Group extends WP_Object { | ||
use Singleton; | ||
|
||
/** | ||
* Object type. | ||
* | ||
* @var string | ||
*/ | ||
public $type = 'bp-group'; | ||
|
||
/** | ||
* Initialize class. | ||
*/ | ||
protected function __construct() { | ||
|
||
// Bail if BuddyPress groups are not active. | ||
if ( ! bp_is_active( 'groups' ) ) { | ||
return; | ||
} | ||
|
||
add_action( 'bp_groups_admin_meta_boxes', [ $this, 'add_meta_boxes' ] ); | ||
} | ||
|
||
/** | ||
* Add meta boxes to the BuddyPress group edit screen. | ||
*/ | ||
public function add_meta_boxes() { | ||
|
||
// Store group ID. | ||
$this->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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters