Changeset 4258 for trunk/bbp-includes/users/options.php
- Timestamp:
- 10/19/2012 07:42:49 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bbp-includes/users/options.php
r4249 r4258 126 126 * 127 127 * @param int $user_id 128 * @param boolean $integer Optional. Whether or not to format the result 128 129 * @uses bbp_get_user_topic_count() 129 130 * @return string 130 131 */ 131 function bbp_user_topic_count( $user_id = 0 ) {132 echo bbp_get_user_topic_count( $user_id );132 function bbp_user_topic_count( $user_id = 0, $integer = false ) { 133 echo bbp_get_user_topic_count( $user_id, $integer ); 133 134 } 134 135 /** … … 138 139 * 139 140 * @param int $user_id 141 * @param boolean $integer Optional. Whether or not to format the result 140 142 * @uses bbp_get_user_id() 141 143 * @uses get_user_option() … … 143 145 * @return string 144 146 */ 145 function bbp_get_user_topic_count( $user_id = 0 ) { 146 147 // Validate user id 148 $user_id = bbp_get_user_id( $user_id ); 149 if ( empty( $user_id ) ) 150 return false; 151 152 $count = get_user_option( '_bbp_topic_count', $user_id ); 153 154 return apply_filters( 'bbp_get_user_topic_count', (int) $count, $user_id ); 147 function bbp_get_user_topic_count( $user_id = 0, $integer = false ) { 148 149 // Validate user id 150 $user_id = bbp_get_user_id( $user_id ); 151 if ( empty( $user_id ) ) 152 return false; 153 154 $count = absint( get_user_option( '_bbp_topic_count', $user_id ) ); 155 $filter = ( false == $integer ) ? 'bbp_get_user_topic_count_int' : 'bbp_get_user_topic_count'; 156 157 return apply_filters( $filter, $count, $user_id ); 155 158 } 156 159 … … 161 164 * 162 165 * @param int $user_id 166 * @param boolean $integer Optional. Whether or not to format the result 163 167 * @uses bbp_get_user_reply_count() 164 168 * @return string 165 169 */ 166 function bbp_user_reply_count( $user_id = 0 ) {167 echo bbp_get_user_reply_count( $user_id );170 function bbp_user_reply_count( $user_id = 0, $integer = false ) { 171 echo bbp_get_user_reply_count( $user_id, $integer ); 168 172 } 169 173 /** … … 173 177 * 174 178 * @param int $user_id 179 * @param boolean $integer Optional. Whether or not to format the result 175 180 * @uses bbp_get_user_id() 176 181 * @uses get_user_option() … … 178 183 * @return string 179 184 */ 180 function bbp_get_user_reply_count( $user_id = 0 ) { 181 182 // Validate user id 183 $user_id = bbp_get_user_id( $user_id ); 184 if ( empty( $user_id ) ) 185 return false; 186 187 $count = get_user_option( '_bbp_reply_count', $user_id ); 188 189 return apply_filters( 'bbp_get_user_reply_count', (int) $count, $user_id ); 185 function bbp_get_user_reply_count( $user_id = 0, $integer = false ) { 186 187 // Validate user id 188 $user_id = bbp_get_user_id( $user_id ); 189 if ( empty( $user_id ) ) 190 return false; 191 192 $count = absint( get_user_option( '_bbp_reply_count', $user_id ) ); 193 $filter = ( true == $integer ) ? 'bbp_get_user_topic_count_int' : 'bbp_get_user_topic_count'; 194 195 return apply_filters( $filter, $count, $user_id ); 190 196 } 191 197 … … 196 202 * 197 203 * @param int $user_id 204 * @param boolean $integer Optional. Whether or not to format the result 198 205 * @uses bbp_get_user_post_count() 199 206 * @return string 200 207 */ 201 function bbp_user_post_count( $user_id = 0 ) {202 echo bbp_get_user_post_count( $user_id );208 function bbp_user_post_count( $user_id = 0, $integer = false ) { 209 echo bbp_get_user_post_count( $user_id, $integer ); 203 210 } 204 211 /** … … 208 215 * 209 216 * @param int $user_id 217 * @param boolean $integer Optional. Whether or not to format the result 210 218 * @uses bbp_get_user_id() 211 219 * @uses get_user_option() … … 213 221 * @return string 214 222 */ 215 function bbp_get_user_post_count( $user_id = 0 ) { 216 217 // Validate user id 218 $user_id = bbp_get_user_id( $user_id ); 219 if ( empty( $user_id ) ) 220 return false; 221 222 $topics = bbp_get_user_topic_count( $user_id ); 223 $replies = bbp_get_user_reply_count( $user_id ); 224 $count = (int) $topics + (int) $replies; 225 226 return apply_filters( 'bbp_get_user_post_count', (int) $count, $user_id ); 223 function bbp_get_user_post_count( $user_id = 0, $integer = false ) { 224 225 // Validate user id 226 $user_id = bbp_get_user_id( $user_id ); 227 if ( empty( $user_id ) ) 228 return false; 229 230 $topics = bbp_get_user_topic_count( $user_id, true ); 231 $replies = bbp_get_user_reply_count( $user_id, true ); 232 $count = absint( $topics + $replies ); 233 $filter = ( true == $integer ) ? 'bbp_get_user_post_count_int' : 'bbp_get_user_post_count'; 234 235 return apply_filters( $filter, $count, $user_id ); 227 236 } 228 237
Note: See TracChangeset
for help on using the changeset viewer.