Skip to content

Instantly share code, notes, and snippets.

@BinaryKitten
Created January 13, 2016 15:20
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save BinaryKitten/de5c3e22e34b0cf30852 to your computer and use it in GitHub Desktop.
notice fix
<?php
public function tags_data( $type ) {
$res = array();
$data = WPMUDEV_Dashboard::$api->get_membership_data();
if ( 'plugin' == $type ) {
if ( isset( $data['plugin_tags'] ) ) {
$tags = (array) $data['plugin_tags'];
$categories = array(
32 => __( 'Business', 'wpmudev' ),
50 => __( 'SEO', 'wpmudev' ),
498 => __( 'Marketing', 'wpmudev' ),
31 => __( 'Publishing', 'wpmudev' ),
29 => __( 'Community', 'wpmudev' ),
489 => __( 'BuddyPress', 'wpmudev' ),
16 => __( 'Multisite', 'wpmudev' )
);
$res = array();
// Important: Index 0 is "All", added automatically.
$idx = 1;
foreach ( $categories as $tag_key => $name ) {
if ( ! array_key_exists( $tag_key, $tags ) ) {
continue;
}
$res[ $idx ] = array(
'name' => $name,
'pids' => (array) $tags[ $tag_key ]['pids']
);
$idx ++;
}
}
} elseif ( 'theme' == $type ) {
if ( isset( $data['theme_tags'] ) ) {
$res = (array) $data['theme_tags'];
}
}
return $res;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment