-
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 #26 from alleyinteractive/feature/bp-activity
Support for BuddyPress Activity Meta
- Loading branch information
Showing
4 changed files
with
70 additions
and
2 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,61 @@ | ||
<?php | ||
/** | ||
* Inspect BuddyPress activities. | ||
* | ||
* @package Meta_Inspector | ||
*/ | ||
|
||
namespace Meta_Inspector; | ||
|
||
/** | ||
* Inspect meta for BuddyPress activities. | ||
*/ | ||
class BP_Activity extends WP_Object { | ||
use Singleton; | ||
|
||
/** | ||
* Object type. | ||
* | ||
* @var string | ||
*/ | ||
public $type = 'bp-activity'; | ||
|
||
/** | ||
* Initialize class. | ||
*/ | ||
protected function __construct() { | ||
|
||
// Bail if the BuddyPress activity component is not active. | ||
if ( ! bp_is_active( 'activity' ) ) { | ||
return; | ||
} | ||
|
||
add_action( 'bp_activity_admin_meta_boxes', [ $this, 'add_meta_boxes' ] ); | ||
} | ||
|
||
/** | ||
* Add meta boxes to the BuddyPress activity edit screen. | ||
*/ | ||
public function add_meta_boxes() { | ||
|
||
// Ensure the activity id is set. | ||
if ( ! isset( $_GET['aid'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended | ||
return; | ||
} | ||
|
||
// Store activity id. | ||
$this->object_id = (int) sanitize_text_field( wp_unslash( $_GET['aid'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended | ||
|
||
// Get screen id. | ||
$screen_id = get_current_screen()->id; | ||
|
||
// Activity meta. | ||
add_meta_box( | ||
'meta-inspector-bp-activity-meta', | ||
__( 'Meta', 'meta-inspector' ), | ||
fn () => $this->render_meta_table(), | ||
$screen_id, | ||
'normal' | ||
); | ||
} | ||
} |
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