Skip to content

Commit

Permalink
CR suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
renatonascalves committed Sep 13, 2023
1 parent 58e3477 commit 8223a7b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
1 change: 1 addition & 0 deletions inc/class-wp-object.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ abstract class WP_Object {
* @param bool $hide_empty Optional flag to hide the meta box if there is no meta.
*/
public function render_meta_table( string $title = '', bool $hide_empty = false ) {

// Store meta.
$meta = [];

Expand Down
24 changes: 15 additions & 9 deletions inc/objects/class-bp-group.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,17 @@ protected function __construct() {
* Add meta boxes to the BuddyPress group edit screen.
*/
public function add_meta_boxes() {
// Get screen id.
$screen_id = get_current_screen()->id;

// Ensure the group id is set.
if ( ! isset( $_GET['gid'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
return;
}

// Store group id.
$this->object_id = (int) sanitize_text_field( wp_unslash( $_GET['gid'] ?? 0 ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
$this->object_id = (int) sanitize_text_field( wp_unslash( $_GET['gid'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended

// Get screen id.
$screen_id = get_current_screen()->id;

// Group meta.
add_meta_box(
Expand Down Expand Up @@ -82,6 +88,12 @@ public function render_terms() {
// Loop through taxonomies and terms and build data array.
foreach ( $taxonomies as $taxonomy ) {

$taxonomy_object = get_taxonomy( $taxonomy->name );

if ( empty( $taxonomy_object ) ) {
continue;
}

// Reset data for this taxonomy.
$data = [];

Expand All @@ -106,12 +118,6 @@ public function render_terms() {
];
}

$taxonomy_object = get_taxonomy( $taxonomy->name );

if ( empty( $taxonomy_object ) ) {
continue;
}

( new Table(
$data,
[
Expand Down

0 comments on commit 8223a7b

Please sign in to comment.