Changeset 4205
- Timestamp:
- 10/10/2016 06:36:21 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-user-badges/inc/class-plugin.php
r4150 r4205 69 69 ); 70 70 71 if ( ! in_array( bbp_get_forum_id(), $badgeable_forums ) ) { 72 return; 73 } 74 75 $slug = $type = null; 71 $forum_id = bbp_get_reply_forum_id(); 72 $topic_id = bbp_get_reply_topic_id(); 73 74 if ( ! in_array( $forum_id, $badgeable_forums ) ) { 75 return; 76 } 77 78 $slugs = $types = array(); 76 79 77 80 $user_id = bbp_get_reply_author_id(); … … 82 85 $user_login = get_user_by( 'id', $user_id )->user_login; 83 86 84 $support_forum = \WordPressdotorg\Forums\Plugin::get_instance();85 86 87 // Check if the thread is associated with a plugin. 87 if ( $ slug = $support_forum->plugins->slug) {88 $type = 'plugin';88 if ( $forum_id === \WordPressdotorg\Forums\Plugin::PLUGINS_FORUM_ID ) { 89 $types = array( 'plugin' ); 89 90 } 90 91 // Else check if the thread is associated with a theme. 91 elseif ( $slug = $support_forum->themes->slug ) { 92 $type = 'theme'; 92 elseif ( $forum_id === \WordPressdotorg\Forums\Plugin::THEMES_FORUM_ID ) { 93 $types = array( 'theme' ); 94 } 95 // Else check if the thread is a review. 96 elseif ( $forum_id === \WordPressdotorg\Forums\Plugin::REVIEWS_FORUM_ID ) { 97 // Need to check for plugin AND theme association to know which the review is for. 98 $types = array( 'plugin', 'theme' ); 93 99 } 94 100 // Else not a type of concern. … … 97 103 } 98 104 105 foreach ( $types as $type ) { 106 $slugs = wp_get_post_terms( $topic_id, 'topic-' . $type, array( 'fields' => 'slugs' ) ); 107 if ( $slugs ) { 108 break; 109 } 110 } 111 112 if ( ! $slugs ) { 113 return; 114 } 115 99 116 return array( 100 117 'type' => $type, 101 'slug' => $slug ,118 'slug' => $slugs[0], 102 119 'user_login' => $user_login, 103 120 );
Note: See TracChangeset
for help on using the changeset viewer.