Changeset 6320
- Timestamp:
- 02/26/2017 07:12:34 PM (8 years ago)
- Location:
- trunk/src
- Files:
-
- 1 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bbpress.php
r6302 r6320 247 247 248 248 // Other identifiers 249 $this->user_id = apply_filters( 'bbp_user_id', 'bbp_user' ); 250 $this->tops_id = apply_filters( 'bbp_tops_id', 'bbp_tops' ); 251 $this->reps_id = apply_filters( 'bbp_reps_id', 'bbp_reps' ); 252 $this->favs_id = apply_filters( 'bbp_favs_id', 'bbp_favs' ); 253 $this->subs_id = apply_filters( 'bbp_subs_id', 'bbp_subs' ); 254 $this->view_id = apply_filters( 'bbp_view_id', 'bbp_view' ); 255 $this->edit_id = apply_filters( 'bbp_edit_id', 'edit' ); 256 $this->paged_id = apply_filters( 'bbp_paged_id', 'paged' ); 257 $this->search_id = apply_filters( 'bbp_search_id', 'bbp_search' ); 249 $this->user_id = apply_filters( 'bbp_user_id', 'bbp_user' ); 250 $this->tops_id = apply_filters( 'bbp_tops_id', 'bbp_tops' ); 251 $this->reps_id = apply_filters( 'bbp_reps_id', 'bbp_reps' ); 252 $this->favs_id = apply_filters( 'bbp_favs_id', 'bbp_favs' ); 253 $this->subs_id = apply_filters( 'bbp_subs_id', 'bbp_subs' ); 254 $this->view_id = apply_filters( 'bbp_view_id', 'bbp_view' ); 255 $this->edit_id = apply_filters( 'bbp_edit_id', 'edit' ); 256 $this->paged_id = apply_filters( 'bbp_paged_id', 'paged' ); 257 $this->search_id = apply_filters( 'bbp_search_id', 'bbp_search' ); 258 $this->engagements_id = apply_filters( 'bbp_engagements_id', 'bbp_engagements' ); 258 259 259 260 /** Queries ***********************************************************/ … … 837 838 add_rewrite_tag( '%' . bbp_get_user_favorites_rewrite_id() . '%', '([1]{1,})' ); // User Favorites tag 838 839 add_rewrite_tag( '%' . bbp_get_user_subscriptions_rewrite_id() . '%', '([1]{1,})' ); // User Subscriptions tag 840 add_rewrite_tag( '%' . bbp_get_user_engagements_rewrite_id() . '%', '([1]{1,})' ); // User Engagements tag 839 841 add_rewrite_tag( '%' . bbp_get_user_topics_rewrite_id() . '%', '([1]{1,})' ); // User Topics Tag 840 842 add_rewrite_tag( '%' . bbp_get_user_replies_rewrite_id() . '%', '([1]{1,})' ); // User Replies Tag … … 878 880 $user_favs_slug = bbp_get_user_favorites_slug(); 879 881 $user_subs_slug = bbp_get_user_subscriptions_slug(); 882 $user_engs_slug = bbp_get_user_engagements_slug(); 880 883 881 884 // Unique rewrite ID's … … 890 893 $user_tops_id = bbp_get_user_topics_rewrite_id(); 891 894 $user_reps_id = bbp_get_user_replies_rewrite_id(); 895 $user_engs_id = bbp_get_user_engagements_rewrite_id(); 892 896 893 897 // Rewrite rule matches used repeatedly below … … 908 912 $favs_rule = '/([^/]+)/' . $user_favs_slug . '/?$'; 909 913 $subs_rule = '/([^/]+)/' . $user_subs_slug . '/?$'; 914 $engs_rule = '/([^/]+)/' . $user_engs_slug . '/?$'; 910 915 $tops_paged_rule = '/([^/]+)/' . $topic_archive_slug . '/' . $paged_slug . '/?([0-9]{1,})/?$'; 911 916 $reps_paged_rule = '/([^/]+)/' . $reply_archive_slug . '/' . $paged_slug . '/?([0-9]{1,})/?$'; 912 917 $favs_paged_rule = '/([^/]+)/' . $user_favs_slug . '/' . $paged_slug . '/?([0-9]{1,})/?$'; 913 918 $subs_paged_rule = '/([^/]+)/' . $user_subs_slug . '/' . $paged_slug . '/?([0-9]{1,})/?$'; 919 $engs_paged_rule = '/([^/]+)/' . $user_engs_slug . '/' . $paged_slug . '/?([0-9]{1,})/?$'; 914 920 915 921 // Edit Forum|Topic|Reply|Topic-tag … … 924 930 add_rewrite_rule( $user_slug . $favs_paged_rule, 'index.php?' . $user_id . '=$matches[1]&' . $user_favs_id . '=1&' . $paged_id . '=$matches[2]', $priority ); 925 931 add_rewrite_rule( $user_slug . $subs_paged_rule, 'index.php?' . $user_id . '=$matches[1]&' . $user_subs_id . '=1&' . $paged_id . '=$matches[2]', $priority ); 932 add_rewrite_rule( $user_slug . $engs_paged_rule, 'index.php?' . $user_id . '=$matches[1]&' . $user_engs_id . '=1&' . $paged_id . '=$matches[2]', $priority ); 926 933 add_rewrite_rule( $user_slug . $tops_rule, 'index.php?' . $user_id . '=$matches[1]&' . $user_tops_id . '=1', $priority ); 927 934 add_rewrite_rule( $user_slug . $reps_rule, 'index.php?' . $user_id . '=$matches[1]&' . $user_reps_id . '=1', $priority ); 928 935 add_rewrite_rule( $user_slug . $favs_rule, 'index.php?' . $user_id . '=$matches[1]&' . $user_favs_id . '=1', $priority ); 929 936 add_rewrite_rule( $user_slug . $subs_rule, 'index.php?' . $user_id . '=$matches[1]&' . $user_subs_id . '=1', $priority ); 937 add_rewrite_rule( $user_slug . $engs_rule, 'index.php?' . $user_id . '=$matches[1]&' . $user_engs_id . '=1', $priority ); 930 938 add_rewrite_rule( $user_slug . $edit_rule, 'index.php?' . $user_id . '=$matches[1]&' . $edit_id . '=1', $priority ); 931 939 add_rewrite_rule( $user_slug . $root_rule, 'index.php?' . $user_id . '=$matches[1]', $priority ); -
trunk/src/includes/admin/settings.php
r6277 r6320 390 390 'sanitize_callback' => 'bbp_sanitize_slug', 391 391 'args' => array( 'label_for'=>'_bbp_user_subs_slug' ) 392 ), 393 394 // Engagements slug setting 395 '_bbp_user_engagements_slug' => array( 396 'title' => __( 'Engagements', 'bbpress' ), 397 'callback' => 'bbp_admin_setting_callback_user_engagements_slug', 398 'sanitize_callback' => 'bbp_sanitize_slug', 399 'args' => array( 'label_for'=>'_bbp_user_engagements_slug' ) 392 400 ) 393 401 ), … … 1060 1068 // Slug Check 1061 1069 bbp_form_slug_conflict_check( '_bbp_user_subs_slug', 'subscriptions' ); 1070 } 1071 1072 /** 1073 * Engagements slug setting field 1074 * 1075 * @since 2.6.0 bbPress (r6320) 1076 * 1077 * @uses bbp_form_option() To output the option value 1078 */ 1079 function bbp_admin_setting_callback_user_engagements_slug() { 1080 ?> 1081 1082 <input name="_bbp_user_engagements_slug" id="_bbp_user_engagements_slug" type="text" class="regular-text code" value="<?php bbp_form_option( '_bbp_user_engagements_slug', 'engagements', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_user_engagements_slug' ); ?> /> 1083 1084 <?php 1085 // Slug Check 1086 bbp_form_slug_conflict_check( '_bbp_user_engagements_slug', 'engagements' ); 1062 1087 } 1063 1088 -
trunk/src/includes/admin/tools.php
r6283 r6320 244 244 'callback' => 'bbp_admin_repair_topic_voice_count', 245 245 'priority' => 65, 246 'overhead' => ' medium',246 'overhead' => 'high', 247 247 'components' => array( bbp_get_topic_post_type(), bbp_get_user_rewrite_id() ) 248 248 ) ); … … 358 358 ) ); 359 359 360 // Migrate topic engagements to post-meta 361 bbp_register_repair_tool( array( 362 'id' => 'bbp-user-topic-engagements-move', 363 'type' => 'upgrade', 364 'description' => __( 'Upgrade topic engagements', 'bbpress' ), 365 'callback' => 'bbp_admin_upgrade_user_engagements', 366 'priority' => 120, 367 'overhead' => 'medium', 368 'components' => array( bbp_get_user_rewrite_id(), bbp_get_user_engagements_rewrite_id() ) 369 ) ); 370 360 371 // Remove favorites from user-meta 361 372 bbp_register_repair_tool( array( … … 364 375 'description' => __( 'Remove favorites from user-meta', 'bbpress' ), 365 376 'callback' => 'bbp_admin_upgrade_remove_favorites_from_usermeta', 366 'priority' => 12 0,377 'priority' => 125, 367 378 'overhead' => 'medium', 368 379 'components' => array( bbp_get_user_rewrite_id(), bbp_get_user_favorites_rewrite_id() ) … … 375 386 'description' => __( 'Remove topic subscriptions from user-meta', 'bbpress' ), 376 387 'callback' => 'bbp_admin_upgrade_remove_topic_subscriptions_from_usermeta', 377 'priority' => 1 25,388 'priority' => 130, 378 389 'overhead' => 'medium', 379 390 'components' => array( bbp_get_user_rewrite_id(), bbp_get_user_subscriptions_rewrite_id() ) … … 386 397 'description' => __( 'Remove forum subscriptions from user-meta', 'bbpress' ), 387 398 'callback' => 'bbp_admin_upgrade_remove_forum_subscriptions_from_usermeta', 388 'priority' => 13 0,399 'priority' => 135, 389 400 'overhead' => 'medium', 390 401 'components' => array( bbp_get_user_rewrite_id(), bbp_get_user_subscriptions_rewrite_id() ) -
trunk/src/includes/admin/tools/common.php
r6282 r6320 313 313 case bbp_get_user_subscriptions_rewrite_id() : 314 314 $name = esc_html__( 'Subscriptions', 'bbpress' ); 315 break; 316 case bbp_get_user_engagements_rewrite_id() : 317 $name = esc_html__( 'Engagements', 'bbpress' ); 315 318 break; 316 319 default : -
trunk/src/includes/admin/tools/repair.php
r6282 r6320 233 233 $result = __( 'Failed!', 'bbpress' ); 234 234 235 $sql_delete = "DELETE FROM `{$bbp_db->postmeta}` WHERE `meta_key` = '_bbp_voice_count'";235 $sql_delete = "DELETE FROM {$bbp_db->postmeta} WHERE meta_key IN ('_bbp_voice_count', '_bbp_engagement')"; 236 236 if ( is_wp_error( $bbp_db->query( $sql_delete ) ) ) { 237 237 return array( 1, sprintf( $statement, $result ) ); … … 244 244 $cps = bbp_get_closed_status_id(); 245 245 246 $sql = "INSERT INTO `{$bbp_db->postmeta}` (`post_id`, `meta_key`, `meta_value`) ( 247 SELECT `postmeta`.`meta_value`, '_bbp_voice_count', COUNT(DISTINCT `post_author`) as `meta_value` 248 FROM `{$bbp_db->posts}` AS `posts` 249 LEFT JOIN `{$bbp_db->postmeta}` AS `postmeta` 250 ON `posts`.`ID` = `postmeta`.`post_id` 251 AND `postmeta`.`meta_key` = '_bbp_topic_id' 252 WHERE `posts`.`post_type` IN ( '{$tpt}', '{$rpt}' ) 253 AND `posts`.`post_status` IN ( '{$pps}', '{$cps}' ) 254 AND `posts`.`post_author` != '0' 255 GROUP BY `postmeta`.`meta_value`)"; 256 257 if ( is_wp_error( $bbp_db->query( $sql ) ) ) { 246 $voice_id_sql = $bbp_db->prepare( "INSERT INTO {$bbp_db->postmeta} (post_id, meta_key, meta_value) ( 247 SELECT postmeta.meta_value, '_bbp_engagement', posts.post_author 248 FROM {$bbp_db->posts} AS posts 249 LEFT JOIN {$bbp_db->postmeta} AS postmeta 250 ON posts.ID = postmeta.post_id 251 AND postmeta.meta_key = '_bbp_topic_id' 252 WHERE posts.post_type IN (%s, %s) 253 AND posts.post_status IN (%s, %s))", $tpt, $rpt, $pps, $cps ); 254 255 if ( is_wp_error( $bbp_db->query( $voice_id_sql ) ) ) { 258 256 return array( 2, sprintf( $statement, $result ) ); 257 } 258 259 $voice_count_sql = "INSERT INTO {$bbp_db->postmeta} (post_id, meta_key, meta_value) ( 260 SELECT post_id, '_bbp_voice_count', COUNT(DISTINCT meta_value) 261 FROM {$bbp_db->postmeta} 262 WHERE meta_key = '_bbp_engagement' 263 GROUP BY post_id ORDER BY post_id)"; 264 265 if ( is_wp_error( $bbp_db->query( $voice_count_sql ) ) ) { 266 return array( 3, sprintf( $statement, $result ) ); 259 267 } 260 268 … … 695 703 696 704 // Query for users with favorites 705 $key = $bbp_db->prefix . '_bbp_favorites'; 697 706 $users = $bbp_db->get_results( "SELECT `user_id`, `meta_value` AS `favorites` FROM `{$bbp_db->usermeta}` WHERE `meta_key` = '{$key}'" ); 698 707 -
trunk/src/includes/admin/tools/upgrades.php
r6282 r6320 156 156 157 157 /** 158 * Upgrade user engagements for bbPress 2.6 and higher 159 * 160 * @since 2.6.0 bbPress (r63010) 161 * 162 * @return array An array of the status code and the message 163 */ 164 function bbp_admin_upgrade_user_engagements() { 165 166 // Define variables 167 $bbp_db = bbp_db(); 168 $statement = __( 'Upgrading user engagements … %s', 'bbpress' ); 169 $result = __( 'No engagements to upgrade.', 'bbpress' ); 170 $total = 0; 171 172 // Delete previous engagements 173 $sql_delete = "DELETE FROM {$bbp_db->postmeta} WHERE meta_key = '_bbp_engagement'"; 174 if ( is_wp_error( $bbp_db->query( $sql_delete ) ) ) { 175 return array( 1, sprintf( $statement, $result ) ); 176 } 177 178 // Post types and status 179 $tpt = bbp_get_topic_post_type(); 180 $rpt = bbp_get_reply_post_type(); 181 $pps = bbp_get_public_status_id(); 182 $cps = bbp_get_closed_status_id(); 183 $sql = $bbp_db->prepare( "SELECT postmeta.meta_value, '_bbp_engagement', posts.post_author 184 FROM {$bbp_db->posts} AS posts 185 LEFT JOIN {$bbp_db->postmeta} AS postmeta 186 ON posts.ID = postmeta.post_id 187 AND postmeta.meta_key = '_bbp_topic_id' 188 WHERE posts.post_type IN (%s, %s) 189 AND posts.post_status IN (%s, %s)", $tpt, $rpt, $pps, $cps ); 190 191 $engagements = $bbp_db->get_results( $sql ); 192 193 // Bail if no closed topics found 194 if ( empty( $engagements ) || is_wp_error( $engagements ) ) { 195 return array( 1, sprintf( $statement, $result ) ); 196 } 197 198 // Loop through each user's favorites 199 foreach ( $engagements as $meta ) { 200 201 // Skip if already exists 202 if ( $bbp_db->get_var( $bbp_db->prepare( "SELECT * FROM {$bbp_db->postmeta} WHERE post_id = %d AND meta_key = %s AND meta_value = %d LIMIT 1", $meta->meta_value, '_bbp_engagement', $meta->post_author ) ) ) { 203 continue; 204 } 205 206 // Add the post meta 207 $added = add_post_meta( $meta->meta_value, '_bbp_engagement', $meta->post_author, false ); 208 209 // Bump counts if successfully added 210 if ( ! empty( $added ) ) { 211 ++$total; 212 } 213 } 214 215 // Cleanup 216 unset( $engagements, $added ); 217 218 // Complete results 219 $result = sprintf( _n( 'Complete! %d engagements upgraded.', 'Complete! %d engagements upgraded.', $total, 'bbpress' ), $total ); 220 221 return array( 0, sprintf( $statement, $result ) ); 222 } 223 224 /** 158 225 * Upgrade user favorites for bbPress 2.6 and higher 159 226 * -
trunk/src/includes/common/template.php
r6299 r6320 615 615 616 616 /** 617 * Check if current page shows the topics created by a bbPress user (profile617 * Check if current page shows the replies created by a bbPress user (profile 618 618 * page) 619 619 * 620 620 * @since 2.2.0 bbPress (r4225) 621 621 * 622 * @return bool True if it's the topics created page, false if not622 * @return bool True if it's the replies created page, false if not 623 623 */ 624 624 function bbp_is_replies_created() { … … 792 792 793 793 return (bool) apply_filters( 'bbp_is_single_user_replies', $retval ); 794 } 795 796 /** 797 * Check if current page is a user engagements page 798 * 799 * @since 2.6.0 bbPress (r6320) 800 * 801 * @uses WP_Query Checks if WP_Query::bbp_is_single_user_engagements is set to true 802 * @return bool True if it's a user's replies page, false if not 803 */ 804 function bbp_is_single_user_engagements() { 805 global $wp_query; 806 807 // Assume false 808 $retval = false; 809 810 // Check query 811 if ( ! empty( $wp_query->bbp_is_single_user_engagements ) && ( true === $wp_query->bbp_is_single_user_engagements ) ) { 812 $retval = true; 813 } 814 815 return (bool) apply_filters( 'bbp_is_single_user_engagements', $retval ); 794 816 } 795 817 -
trunk/src/includes/core/functions.php
r6014 r6320 540 540 541 541 /** 542 * Return the unique ID for user caps rewrite rules542 * Return the unique ID for user favorites rewrite rules 543 543 * 544 544 * @since 2.2.0 bbPress (r4181) … … 551 551 552 552 /** 553 * Return the unique ID for user caps rewrite rules553 * Return the unique ID for user subscriptions rewrite rules 554 554 * 555 555 * @since 2.2.0 bbPress (r4181) … … 559 559 function bbp_get_user_subscriptions_rewrite_id() { 560 560 return bbpress()->subs_id; 561 } 562 563 /** 564 * Return the unique ID for user engagement rewrite rules 565 * 566 * @since 2.6.0 bbPress (r6320) 567 * 568 * @return string 569 */ 570 function bbp_get_user_engagements_rewrite_id() { 571 return bbpress()->engagements_id; 561 572 } 562 573 -
trunk/src/includes/core/options.php
r6270 r6320 627 627 628 628 /** 629 * Return the single user engagements slug 630 * 631 * @since 2.6.0 bbPress (r6320) 632 * 633 * @return string 634 */ 635 function bbp_get_user_engagements_slug( $default = 'engagements' ) { 636 return apply_filters( 'bbp_get_user_engagements_slug', get_option( '_bbp_user_engagements_slug', $default ) ); 637 } 638 639 /** 629 640 * Return the topic view slug 630 641 * -
trunk/src/includes/core/template-functions.php
r6241 r6320 537 537 /** User Exists *******************************************************/ 538 538 539 $is_favs = $posts_query->get( bbp_get_user_favorites_rewrite_id() ); 540 $is_subs = $posts_query->get( bbp_get_user_subscriptions_rewrite_id() ); 541 $is_topics = $posts_query->get( bbp_get_user_topics_rewrite_id() ); 542 $is_replies = $posts_query->get( bbp_get_user_replies_rewrite_id() ); 539 $is_favs = $posts_query->get( bbp_get_user_favorites_rewrite_id() ); 540 $is_subs = $posts_query->get( bbp_get_user_subscriptions_rewrite_id() ); 541 $is_topics = $posts_query->get( bbp_get_user_topics_rewrite_id() ); 542 $is_replies = $posts_query->get( bbp_get_user_replies_rewrite_id() ); 543 $is_engagements = $posts_query->get( bbp_get_user_engagements_rewrite_id() ); 543 544 544 545 // View or edit? … … 581 582 } elseif ( ! empty( $is_replies ) ) { 582 583 $posts_query->bbp_is_single_user_replies = true; 584 585 // User engagements 586 } elseif ( ! empty( $is_engagements ) ) { 587 $posts_query->bbp_is_single_user_engagements = true; 583 588 584 589 // User profile -
trunk/src/includes/core/update.php
r6292 r6320 327 327 bbp_admin_upgrade_user_topic_subscriptions(); 328 328 bbp_admin_upgrade_user_forum_subscriptions(); 329 bbp_admin_repair_topic_voice_count(); 329 330 } 330 331 } -
trunk/src/includes/extend/buddypress/functions.php
r6285 r6320 176 176 177 177 /** 178 * Hook bbPress engagements template into plugins template 179 * 180 * @since 2.6.0 bbPress (r6320) 181 * 182 * @uses add_action() To add the content hook 183 * @uses bp_core_load_template() To load the plugins template 184 */ 185 function bbp_member_forums_screen_engagements() { 186 add_action( 'bp_template_content', 'bbp_member_forums_engagements_content' ); 187 bp_core_load_template( apply_filters( 'bbp_member_forums_screen_engagements', 'members/single/plugins' ) ); 188 } 189 190 /** 178 191 * Hook bbPress favorites template into plugins template 179 192 * … … 235 248 236 249 <?php bbp_get_template_part( 'user', 'replies-created' ); ?> 250 251 </div> 252 253 <?php 254 } 255 256 /** 257 * Get the topic engagements template part 258 * 259 * @since 2.6.0 bbPress (r6320) 260 * 261 * @uses bbp_get_template_part() 262 */ 263 function bbp_member_forums_engagements_content() { 264 ?> 265 266 <div id="bbpress-forums" class="bbpress-wrapper"> 267 268 <?php bbp_get_template_part( 'user', 'engagements' ); ?> 237 269 238 270 </div> -
trunk/src/includes/extend/buddypress/loader.php
r6284 r6320 219 219 ); 220 220 221 // Engagements 222 $sub_nav[] = array( 223 'name' => __( 'Engagements', 'bbpress' ), 224 'slug' => bbp_get_user_engagements_slug(), 225 'parent_url' => $forums_link, 226 'parent_slug' => $this->slug, 227 'screen_function' => 'bbp_member_forums_screen_engagements', 228 'position' => 60, 229 'item_css_id' => 'engagements' 230 ); 231 221 232 // Favorite topics 222 233 if ( bbp_is_favorites_active() ){ … … 227 238 'parent_slug' => $this->slug, 228 239 'screen_function' => 'bbp_member_forums_screen_favorites', 229 'position' => 60,240 'position' => 80, 230 241 'item_css_id' => 'favorites' 231 242 ); … … 240 251 'parent_slug' => $this->slug, 241 252 'screen_function' => 'bbp_member_forums_screen_subscriptions', 242 'position' => 60,253 'position' => 100, 243 254 'item_css_id' => 'subscriptions' 244 255 ); -
trunk/src/includes/topics/template.php
r6309 r6320 359 359 if ( bbp_is_single_user_topics() ) { 360 360 $base = bbp_get_user_topics_created_url( bbp_get_displayed_user_id() ); 361 362 // User's engagements 363 } elseif ( bbp_is_single_user_engagements() ) { 364 $base = bbp_get_user_engagements_url( bbp_get_displayed_user_id() ); 361 365 362 366 // User's favorites -
trunk/src/includes/users/functions.php
r6311 r6320 267 267 * Get the users who have engaged in a topic 268 268 * 269 * @since 2.6.0 bbPress (r63 10)269 * @since 2.6.0 bbPress (r6320) 270 270 * 271 271 * @param int $topic_id Optional. Topic id … … 285 285 * Get a user's topic engagements 286 286 * 287 * @since 2.6.0 bbPress (r63 10)287 * @since 2.6.0 bbPress (r6320) 288 288 * 289 289 * @param int $user_id Optional. User id … … 311 311 * Get a user's engaged topic ids 312 312 * 313 * @since 2.6.0 bbPress (r63 10)313 * @since 2.6.0 bbPress (r6320) 314 314 * 315 315 * @param int $user_id Optional. User id … … 340 340 * Check if a user is engaged in a topic or not 341 341 * 342 * @since 2.6.0 bbPress (r63 10)342 * @since 2.6.0 bbPress (r6320) 343 343 * 344 344 * @param int $user_id Optional. User id … … 386 386 * Add a topic to user's engagements 387 387 * 388 * @since 2.6.0 bbPress (r63 10)388 * @since 2.6.0 bbPress (r6320) 389 389 * 390 390 * @param int $user_id Optional. User id … … 425 425 * Remove a topic from user's engagements 426 426 * 427 * @since 2.6.0 bbPress (r63 10)427 * @since 2.6.0 bbPress (r6320) 428 428 * 429 429 * @param int $user_id Optional. User id -
trunk/src/includes/users/template.php
r6319 r6320 1037 1037 $paged = (bool) bbpress()->forum_query->in_the_loop; 1038 1038 } 1039 1039 1040 1040 // Pretty permalinks 1041 1041 if ( bbp_use_pretty_urls() ) { … … 1478 1478 * 1479 1479 * @param int $user_id Optional. User id 1480 * @uses bbp_get_ favorites_permalink() To get the favorites permalink1480 * @uses bbp_get_user_topics_created_url() To get the favorites permalink 1481 1481 */ 1482 1482 function bbp_user_topics_created_url( $user_id = 0 ) { … … 1490 1490 * @param int $user_id Optional. User id 1491 1491 * @uses bbp_get_user_profile_url() To get the user profile url 1492 * @uses apply_filters() Calls 'bbp_get_ favorites_permalink' with the1492 * @uses apply_filters() Calls 'bbp_get_user_topics_created_url' with the 1493 1493 * user profile url and user id 1494 1494 * @return string Permanent link to user profile page … … 1526 1526 } 1527 1527 1528 /** Topics Created ************************************************************/1528 /** Replies Created ************************************************************/ 1529 1529 1530 1530 /** … … 1534 1534 * 1535 1535 * @param int $user_id Optional. User id 1536 * @uses bbp_get_ favorites_permalink() To get the favorites permalink1536 * @uses bbp_get_user_replies_created_url() To get the favorites permalink 1537 1537 */ 1538 1538 function bbp_user_replies_created_url( $user_id = 0 ) { … … 1546 1546 * @param int $user_id Optional. User id 1547 1547 * @uses bbp_get_user_profile_url() To get the user profile url 1548 * @uses apply_filters() Calls 'bbp_get_ favorites_permalink' with the1548 * @uses apply_filters() Calls 'bbp_get_user_replies_created_url' with the 1549 1549 * user profile url and user id 1550 1550 * @return string Permanent link to user profile page … … 1580 1580 1581 1581 return apply_filters( 'bbp_get_user_replies_created_url', $url, $user_id ); 1582 } 1583 1584 /** Engagements ***************************************************************/ 1585 1586 /** 1587 * Output the link to the user's engagements 1588 * 1589 * @since 2.6.0 bbPress (r6320) 1590 * 1591 * @param int $user_id Optional. User id 1592 * @uses bbp_get_user_engagements_url() To get the engagements permalink 1593 */ 1594 function bbp_user_engagements_url( $user_id = 0 ) { 1595 echo esc_url( bbp_get_user_engagements_url( $user_id ) ); 1596 } 1597 /** 1598 * Return the link to the user's engagements 1599 * 1600 * @since 2.6.0 bbPress (r6320) 1601 * 1602 * @param int $user_id Optional. User id 1603 * @uses bbp_get_user_profile_url() To get the user profile url 1604 * @uses apply_filters() Calls 'bbp_get_user_engagements_url' with the 1605 * user profile url and user id 1606 * @return string Permanent link to user profile page 1607 */ 1608 function bbp_get_user_engagements_url( $user_id = 0 ) { 1609 1610 // Use displayed user ID if there is one, and one isn't requested 1611 $user_id = bbp_get_user_id( $user_id ); 1612 if ( empty( $user_id ) ) { 1613 return false; 1614 } 1615 1616 // Allow early overriding of the profile URL to cut down on processing 1617 $early_url = apply_filters( 'bbp_pre_get_user_engagements_url', $user_id ); 1618 if ( is_string( $early_url ) ) { 1619 return $early_url; 1620 } 1621 1622 // Get user profile URL 1623 $profile_url = bbp_get_user_profile_url( $user_id ); 1624 1625 // Pretty permalinks 1626 if ( bbp_use_pretty_urls() ) { 1627 $url = trailingslashit( $profile_url ) . bbp_get_user_engagements_slug(); 1628 $url = user_trailingslashit( $url ); 1629 1630 // Unpretty permalinks 1631 } else { 1632 $url = add_query_arg( array( 1633 bbp_get_user_engagements_rewrite_id() => '1', 1634 ), $profile_url ); 1635 } 1636 1637 return apply_filters( 'bbp_get_user_engagements_url', $url, $user_id ); 1582 1638 } 1583 1639 -
trunk/src/templates/default/bbpress/content-single-user.php
r6258 r6320 24 24 25 25 <div id="bbp-user-body"> 26 <?php if ( bbp_is_favorites() ) bbp_get_template_part( 'user', 'favorites' ); ?> 27 <?php if ( bbp_is_subscriptions() ) bbp_get_template_part( 'user', 'subscriptions' ); ?> 28 <?php if ( bbp_is_single_user_topics() ) bbp_get_template_part( 'user', 'topics-created' ); ?> 29 <?php if ( bbp_is_single_user_replies() ) bbp_get_template_part( 'user', 'replies-created' ); ?> 30 <?php if ( bbp_is_single_user_edit() ) bbp_get_template_part( 'form', 'user-edit' ); ?> 31 <?php if ( bbp_is_single_user_profile() ) bbp_get_template_part( 'user', 'profile' ); ?> 26 <?php if ( bbp_is_favorites() ) bbp_get_template_part( 'user', 'favorites' ); ?> 27 <?php if ( bbp_is_subscriptions() ) bbp_get_template_part( 'user', 'subscriptions' ); ?> 28 <?php if ( bbp_is_single_user_engagements() ) bbp_get_template_part( 'user', 'engagements' ); ?> 29 <?php if ( bbp_is_single_user_topics() ) bbp_get_template_part( 'user', 'topics-created' ); ?> 30 <?php if ( bbp_is_single_user_replies() ) bbp_get_template_part( 'user', 'replies-created' ); ?> 31 <?php if ( bbp_is_single_user_edit() ) bbp_get_template_part( 'form', 'user-edit' ); ?> 32 <?php if ( bbp_is_single_user_profile() ) bbp_get_template_part( 'user', 'profile' ); ?> 32 33 </div> 33 34 </div> -
trunk/src/templates/default/bbpress/user-details.php
r6258 r6320 44 44 </li> 45 45 46 <li class="<?php if ( bbp_is_single_user_engagements() ) :?>current<?php endif; ?>"> 47 <span class='bbp-user-engagements-created-link'> 48 <a href="<?php bbp_user_engagements_url(); ?>" title="<?php printf( esc_attr__( "%s's Engagements", 'bbpress' ), bbp_get_displayed_user_field( 'display_name' ) ); ?>"><?php esc_html_e( 'Engagements', 'bbpress' ); ?></a> 49 </span> 50 </li> 51 46 52 <?php if ( bbp_is_favorites_active() ) : ?> 47 53 <li class="<?php if ( bbp_is_favorites() ) :?>current<?php endif; ?>">
Note: See TracChangeset
for help on using the changeset viewer.