Changeset 7380
- Timestamp:
- 12/05/2025 02:27:53 AM (6 months ago)
- Location:
- trunk
- Files:
-
- 69 edited
-
bbpress.php (modified) (1 diff)
-
src/bbpress.php (modified) (27 diffs)
-
src/includes/admin/actions.php (modified) (17 diffs)
-
src/includes/admin/classes/class-bbp-admin.php (modified) (33 diffs)
-
src/includes/admin/classes/class-bbp-converter-base.php (modified) (24 diffs)
-
src/includes/admin/classes/class-bbp-converter-db.php (modified) (2 diffs)
-
src/includes/admin/classes/class-bbp-converter.php (modified) (1 diff)
-
src/includes/admin/classes/class-bbp-topic-replies-list-table.php (modified) (15 diffs)
-
src/includes/admin/common.php (modified) (5 diffs)
-
src/includes/admin/forums.php (modified) (25 diffs)
-
src/includes/admin/metaboxes.php (modified) (13 diffs)
-
src/includes/admin/replies.php (modified) (27 diffs)
-
src/includes/admin/settings.php (modified) (71 diffs)
-
src/includes/admin/tools.php (modified) (7 diffs)
-
src/includes/admin/tools/common.php (modified) (25 diffs)
-
src/includes/admin/tools/converter.php (modified) (2 diffs)
-
src/includes/admin/tools/help.php (modified) (4 diffs)
-
src/includes/admin/tools/repair.php (modified) (22 diffs)
-
src/includes/admin/tools/reset.php (modified) (3 diffs)
-
src/includes/admin/tools/upgrade.php (modified) (10 diffs)
-
src/includes/admin/topics.php (modified) (31 diffs)
-
src/includes/admin/users.php (modified) (13 diffs)
-
src/includes/common/ajax.php (modified) (7 diffs)
-
src/includes/common/classes.php (modified) (18 diffs)
-
src/includes/common/engagements.php (modified) (34 diffs)
-
src/includes/common/formatting.php (modified) (23 diffs)
-
src/includes/common/functions.php (modified) (53 diffs)
-
src/includes/common/locale.php (modified) (1 diff)
-
src/includes/common/locks.php (modified) (2 diffs)
-
src/includes/common/shortcodes.php (modified) (1 diff)
-
src/includes/common/template.php (modified) (58 diffs)
-
src/includes/common/widgets.php (modified) (50 diffs)
-
src/includes/core/abstraction.php (modified) (16 diffs)
-
src/includes/core/actions.php (modified) (8 diffs)
-
src/includes/core/cache.php (modified) (4 diffs)
-
src/includes/core/capabilities.php (modified) (15 diffs)
-
src/includes/core/extend.php (modified) (3 diffs)
-
src/includes/core/filters.php (modified) (4 diffs)
-
src/includes/core/functions.php (modified) (42 diffs)
-
src/includes/core/options.php (modified) (49 diffs)
-
src/includes/core/sub-actions.php (modified) (44 diffs)
-
src/includes/core/template-functions.php (modified) (12 diffs)
-
src/includes/core/template-loader.php (modified) (25 diffs)
-
src/includes/core/theme-compat.php (modified) (18 diffs)
-
src/includes/core/update.php (modified) (20 diffs)
-
src/includes/extend/akismet.php (modified) (20 diffs)
-
src/includes/extend/buddypress/activity.php (modified) (29 diffs)
-
src/includes/extend/buddypress/functions.php (modified) (38 diffs)
-
src/includes/extend/buddypress/groups.php (modified) (45 diffs)
-
src/includes/extend/buddypress/loader.php (modified) (12 diffs)
-
src/includes/extend/buddypress/members.php (modified) (13 diffs)
-
src/includes/extend/buddypress/notifications.php (modified) (3 diffs)
-
src/includes/forums/capabilities.php (modified) (5 diffs)
-
src/includes/forums/functions.php (modified) (66 diffs)
-
src/includes/forums/template.php (modified) (117 diffs)
-
src/includes/replies/capabilities.php (modified) (4 diffs)
-
src/includes/replies/functions.php (modified) (38 diffs)
-
src/includes/replies/template.php (modified) (117 diffs)
-
src/includes/search/functions.php (modified) (6 diffs)
-
src/includes/search/template.php (modified) (13 diffs)
-
src/includes/topics/capabilities.php (modified) (6 diffs)
-
src/includes/topics/functions.php (modified) (71 diffs)
-
src/includes/topics/template.php (modified) (67 diffs)
-
src/includes/users/capabilities.php (modified) (22 diffs)
-
src/includes/users/engagements.php (modified) (51 diffs)
-
src/includes/users/functions.php (modified) (22 diffs)
-
src/includes/users/options.php (modified) (13 diffs)
-
src/includes/users/signups.php (modified) (9 diffs)
-
src/includes/users/template.php (modified) (43 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bbpress.php
r7340 r7380 2 2 3 3 /** 4 * The bbPress Plugin 4 * The bbPress Plugin. 5 5 * 6 6 * bbPress is forum software with a twist from the creators of WordPress. -
trunk/src/bbpress.php
r7378 r7380 2 2 3 3 /** 4 * The bbPress Plugin 4 * The bbPress Plugin. 5 5 * 6 6 * bbPress is forum software with a twist from the creators of WordPress. … … 33 33 if ( ! class_exists( 'bbPress' ) ) : 34 34 /** 35 * Main bbPress Class 35 * Main bbPress Class. 36 36 * 37 37 * "Word hard. Stay bumble." … … 58 58 59 59 /** 60 * @var mixed False when not logged in; WP_User object when logged in 60 * @var mixed False when not logged in; WP_User object when logged in. 61 61 */ 62 62 public $current_user = false; … … 68 68 69 69 /** 70 * @var array Topic views 70 * @var array Topic views. 71 71 */ 72 72 public $views = array(); 73 73 74 74 /** 75 * @var array Overloads get_option() 75 * @var array Overloads get_option(). 76 76 */ 77 77 public $options = array(); 78 78 79 79 /** 80 * @var array Storage of options not in the database 80 * @var array Storage of options not in the database. 81 81 */ 82 82 public $not_options = array(); 83 83 84 84 /** 85 * @var array Overloads get_user_meta() 85 * @var array Overloads get_user_meta(). 86 86 */ 87 87 public $user_options = array(); 88 88 89 89 /** 90 * @var array Dynamically initialized user roles 90 * @var array Dynamically initialized user roles. 91 91 */ 92 92 public $roles = array(); … … 95 95 96 96 /** 97 * Main bbPress Instance 98 * 99 * bbPress is fun 100 * Please load it only one time 101 * For this, we thank you 97 * Main bbPress Instance. 98 * 99 * bbPress is fun. 100 * Please load it only one time. 101 * For this, we thank you. 102 102 * 103 103 * Insures that only one instance of bbPress exists in memory at any one … … 108 108 * @staticvar object $instance 109 109 * @see bbpress() 110 * @return bbPress The one true bbPress 110 * @return bbPress The one true bbPress. 111 111 */ 112 112 public static function instance() { … … 143 143 144 144 /** 145 * A dummy magic method to prevent bbPress from being cloned 145 * A dummy magic method to prevent bbPress from being cloned. 146 146 * 147 147 * @since 2.0.0 bbPress (r2464) … … 152 152 153 153 /** 154 * A dummy magic method to prevent bbPress from being unserialized 154 * A dummy magic method to prevent bbPress from being unserialized. 155 155 * 156 156 * @since 2.0.0 bbPress (r2464) … … 161 161 162 162 /** 163 * Magic method for checking the existence of a certain custom field 163 * Magic method for checking the existence of a certain custom field. 164 164 * 165 165 * @since 2.1.0 bbPress (r3951) … … 170 170 171 171 /** 172 * Magic method for getting bbPress variables 172 * Magic method for getting bbPress variables. 173 173 * 174 174 * @since 2.1.0 bbPress (r3951) … … 181 181 182 182 /** 183 * Magic method for setting bbPress variables 183 * Magic method for setting bbPress variables. 184 184 * 185 185 * @since 2.1.0 bbPress (r3951) … … 190 190 191 191 /** 192 * Magic method for unsetting bbPress variables 192 * Magic method for unsetting bbPress variables. 193 193 * 194 194 * @since 2.3.0 bbPress (r4628) … … 201 201 202 202 /** 203 * Magic method to prevent notices and errors from invalid method calls 203 * Magic method to prevent notices and errors from invalid method calls. 204 204 * 205 205 * @since 2.2.0 bbPress (r4252) … … 325 325 326 326 /** 327 * Include required files 327 * Include required files. 328 328 * 329 329 * @since 2.0.0 bbPress (r2626) … … 402 402 403 403 /** 404 * Setup the default hooks and actions 404 * Setup the default hooks and actions. 405 405 * 406 406 * @since 2.0.0 bbPress (r2644) … … 450 450 451 451 /** 452 * Register bundled theme packages 452 * Register bundled theme packages. 453 453 * 454 454 * Note that since we currently have complete control over bbp-themes and … … 518 518 519 519 /** 520 * Setup the post types for forums, topics and replies 520 * Setup the post types for forums, topics and replies. 521 521 * 522 522 * @since 2.0.0 bbPress (r2597) … … 613 613 614 614 /** 615 * Register the post statuses used by bbPress 615 * Register the post statuses used by bbPress. 616 616 * 617 617 * We do some manipulation of the 'trash' status so trashed topics and … … 694 694 695 695 /** 696 * Trash fix 696 * Trash fix. 697 697 * 698 698 * We need to remove the internal arg and change that to … … 718 718 719 719 /** 720 * Register the topic tag and forum moderator taxonomies 720 * Register the topic tag and forum moderator taxonomies. 721 721 * 722 722 * @since 2.0.0 bbPress (r2464) Added bbp_get_topic_tag_tax_id() taxonomy … … 748 748 749 749 /** 750 * Register the bbPress views 750 * Register the bbPress views. 751 751 * 752 752 * @since 2.0.0 bbPress (r2789) … … 789 789 790 790 /** 791 * Register the bbPress shortcodes 791 * Register the bbPress shortcodes. 792 792 * 793 793 * @since 2.0.0 bbPress (r3031) … … 798 798 799 799 /** 800 * Register bbPress meta-data 801 * 802 * Counts added in 2.6.0 to avoid negative values 800 * Register bbPress meta-data. 801 * 802 * Counts added in 2.6.0 to avoid negative values. 803 803 * 804 804 * @since 2.6.0 bbPress (r6300) … … 870 870 871 871 /** 872 * Setup the currently logged-in user 872 * Setup the currently logged-in user. 873 873 * 874 874 * @since 2.0.0 bbPress (r2697) … … 879 879 880 880 /** 881 * Setup the user engagements strategy 881 * Setup the user engagements strategy. 882 882 * 883 883 * @since 2.6.0 bbPress (r6875) … … 894 894 895 895 /** 896 * Initialize forum-specific roles 896 * Initialize forum-specific roles. 897 897 * 898 898 * @since 2.6.0 … … 920 920 921 921 /** 922 * Add the bbPress-specific rewrite tags 922 * Add the bbPress-specific rewrite tags. 923 923 * 924 924 * @since 2.0.0 bbPress (r2753) -
trunk/src/includes/admin/actions.php
r7376 r7380 2 2 3 3 /** 4 * bbPress Admin Actions 4 * bbPress Admin Actions. 5 5 * 6 6 * This file contains the actions that are used through-out bbPress Admin. They … … 119 119 120 120 /** 121 * Setup bbPress admin 121 * Setup bbPress admin. 122 122 * 123 123 * @since 2.0.0 bbPress (r1000) … … 130 130 /** 131 131 * When a new site is created in a multisite installation, run the activation 132 * routine on that site 132 * routine on that site. 133 133 * 134 134 * @since 2.0.0 bbPress (r3283) … … 159 159 160 160 /** 161 * Show icons in list-table column headers instead of strings 161 * Show icons in list-table column headers instead of strings. 162 162 * 163 163 * @since 2.6.0 bbPress (r5833) 164 164 * 165 * @param array $columns Column headers fed into list-table objects 166 * 167 * @return array Possibly altered column headers 165 * @param array $columns Column headers fed into list-table objects. 166 * 167 * @return array Possibly altered column headers. 168 168 */ 169 169 function bbp_filter_column_headers( $columns = array() ) { … … 218 218 * @since 2.0.0 bbPress (r3336) 219 219 * 220 * @param string $post_link Custom post type permalink 221 * @param object $_post Post data object 220 * @param string $post_link Custom post type permalink. 221 * @param object $_post Post data object. 222 222 * @param bool $leavename Optional, defaults to false. Whether to keep post name or page name. 223 223 * @param bool $sample Optional, defaults to false. Is it a sample permalink. 224 224 * 225 * @return string The custom post type permalink 225 * @return string The custom post type permalink. 226 226 */ 227 227 function bbp_filter_sample_permalink( $post_link, $_post, $leavename = false, $sample = false ) { … … 239 239 240 240 /** 241 * Piggy back admin_init action 241 * Piggy back admin_init action. 242 242 * 243 243 * @since 2.1.0 bbPress (r3766) … … 248 248 249 249 /** 250 * Piggy back admin_menu action 250 * Piggy back admin_menu action. 251 251 * 252 252 * @since 2.1.0 bbPress (r3766) … … 257 257 258 258 /** 259 * Piggy back admin_head action 259 * Piggy back admin_head action. 260 260 * 261 261 * @since 2.1.0 bbPress (r3766) … … 266 266 267 267 /** 268 * Piggy back admin_notices action 268 * Piggy back admin_notices action. 269 269 * 270 270 * @since 2.1.0 bbPress (r3766) … … 275 275 276 276 /** 277 * Dedicated action to register bbPress importers 277 * Dedicated action to register bbPress importers. 278 278 * 279 279 * @since 2.1.0 bbPress (r3766) … … 284 284 285 285 /** 286 * Dedicated action to register admin styles 286 * Dedicated action to register admin styles. 287 287 * 288 288 * @since 2.6.0 bbPress (r6912) … … 291 291 292 292 /** 293 * Action used to register the admin styling 293 * Action used to register the admin styling. 294 294 * 295 295 * @since 2.1.0 … … 299 299 300 300 /** 301 * Action used to register all admin styling 301 * Action used to register all admin styling. 302 302 * 303 303 * @since 2.6.0 … … 307 307 308 308 /** 309 * Dedicated action to register admin scripts 309 * Dedicated action to register admin scripts. 310 310 * 311 311 * @since 2.6.0 bbPress (r6912) … … 316 316 317 317 /** 318 * Dedicated action to register admin settings 318 * Dedicated action to register admin settings. 319 319 * 320 320 * @since 2.1.0 bbPress (r3766) … … 325 325 326 326 /** 327 * Dedicated action to output admin tools.php sections 327 * Dedicated action to output admin tools.php sections. 328 328 * 329 329 * @since 2.6.0 bbPress (r6273) … … 334 334 335 335 /** 336 * Dedicated action to hook into the current screen 336 * Dedicated action to hook into the current screen. 337 337 * 338 338 * @since 2.6.0 bbPress (r6185) -
trunk/src/includes/admin/classes/class-bbp-admin.php
r7379 r7380 24 24 25 25 /** 26 * @var string Path to the bbPress admin directory 26 * Path to the bbPress admin directory. 27 * 28 * @var string 27 29 */ 28 30 public $admin_dir = ''; … … 31 33 32 34 /** 33 * @var string URL to the bbPress admin directory 35 * URL to the bbPress admin directory. 36 * 37 * @var string 34 38 */ 35 39 public $admin_url = ''; 36 40 37 41 /** 38 * @var string URL to the bbPress images directory 42 * URL to the bbPress images directory. 43 * 44 * @var string 39 45 */ 40 46 public $images_url = ''; 41 47 42 48 /** 43 * @var string URL to the bbPress admin styles directory 49 * URL to the bbPress admin styles directory. 50 * 51 * @var string 44 52 */ 45 53 public $styles_url = ''; 46 54 47 55 /** 48 * @var string URL to the bbPress admin css directory 56 * URL to the bbPress admin css directory. 57 * 58 * @var string 49 59 */ 50 60 public $css_url = ''; 51 61 52 62 /** 53 * @var string URL to the bbPress admin js directory 63 * URL to the bbPress admin js directory. 64 * 65 * @var string 54 66 */ 55 67 public $js_url = ''; … … 58 70 59 71 /** 60 * @var bool Minimum capability to access Tools and Settings 72 * Minimum capability to access Tools and Settings. 73 * 74 * @var bool 61 75 */ 62 76 public $minimum_capability = 'keep_gate'; … … 65 79 66 80 /** 67 * @var bool Whether or not to add an extra top level menu separator 81 * Whether or not to add an extra top level menu separator. 82 * 83 * @var bool 68 84 */ 69 85 public $show_separator = false; … … 72 88 73 89 /** 74 * @var array Array of available repair tools 90 * Array of available repair tools. 91 * 92 * @var array 75 93 */ 76 94 public $tools = array(); … … 79 97 80 98 /** 81 * @var array Array of notices to output to the current user 99 * Array of notices to output to the current user. 100 * 101 * @var array 82 102 */ 83 103 public $notices = array(); … … 86 106 87 107 /** 88 * @var BBP_Forums_Admin Forums admin 108 * Forums admin. 109 * 110 * @var BBP_Forums_Admin 89 111 */ 90 112 public $forums = null; 91 113 92 114 /** 93 * @var BBP_Topics_Admin Topics admin 115 * Topics admin. 116 * 117 * @var BBP_Topics_Admin 94 118 */ 95 119 public $topics = null; 96 120 97 121 /** 98 * @var BBP_Replies_Admin Replies admin 122 * Replies admin. 123 * 124 * @var BBP_Replies_Admin 99 125 */ 100 126 public $replies = null; 101 127 102 128 /** 103 * @var BBP_Converter Converter admin 129 * Converter admin. 130 * 131 * @var BBP_Converter 104 132 */ 105 133 public $converter = null; … … 108 136 109 137 /** 110 * The main bbPress admin loader 138 * The main bbPress admin loader. 111 139 * 112 140 * @since 2.0.0 bbPress (r2515) … … 119 147 120 148 /** 121 * Admin globals 149 * Admin globals. 122 150 * 123 151 * @since 2.0.0 bbPress (r2646) … … 140 168 141 169 /** 142 * Include required files 170 * Include required files. 143 171 * 144 172 * @since 2.0.0 bbPress (r2646) … … 168 196 169 197 /** 170 * Setup the admin hooks, actions and filters 198 * Setup the admin hooks, actions and filters. 171 199 * 172 200 * @since 2.0.0 bbPress (r2646) … … 312 340 313 341 /** 314 * Output all admin area notices 342 * Output all admin area notices. 315 343 * 316 344 * @since 2.6.0 bbPress (r6771) … … 336 364 337 365 /** 338 * Add a notice to the notices array 366 * Add a notice to the notices array. 339 367 * 340 368 * @since 2.6.0 bbPress (r6771) 341 369 * 342 * @param string|WP_Error $message A message to be displayed or {@link WP_Error} 343 * @param string $class Optional. A class to be added to the message div 344 * @param bool $is_dismissible Optional. True to dismiss, false to persist 345 * 346 * @return void370 * @param string|WP_Error $message A message to be displayed or {@link WP_Error}. 371 * @param string $class Optional. A class to be added to the message div. 372 * @param bool $is_dismissible Optional. True to dismiss, false to persist. 373 * 374 * @return bool|void False on failure, void otherwise. 347 375 */ 348 376 public function add_notice( $message, $class = false, $is_dismissible = true ) { … … 402 430 403 431 /** 404 * Escape message string output 432 * Escape message string output. 405 433 * 406 434 * @since 2.6.0 bbPress (r6775) 407 435 * 408 * @param string $message 436 * @param string $message The message. 409 437 * 410 438 * @return string … … 456 484 457 485 /** 458 * Add the admin menus 486 * Add the admin menus. 459 487 * 460 488 * @since 2.0.0 bbPress (r2646) … … 553 581 554 582 /** 555 * Add the network admin menus 583 * Add the network admin menus. 556 584 * 557 585 * @since 2.1.0 bbPress (r3689) … … 575 603 576 604 /** 577 * Register the settings 605 * Register the settings. 578 606 * 579 607 * @since 2.0.0 bbPress (r2737) 580 608 * 581 * @todo Put fields into multidimensional array 609 * @todo Put fields into multidimensional array. 582 610 */ 583 611 public static function register_admin_settings() { … … 636 664 637 665 /** 638 * Maps settings capabilities 666 * Maps settings capabilities. 639 667 * 640 668 * @since 2.2.0 bbPress (r4242) 641 669 * 642 * @param array $caps Capabilities for meta capability 643 * @param string $cap Capability name 644 * @param int $user_id User id 645 * @param array $args Arguments 646 * 647 * @return array Actual capabilities for meta capability 670 * @param array $caps Capabilities for meta capability. 671 * @param string $cap Capability name. 672 * @param int $user_id User id. 673 * @param array $args Arguments. 674 * 675 * @return array Actual capabilities for meta capability. 648 676 */ 649 677 public static function map_settings_meta_caps( $caps = array(), $cap = '', $user_id = 0, $args = array() ) { … … 712 740 713 741 /** 714 * Register the importers 742 * Register the importers. 715 743 * 716 744 * @since 2.0.0 bbPress (r2737) … … 746 774 747 775 /** 748 * Add Settings link to plugins area 776 * Add Settings link to plugins area. 749 777 * 750 778 * @since 2.0.0 bbPress (r2737) 751 779 * 752 * @param array $links Links array in which we would prepend our link 753 * @param string $file Current plugin basename 754 * @return array Processed links 780 * @param array $links Links array in which we would prepend our link. 781 * @param string $file Current plugin basename. 782 * @return array Processed links. 755 783 */ 756 784 public static function modify_plugin_action_links( $links, $file ) { … … 779 807 780 808 /** 781 * Enqueue any admin scripts we might need 809 * Enqueue any admin scripts we might need. 782 810 * 783 811 * @since 2.2.0 bbPress (r4260) … … 819 847 820 848 /** 821 * Enqueue any admin scripts we might need 849 * Enqueue any admin scripts we might need. 822 850 * 823 851 * @since 2.6.0 bbPress (r5224) … … 829 857 /** 830 858 * Remove the individual recount and converter menus. 831 * They are grouped together by h2 tabs 859 * They are grouped together by h2 tabs. 832 860 * 833 861 * @since 2.0.0 bbPress (r2464) … … 846 874 847 875 /** 848 * Registers the bbPress admin styling and color schemes 876 * Registers the bbPress admin styling and color schemes. 849 877 * 850 878 * Because wp-content can exist outside of the WordPress root, there is no … … 898 926 899 927 /** 900 * Registers the bbPress admin color schemes 928 * Registers the bbPress admin color schemes. 901 929 * 902 930 * Because wp-content can exist outside of the WordPress root there is no … … 927 955 928 956 /** 929 * Allow keymaster role to save Forums settings 957 * Allow keymaster role to save Forums settings. 930 958 * 931 959 * @since 2.3.0 bbPress (r4678) 932 960 * 933 * @param string $capability 934 * @return string Return minimum capability 961 * @param string $capability Optional. Default 'manage_options'. 962 * @return string Return minimum capability. 935 963 */ 936 964 public function option_page_capability_bbpress( $capability = 'manage_options' ) { … … 1014 1042 1015 1043 /** 1016 * Ajax action for facilitating the forum auto-suggest 1044 * Ajax action for facilitating the forum auto-suggest. 1017 1045 * 1018 1046 * @since 2.2.0 bbPress (r4261) … … 1069 1097 1070 1098 /** 1071 * Ajax action for facilitating the topic and reply author auto-suggest 1099 * Ajax action for facilitating the topic and reply author auto-suggest. 1072 1100 * 1073 1101 * @since 2.4.0 bbPress (r5014) … … 1158 1186 1159 1187 /** 1160 * Output the shared screen header for about_screen() & credits_screen() 1161 * 1162 * Contains title, subtitle, and badge area 1188 * Output the shared screen header for about_screen() & credits_screen(). 1189 * 1190 * Contains title, subtitle, and badge area. 1163 1191 * 1164 1192 * @since 2.6.0 bbPress (r6604) … … 1188 1216 1189 1217 /** 1190 * Output the about screen 1218 * Output the about screen. 1191 1219 * 1192 1220 * @since 2.2.0 bbPress (r4159) … … 1262 1290 1263 1291 /** 1264 * Output the credits screen 1292 * Output the credits screen. 1265 1293 * 1266 1294 * @since 2.2.0 bbPress (r4159) … … 1404 1432 1405 1433 /** 1406 * Update all bbPress forums across all sites 1434 * Update all bbPress forums across all sites. 1407 1435 * 1408 1436 * @since 2.1.0 bbPress (r3689) … … 1448 1476 1449 1477 /** 1450 * Update all bbPress forums across all sites 1478 * Update all bbPress forums across all sites. 1451 1479 * 1452 1480 * @since 2.1.0 bbPress (r3689) -
trunk/src/includes/admin/classes/class-bbp-converter-base.php
r7378 r7380 2 2 3 3 /** 4 * bbPress Converter Base Class 4 * bbPress Converter Base Class. 5 5 * 6 * Based on the hard work of Adam Ellis 6 * Based on the hard work of Adam Ellis. 7 7 * 8 8 * @package bbPress … … 15 15 if ( ! class_exists( 'BBP_Converter_Base' ) ) : 16 16 /** 17 * Base class to be extended by specific individual importers 17 * Base class to be extended by specific individual importers. 18 18 * 19 19 * phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared … … 265 265 266 266 /** 267 * Setup global values 267 * Setup global values. 268 268 */ 269 269 public function setup_globals() {} 270 270 271 271 /** 272 * Convert Forums 272 * Convert Forums. 273 273 */ 274 274 public function convert_forums( $start = 1 ) { … … 277 277 278 278 /** 279 * Convert Topics / Threads 279 * Convert Topics / Threads. 280 280 */ 281 281 public function convert_topics( $start = 1 ) { … … 284 284 285 285 /** 286 * Convert Posts 286 * Convert Posts. 287 287 */ 288 288 public function convert_replies( $start = 1 ) { … … 291 291 292 292 /** 293 * Convert Users 293 * Convert Users. 294 294 */ 295 295 public function convert_users( $start = 1 ) { … … 298 298 299 299 /** 300 * Convert Topic Tags 300 * Convert Topic Tags. 301 301 */ 302 302 public function convert_tags( $start = 1 ) { … … 305 305 306 306 /** 307 * Convert Forum Subscriptions 307 * Convert Forum Subscriptions. 308 308 */ 309 309 public function convert_forum_subscriptions( $start = 1 ) { … … 312 312 313 313 /** 314 * Convert Topic Subscriptions 314 * Convert Topic Subscriptions. 315 315 */ 316 316 public function convert_topic_subscriptions( $start = 1 ) { … … 319 319 320 320 /** 321 * Convert Favorites 321 * Convert Favorites. 322 322 */ 323 323 public function convert_favorites( $start = 1 ) { … … 326 326 327 327 /** 328 * Convert Table 328 * Convert Table. 329 329 * 330 330 * @param string to type … … 953 953 954 954 /** 955 * This method grabs appropriate fields from the table specified 956 * 957 * @param string The table name to grab fields from 955 * This method grabs appropriate fields from the table specified. 956 * 957 * @param string The table name to grab fields from. 958 958 */ 959 959 private function get_fields( $tablename = '' ) { … … 987 987 988 988 /** 989 * Update the last query option and return results 989 * Update the last query option and return results. 990 990 * 991 991 * @param string $query … … 999 999 1000 1000 /** 1001 * Update the last query option and return results 1001 * Update the last query option and return results. 1002 1002 * 1003 1003 * @param string $query … … 1011 1011 1012 1012 /** 1013 * Update the last query option and do a general query 1013 * Update the last query option and do a general query. 1014 1014 * 1015 1015 * @param string $query … … 1022 1022 1023 1023 /** 1024 * Update the last query ran 1024 * Update the last query ran. 1025 1025 * 1026 1026 * @since 2.6.0 bbPress (r6637) 1027 1027 * 1028 * @param string $query The literal MySQL query 1028 * @param string $query The literal MySQL query. 1029 1029 * @return bool 1030 1030 */ … … 1034 1034 1035 1035 /** 1036 * Update the number of rows in the current step 1036 * Update the number of rows in the current step. 1037 1037 * 1038 1038 * @since 2.6.0 bbPress (r6637) 1039 1039 * 1040 * @param string $query The literal MySQL query 1040 * @param string $query The literal MySQL query. 1041 1041 * @return bool 1042 1042 */ … … 1050 1050 1051 1051 /** 1052 * Update the number of rows in the current step 1052 * Update the number of rows in the current step. 1053 1053 * 1054 1054 * @since 2.6.0 bbPress (r6637) 1055 1055 * 1056 * @param string $table_name The literal MySQL query 1056 * @param string $table_name The literal MySQL query. 1057 1057 * @return bool 1058 1058 */ … … 1066 1066 1067 1067 /** 1068 * Run password through wp_hash_password() 1068 * Run password through wp_hash_password(). 1069 1069 * 1070 1070 * @param string $username … … 1107 1107 1108 1108 /** 1109 * A mini cache system to reduce database calls to forum ID's 1109 * A mini cache system to reduce database calls to forum ID's. 1110 1110 * 1111 1111 * @param string $field … … 1127 1127 1128 1128 /** 1129 * A mini cache system to reduce database calls to topic ID's 1129 * A mini cache system to reduce database calls to topic ID's. 1130 1130 * 1131 1131 * @param string $field … … 1169 1169 1170 1170 /** 1171 * A mini cache system to reduce database calls to user ID's 1171 * A mini cache system to reduce database calls to user ID's. 1172 1172 * 1173 1173 * @param string $field … … 1193 1193 1194 1194 /** 1195 * Check if the topic or reply author is anonymous 1195 * Check if the topic or reply author is anonymous. 1196 1196 * 1197 1197 * @since 2.6.0 bbPress (r5544) … … 1209 1209 1210 1210 /** 1211 * A mini cache system to reduce database calls map topics ID's to forum ID's 1211 * A mini cache system to reduce database calls map topics ID's to forum ID's. 1212 1212 * 1213 1213 * @param string $field -
trunk/src/includes/admin/classes/class-bbp-converter-db.php
r7268 r7380 2 2 3 3 /** 4 * bbPress Converter Database 4 * bbPress Converter Database. 5 5 * 6 6 * @package bbPress … … 13 13 if ( ! class_exists( 'BBP_Converter_DB' ) && class_exists( 'wpdb' ) ) : 14 14 /** 15 * bbPress Converter Database Access Abstraction Object 15 * bbPress Converter Database Access Abstraction Object. 16 16 * 17 17 * @since 2.6.0 bbPress (r6784) -
trunk/src/includes/admin/classes/class-bbp-converter.php
r7379 r7380 20 20 21 21 /** 22 * @var int Number of rows 22 * Number of rows. 23 * 24 * @var int 23 25 */ 24 26 public $max = 0; 25 27 26 28 /** 27 * @var int Start 29 * Start. 30 * 31 * @var int 28 32 */ 29 33 public $start = 0; 30 34 31 35 /** 32 * @var int Step in converter process 36 * Step in converter process. 37 * 38 * @var int 33 39 */ 34 40 public $step = 0; 35 41 36 42 /** 37 * @var int Number of rows 43 * Number of rows. 44 * 45 * @var int 38 46 */ 39 47 public $rows = 0; 40 48 41 49 /** 42 * @var int Maximum number of converter steps 50 * Maximum number of converter steps. 51 * 52 * @var int 43 53 */ 44 54 public $max_steps = 17; 45 55 46 56 /** 47 * @var int Number of rows in the current step 57 * Number of rows in the current step. 58 * 59 * @var int 48 60 */ 49 61 public $rows_in_step = 0; 50 62 51 63 /** 52 * @var int Percent complete of current step 64 * Percent complete of current step. 65 * 66 * @var int 53 67 */ 54 68 public $step_percentage = 0; 55 69 56 70 /** 57 * @var int Percent complete of all step 71 * Percent complete of all step. 72 * 73 * @var int 58 74 */ 59 75 public $total_percentage = 0; 60 76 61 77 /** 62 * @var int Name of source forum platform 78 * Name of source forum platform. 79 * 80 * @var int 63 81 */ 64 82 public $platform = ''; 65 83 66 84 /** 67 * @var BBP_Converter_Base Type of converter to use 85 * Type of converter to use. 86 * 87 * @var BBP_Converter_Base 68 88 */ 69 89 public $converter = null; 70 90 71 91 /** 72 * @var string Path to included platforms 92 * Path to included platforms. 93 * 94 * @var string 73 95 */ 74 96 public $converters_dir = ''; 75 97 76 98 /** 77 * @var array Map of steps to methods 99 * Map of steps to methods. 100 * 101 * @var array 78 102 */ 79 103 private $steps = array( -
trunk/src/includes/admin/classes/class-bbp-topic-replies-list-table.php
r7379 r7380 19 19 if ( class_exists( 'WP_List_Table' ) ) : 20 20 /** 21 * Topic replies list table 21 * Topic replies list table. 22 22 * 23 23 * This list table is responsible for showing the replies to a topic in a … … 29 29 30 30 /** 31 * The main constructor method 31 * The main constructor method. 32 32 * 33 33 * @since 2.6.0 bbPress (r5886) … … 51 51 52 52 /** 53 * Setup the list-table columns 53 * Setup the list-table columns. 54 54 * 55 55 * @since 2.6.0 bbPress (r5886) … … 69 69 70 70 /** 71 * Allow `bbp_reply_created` to be sortable 72 * 73 * @since 2.6.0 bbPress (r5886) 74 * 75 * @return array An associative array containing the `bbp_reply_created` column 71 * Allow `bbp_reply_created` to be sortable. 72 * 73 * @since 2.6.0 bbPress (r5886) 74 * 75 * @return array An associative array containing the `bbp_reply_created` column. 76 76 */ 77 77 public function get_sortable_columns() { … … 82 82 83 83 /** 84 * Setup the bulk actions 85 * 86 * @since 2.6.0 bbPress (r5886) 87 * 88 * @return array An associative array containing all the bulk actions 84 * Setup the bulk actions. 85 * 86 * @since 2.6.0 bbPress (r5886) 87 * 88 * @return array An associative array containing all the bulk actions. 89 89 */ 90 90 public function get_bulk_actions() { … … 105 105 106 106 /** 107 * Output the check-box column for bulk actions (if we implement them) 107 * Output the check-box column for bulk actions (if we implement them). 108 108 * 109 109 * @since 2.6.0 bbPress (r5886) … … 118 118 119 119 /** 120 * Output the contents of the `bbp_topic_reply_author` column 120 * Output the contents of the `bbp_topic_reply_author` column. 121 121 * 122 122 * @since 2.6.0 bbPress (r5886) … … 132 132 133 133 /** 134 * Output the contents of the `bbp_reply_created` column 134 * Output the contents of the `bbp_reply_created` column. 135 135 * 136 136 * @since 2.6.0 bbPress (r5886) … … 144 144 145 145 /** 146 * Output the contents of the `bbp_reply_content` column 146 * Output the contents of the `bbp_reply_content` column. 147 147 * 148 148 * @since 2.6.0 bbPress (r5886) … … 170 170 171 171 /** 172 * Handle bulk action requests 172 * Handle bulk action requests. 173 173 * 174 174 * @since 2.6.0 bbPress (r5886) … … 186 186 187 187 /** 188 * Prepare the list-table items for display 188 * Prepare the list-table items for display. 189 189 * 190 190 * @since 2.6.0 bbPress (r5886) … … 256 256 257 257 /** 258 * Message to be displayed when there are no items 258 * Message to be displayed when there are no items. 259 259 * 260 260 * @since 2.6.0 bbPress (r5930) … … 265 265 266 266 /** 267 * Display the list table 267 * Display the list table. 268 268 * 269 269 * This custom method is necessary because the one in `WP_List_Table` comes … … 302 302 303 303 /** 304 * Generate the table navigation above or below the table 304 * Generate the table navigation above or below the table. 305 305 * 306 306 * This custom method is necessary because the one in `WP_List_Table` comes … … 326 326 327 327 /** 328 * Generates content for a single row of the table 328 * Generates content for a single row of the table. 329 329 * 330 330 * @since 2.6.0 331 331 * @access public 332 332 * 333 * @param object $item The current item 333 * @param object $item The current item. 334 334 */ 335 335 public function single_row( $item ) { -
trunk/src/includes/admin/common.php
r7378 r7380 2 2 3 3 /** 4 * bbPress Admin Functions 4 * bbPress Admin Functions. 5 5 * 6 6 * @package bbPress … … 14 14 15 15 /** 16 * Add a separator to the WordPress admin menus 16 * Add a separator to the WordPress admin menus. 17 17 * 18 18 * @since 2.0.0 bbPress (r2957) … … 47 47 48 48 /** 49 * Tell WordPress we have a custom menu order 49 * Tell WordPress we have a custom menu order. 50 50 * 51 51 * @since 2.0.0 bbPress (r2957) 52 52 * 53 * @param bool $menu_order Menu order 54 * @return mixed True if separator, false if not 53 * @param bool $menu_order Menu order. 54 * @return mixed True if separator, false if not. 55 55 */ 56 56 function bbp_admin_custom_menu_order( $menu_order = false ) { … … 63 63 64 64 /** 65 * Move our custom separator above our custom post types 65 * Move our custom separator above our custom post types. 66 66 * 67 67 * @since 2.0.0 bbPress (r2957) 68 68 * 69 * @param array $menu_order Menu Order 70 * @return array Modified menu order 69 * @param array $menu_order Menu Order. 70 * @return array Modified menu order. 71 71 */ 72 72 function bbp_admin_menu_order( $menu_order ) { … … 157 157 * @since 2.1.0 bbPress (r3765) 158 158 * 159 * @param int $site_id 159 * @param int $site_id Site id. 160 160 */ 161 161 function bbp_do_uninstall( $site_id = 0 ) { -
trunk/src/includes/admin/forums.php
r7378 r7380 2 2 3 3 /** 4 * bbPress Forum Admin Class 4 * bbPress Forum Admin Class. 5 5 * 6 6 * @package bbPress … … 13 13 if ( ! class_exists( 'BBP_Forums_Admin' ) ) : 14 14 /** 15 * Loads bbPress forums admin area 15 * Loads bbPress forums admin area. 16 16 * 17 17 * @package bbPress … … 24 24 25 25 /** 26 * @var string The post type of this admin component 26 * @var string The post type of this admin component. 27 27 */ 28 28 private $post_type = ''; … … 31 31 32 32 /** 33 * The main bbPress forums admin loader 33 * The main bbPress forums admin loader. 34 34 * 35 35 * @since 2.0.0 bbPress (r2515) … … 41 41 42 42 /** 43 * Setup the admin hooks, actions and filters 43 * Setup the admin hooks, actions and filters. 44 44 * 45 45 * @since 2.0.0 bbPress (r2646) … … 77 77 78 78 /** 79 * Admin globals 79 * Admin globals. 80 80 * 81 81 * @since 2.0.0 bbPress (r2646) … … 90 90 91 91 /** 92 * Contextual help for bbPress forum edit page 92 * Contextual help for bbPress forum edit page. 93 93 * 94 94 * @since 2.0.0 bbPress (r3119) … … 157 157 158 158 /** 159 * Contextual help for bbPress forum edit page 159 * Contextual help for bbPress forum edit page. 160 160 * 161 161 * @since 2.0.0 bbPress (r3119) … … 221 221 222 222 /** 223 * Add the forum attributes meta-box 223 * Add the forum attributes meta-box. 224 224 * 225 225 * @since 2.0.0 bbPress (r2746) … … 237 237 238 238 /** 239 * Add the forum moderators meta-box 239 * Add the forum moderators meta-box. 240 240 * 241 241 * @since 2.6.0 bbPress … … 260 260 261 261 /** 262 * Add the subscriptions meta-box 262 * Add the subscriptions meta-box. 263 263 * 264 264 * Allows viewing of users who have subscribed to a forum. … … 290 290 291 291 /** 292 * Remove comments & discussion meta-boxes if comments are not supported 292 * Remove comments & discussion meta-boxes if comments are not supported. 293 293 * 294 294 * @since 2.6.0 bbPress (r6186) … … 302 302 303 303 /** 304 * Pass the forum attributes for processing 304 * Pass the forum attributes for processing. 305 305 * 306 306 * @since 2.0.0 bbPress (r2746) 307 307 * 308 * @param int $forum_id Forum id 309 * @return int Forum id 308 * @param int $forum_id Forum id. 309 * @return int Forum id. 310 310 */ 311 311 public function save_meta_boxes( $forum_id ) { … … 355 355 356 356 /** 357 * Toggle forum 358 * 359 * Handles the admin-side opening/closing of forums 357 * Toggle forum. 358 * 359 * Handles the admin-side opening/closing of forums. 360 360 * 361 361 * @since 2.6.0 bbPress (r5254) … … 428 428 429 429 /** 430 * Toggle forum notices 430 * Toggle forum notices. 431 431 * 432 432 * Display the success/error notices from … … 493 493 494 494 /** 495 * Returns an array of keys used to sort row actions 495 * Returns an array of keys used to sort row actions. 496 496 * 497 497 * @since 2.6.0 bbPress (r6771) … … 522 522 523 523 /** 524 * Returns an array of notice toggles 524 * Returns an array of notice toggles. 525 525 * 526 526 * @since 2.6.0 bbPress (r6396) … … 547 547 548 548 /** 549 * Returns an array of notice toggles 549 * Returns an array of notice toggles. 550 550 * 551 551 * @since 2.6.0 bbPress (r6396) … … 571 571 572 572 /** 573 * Manage the column headers for the forums page 573 * Manage the column headers for the forums page. 574 574 * 575 575 * @since 2.0.0 bbPress (r2485) 576 576 * 577 * @param array $columns The columns 578 * 579 * @return array $columns bbPress forum columns 577 * @param array $columns The columns. 578 * 579 * @return array $columns bbPress forum columns. 580 580 */ 581 581 public function column_headers( $columns ) { … … 609 609 610 610 /** 611 * Print extra columns for the forums page 611 * Print extra columns for the forums page. 612 612 * 613 613 * @since 2.0.0 bbPress (r2485) 614 614 * 615 * @param string $column Column 616 * @param int $forum_id Forum id 615 * @param string $column Column. 616 * @param int $forum_id Forum id. 617 617 */ 618 618 public function column_data( $column, $forum_id ) { … … 664 664 665 665 /** 666 * Forum Row actions 666 * Forum Row actions. 667 667 * 668 668 * Remove the quick-edit action link and display the description under 669 * the forum title and add the open/close links 669 * the forum title and add the open/close links. 670 670 * 671 671 * @since 2.0.0 bbPress (r2577) 672 672 * 673 * @param array $actions Actions 674 * @param object $forum Forum object 675 * 676 * @return array $actions Actions 673 * @param array $actions Actions. 674 * @param object $forum Forum object. 675 * 676 * @return array $actions Actions. 677 677 */ 678 678 public function row_actions( $actions = array(), $forum = false ) { … … 716 716 717 717 /** 718 * Sort row actions by key 718 * Sort row actions by key. 719 719 * 720 720 * @since 2.6.0 721 721 * 722 * @param array $actions 722 * @param array $actions. 723 723 * 724 724 * @return array … … 745 745 746 746 /** 747 * Custom user feedback messages for forum post type 747 * Custom user feedback messages for forum post type. 748 748 * 749 749 * @since 2.0.0 bbPress (r3080) … … 838 838 839 839 /** 840 * Setup bbPress Forums Admin 840 * Setup bbPress Forums Admin. 841 841 * 842 842 * This is currently here to make hooking and unhooking of the admin UI easy. … … 845 845 * @since 2.0.0 bbPress (r2596) 846 846 * 847 * @param WP_Screen $current_screen Current screen object 847 * @param WP_Screen $current_screen Current screen object. 848 848 */ 849 849 function bbp_admin_forums( $current_screen ) { -
trunk/src/includes/admin/metaboxes.php
r7378 r7380 2 2 3 3 /** 4 * bbPress Admin Metaboxes 4 * bbPress Admin Metaboxes. 5 5 * 6 6 * @package bbPress … … 107 107 108 108 /** 109 * bbPress Dashboard Right Now Widget 110 * 111 * Adds a dashboard widget with forum statistics 109 * bbPress Dashboard Right Now Widget. 110 * 111 * Adds a dashboard widget with forum statistics. 112 112 * 113 113 * @since 2.0.0 bbPress (r2770) … … 331 331 332 332 /** 333 * Forum meta-box 334 * 335 * The meta-box that holds all of the additional forum information 333 * Forum meta-box. 334 * 335 * The meta-box that holds all of the additional forum information. 336 336 * 337 337 * @since 2.0.0 bbPress (r2744) … … 426 426 427 427 /** 428 * Topic meta-box 429 * 430 * The meta-box that holds all of the additional topic information 428 * Topic meta-box. 429 * 430 * The meta-box that holds all of the additional topic information. 431 431 * 432 432 * @since 2.0.0 bbPress (r2464) … … 505 505 506 506 /** 507 * Reply meta-box 508 * 509 * The meta-box that holds all of the additional reply information 507 * Reply meta-box. 508 * 509 * The meta-box that holds all of the additional reply information. 510 510 * 511 511 * @since 2.0.0 bbPress (r2464) … … 607 607 608 608 /** 609 * Output the topic replies meta-box 609 * Output the topic replies meta-box. 610 610 * 611 611 * @since 2.6.0 bbPress (r5886) … … 648 648 649 649 /** 650 * Anonymous user information meta-box 650 * Anonymous user information meta-box. 651 651 * 652 652 * @since 2.0.0 bbPress (r2828) 653 653 * 654 * @param WP_Post $post The current post object 654 * @param WP_Post $post The current post object. 655 655 */ 656 656 function bbp_author_metabox( $post ) { … … 699 699 700 700 /** 701 * Moderator assignment meta-box 701 * Moderator assignment meta-box. 702 702 * 703 703 * @since 2.6.0 bbPress (r2828) … … 722 722 723 723 /** 724 * See who engaged with a topic 724 * See who engaged with a topic. 725 725 * 726 726 * @since 2.6.0 bbPress (r6333) … … 754 754 755 755 /** 756 * See who marked a topic as a favorite 756 * See who marked a topic as a favorite. 757 757 * 758 758 * @since 2.6.0 bbPress (r6197) … … 787 787 788 788 /** 789 * See who is subscribed to a topic 789 * See who is subscribed to a topic. 790 790 * 791 791 * @since 2.6.0 bbPress (r6197) … … 827 827 828 828 /** 829 * See who is subscribed to a forum 829 * See who is subscribed to a forum. 830 830 * 831 831 * @since 2.6.0 bbPress (r6197) … … 860 860 861 861 /** 862 * Loop through queried metabox users, and output links to their avatars 862 * Loop through queried metabox users, and output links to their avatars. 863 863 * 864 864 * Developers Note: This function may change in a future release to include -
trunk/src/includes/admin/replies.php
r7379 r7380 2 2 3 3 /** 4 * bbPress Replies Admin Class 4 * bbPress Replies Admin Class. 5 5 * 6 6 * @package bbPress … … 13 13 if ( ! class_exists( 'BBP_Replies_Admin' ) ) : 14 14 /** 15 * Loads bbPress replies admin area 15 * Loads bbPress replies admin area. 16 16 * 17 17 * @package bbPress … … 24 24 25 25 /** 26 * @var The post type of this admin component 26 * @var The post type of this admin component. 27 27 */ 28 28 private $post_type = ''; … … 31 31 32 32 /** 33 * The main bbPress admin loader 33 * The main bbPress admin loader. 34 34 * 35 35 * @since 2.0.0 bbPress (r2515) … … 41 41 42 42 /** 43 * Setup the admin hooks, actions and filters 43 * Setup the admin hooks, actions and filters. 44 44 * 45 45 * @since 2.0.0 bbPress (r2646) … … 91 91 92 92 /** 93 * Admin globals 93 * Admin globals. 94 94 * 95 95 * @since 2.0.0 bbPress (r2646) … … 104 104 105 105 /** 106 * Contextual help for bbPress reply edit page 106 * Contextual help for bbPress reply edit page. 107 107 * 108 108 * @since 2.0.0 bbPress (r3119) … … 174 174 175 175 /** 176 * Contextual help for bbPress reply edit page 176 * Contextual help for bbPress reply edit page. 177 177 * 178 178 * @since 2.0.0 bbPress (r3119) … … 351 351 352 352 /** 353 * Add the reply attributes meta-box 353 * Add the reply attributes meta-box. 354 354 * 355 355 * @since 2.0.0 bbPress (r2746) … … 367 367 368 368 /** 369 * Add the author info meta-box 370 * 371 * Allows editing of information about an author 369 * Add the author info meta-box. 370 * 371 * Allows editing of information about an author. 372 372 * 373 373 * @since 2.0.0 bbPress (r2828) … … 392 392 393 393 /** 394 * Remove comments & discussion meta-boxes if comments are not supported 394 * Remove comments & discussion meta-boxes if comments are not supported. 395 395 * 396 396 * @since 2.6.0 bbPress (r6186) … … 404 404 405 405 /** 406 * Pass the reply attributes for processing 406 * Pass the reply attributes for processing. 407 407 * 408 408 * @since 2.0.0 bbPress (r2746) 409 409 * 410 * @param int $reply_id Reply id 411 * @return int Parent id 410 * @param int $reply_id Reply id. 411 * @return int Parent id. 412 412 */ 413 413 public function save_meta_boxes( $reply_id ) { … … 459 459 460 460 /** 461 * Toggle reply 462 * 463 * Handles the admin-side spamming/unspamming of replies 461 * Toggle reply. 462 * 463 * Handles the admin-side spamming/unspamming of replies. 464 464 * 465 465 * @since 2.0.0 bbPress (r2740) … … 545 545 546 546 /** 547 * Toggle reply notices 547 * Toggle reply notices. 548 548 * 549 549 * Display the success/error notices from … … 626 626 627 627 /** 628 * Returns an array of keys used to sort row actions 628 * Returns an array of keys used to sort row actions. 629 629 * 630 630 * @since 2.6.0 bbPress (r6771) … … 658 658 659 659 /** 660 * Returns an array of notice toggles 660 * Returns an array of notice toggles. 661 661 * 662 662 * @since 2.6.0 bbPress (r6396) … … 685 685 686 686 /** 687 * Returns an array of notice toggles 687 * Returns an array of notice toggles. 688 688 * 689 689 * @since 2.6.0 bbPress (r6396) … … 710 710 711 711 /** 712 * Manage the column headers for the replies page 712 * Manage the column headers for the replies page. 713 713 * 714 714 * @since 2.0.0 bbPress (r2577) 715 715 * 716 * @param array $columns The columns 717 * 718 * @return array $columns bbPress reply columns 716 * @param array $columns The columns. 717 * 718 * @return array $columns bbPress reply columns. 719 719 */ 720 720 public function column_headers( $columns ) { … … 739 739 740 740 /** 741 * Print extra columns for the replies page 741 * Print extra columns for the replies page. 742 742 * 743 743 * @since 2.0.0 bbPress (r2577) 744 744 * 745 * @param string $column Column 746 * @param int $reply_id reply id745 * @param string $column Column. 746 * @param int $reply_id Reply id. 747 747 */ 748 748 public function column_data( $column, $reply_id ) { … … 833 833 834 834 /** 835 * Reply Row actions 835 * Reply Row actions. 836 836 * 837 837 * Remove the quick-edit action link under the reply title and add the 838 * content and spam link 838 * content and spam link. 839 839 * 840 840 * @since 2.0.0 bbPress (r2577) 841 841 * 842 * @param array $actions Actions 843 * @param object $reply Reply object 844 * 845 * @return array $actions Actions 842 * @param array $actions Actions. 843 * @param object $reply Reply object. 844 * 845 * @return array $actions Actions. 846 846 */ 847 847 public function row_actions( $actions = array(), $reply = false ) { … … 928 928 929 929 /** 930 * Sort row actions by key 930 * Sort row actions by key. 931 931 * 932 932 * @since 2.6.0 … … 957 957 958 958 /** 959 * Add forum dropdown to topic and reply list table filters 959 * Add forum dropdown to topic and reply list table filters. 960 960 * 961 961 * @since 2.0.0 bbPress (r2991) 962 962 * 963 * @return bool False. If post type is not topic or reply 963 * @return bool False. If post type is not topic or reply. 964 964 */ 965 965 public function filter_dropdown() { … … 980 980 981 981 /** 982 * Add "Empty Spam" button for moderators 982 * Add "Empty Spam" button for moderators. 983 983 * 984 984 * @since 2.6.0 bbPress (r6791) … … 1016 1016 1017 1017 /** 1018 * Adjust the request query and include the forum id 1018 * Adjust the request query and include the forum id. 1019 1019 * 1020 1020 * @since 2.0.0 bbPress (r2991) 1021 1021 * 1022 * @param array $query_vars Query variables from {@link WP_Query} 1023 * @return array Processed Query Vars 1022 * @param array $query_vars Query variables from {@link WP_Query}. 1023 * @return array Processed Query Vars. 1024 1024 */ 1025 1025 public function filter_post_rows( $query_vars ) { … … 1037 1037 1038 1038 /** 1039 * Custom user feedback messages for reply post type 1039 * Custom user feedback messages for reply post type. 1040 1040 * 1041 1041 * @since 2.0.0 bbPress (r3080) 1042 1042 * 1043 * @global int $post_ID 1043 * @global int $post_ID. 1044 1044 * 1045 1045 * @param array $messages … … 1130 1130 1131 1131 /** 1132 * Setup bbPress Replies Admin 1132 * Setup bbPress Replies Admin. 1133 1133 * 1134 1134 * This is currently here to make hooking and unhooking of the admin UI easy. … … 1137 1137 * @since 2.0.0 bbPress (r2596) 1138 1138 * 1139 * @param WP_Screen $current_screen Current screen object 1139 * @param WP_Screen $current_screen Current screen object. 1140 1140 */ 1141 1141 function bbp_admin_replies( $current_screen ) { -
trunk/src/includes/admin/settings.php
r7379 r7380 2 2 3 3 /** 4 * bbPress Admin Settings 4 * bbPress Admin Settings. 5 5 * 6 6 * @package bbPress … … 619 619 * @since 2.1.0 bbPress (r4001) 620 620 * 621 * @param string $section_id ID of the section to get fields for 622 * @staticvar array $fields All of the available fields 621 * @param string $section_id ID of the section to get fields for. 622 * @staticvar array $fields All of the available fields. 623 623 * @return mixed False if section is invalid, array of fields otherwise. 624 624 */ … … 651 651 652 652 /** 653 * User settings section description for the settings page 653 * User settings section description for the settings page. 654 654 * 655 655 * @since 2.0.0 bbPress (r2786) … … 665 665 666 666 /** 667 * Edit lock setting field 667 * Edit lock setting field. 668 668 * 669 669 * @since 2.0.0 bbPress (r2737) … … 696 696 697 697 /** 698 * Throttle setting field 698 * Throttle setting field. 699 699 * 700 700 * @since 2.0.0 bbPress (r2737) … … 727 727 728 728 /** 729 * Allow anonymous posting setting field 729 * Allow anonymous posting setting field. 730 730 * 731 731 * @since 2.0.0 bbPress (r2737) … … 742 742 743 743 /** 744 * Allow global access setting field 744 * Allow global access setting field. 745 745 * 746 746 * @since 2.0.0 bbPress (r3378) … … 785 785 786 786 /** 787 * Features settings section description for the settings page 787 * Features settings section description for the settings page. 788 788 * 789 789 * @since 2.0.0 bbPress (r2786) … … 798 798 799 799 /** 800 * Allow favorites setting field 800 * Allow favorites setting field. 801 801 * 802 802 * @since 2.0.0 bbPress (r2786) … … 812 812 813 813 /** 814 * Allow subscriptions setting field 814 * Allow subscriptions setting field. 815 815 * 816 816 * @since 2.0.0 bbPress (r2737) … … 826 826 827 827 /** 828 * Allow engagements setting field 828 * Allow engagements setting field. 829 829 * 830 830 * @since 2.0.0 bbPress (r2737) … … 840 840 841 841 /** 842 * Allow topic tags setting field 842 * Allow topic tags setting field. 843 843 * 844 844 * @since 2.4.0 bbPress (r4944) … … 854 854 855 855 /** 856 * Allow forum-mods setting field 856 * Allow forum-mods setting field. 857 857 * 858 858 * @since 2.6.0 bbPress (r5834) … … 869 869 870 870 /** 871 * Allow super-mods setting field 871 * Allow super-mods setting field. 872 872 * 873 873 * @since 2.6.0 bbPress (r6562) … … 884 884 885 885 /** 886 * Allow forum wide search 886 * Allow forum wide search. 887 887 * 888 888 * @since 2.4.0 bbPress (r4970) … … 898 898 899 899 /** 900 * Hierarchical reply maximum depth level setting field 901 * 902 * Replies will be threaded if depth is 2 or greater 900 * Hierarchical reply maximum depth level setting field. 901 * 902 * Replies will be threaded if depth is 2 or greater. 903 903 * 904 904 * @since 2.4.0 bbPress (r4944) … … 945 945 946 946 /** 947 * Allow topic and reply revisions 947 * Allow topic and reply revisions. 948 948 * 949 949 * @since 2.0.0 bbPress (r3412) … … 959 959 960 960 /** 961 * Use the WordPress editor setting field 961 * Use the WordPress editor setting field. 962 962 * 963 963 * @since 2.1.0 bbPress (r3586) … … 973 973 974 974 /** 975 * Main subtheme section 975 * Main subtheme section. 976 976 * 977 977 * @since 2.0.0 bbPress (r2786) … … 986 986 987 987 /** 988 * Use the WordPress editor setting field 988 * Use the WordPress editor setting field. 989 989 * 990 990 * @since 2.1.0 bbPress (r3586) … … 1018 1018 1019 1019 /** 1020 * Allow oEmbed in replies 1020 * Allow oEmbed in replies. 1021 1021 * 1022 1022 * @since 2.1.0 bbPress (r3752) … … 1034 1034 1035 1035 /** 1036 * Per page settings section description for the settings page 1036 * Per page settings section description for the settings page. 1037 1037 * 1038 1038 * @since 2.0.0 bbPress (r2786) … … 1047 1047 1048 1048 /** 1049 * Topics per page setting field 1049 * Topics per page setting field. 1050 1050 * 1051 1051 * @since 2.0.0 bbPress (r2786) … … 1061 1061 1062 1062 /** 1063 * Replies per page setting field 1063 * Replies per page setting field. 1064 1064 * 1065 1065 * @since 2.0.0 bbPress (r2786) … … 1077 1077 1078 1078 /** 1079 * Per page settings section description for the settings page 1079 * Per page settings section description for the settings page. 1080 1080 * 1081 1081 * @since 2.0.0 bbPress (r2786) … … 1090 1090 1091 1091 /** 1092 * Topics per RSS page setting field 1092 * Topics per RSS page setting field. 1093 1093 * 1094 1094 * @since 2.0.0 bbPress (r2786) … … 1104 1104 1105 1105 /** 1106 * Replies per RSS page setting field 1106 * Replies per RSS page setting field. 1107 1107 * 1108 1108 * @since 2.0.0 bbPress (r2786) … … 1120 1120 1121 1121 /** 1122 * Slugs settings section description for the settings page 1122 * Slugs settings section description for the settings page. 1123 1123 * 1124 1124 * @since 2.0.0 bbPress (r2786) … … 1137 1137 1138 1138 /** 1139 * Root slug setting field 1139 * Root slug setting field. 1140 1140 * 1141 1141 * @since 2.0.0 bbPress (r2786) … … 1152 1152 1153 1153 /** 1154 * Include root slug setting field 1154 * Include root slug setting field. 1155 1155 * 1156 1156 * @since 2.0.0 bbPress (r2786) … … 1166 1166 1167 1167 /** 1168 * Include root slug setting field 1168 * Include root slug setting field. 1169 1169 * 1170 1170 * @since 2.0.0 bbPress (r2786) … … 1219 1219 1220 1220 /** 1221 * Slugs settings section description for the settings page 1221 * Slugs settings section description for the settings page. 1222 1222 * 1223 1223 * @since 2.0.0 bbPress (r2786) … … 1232 1232 1233 1233 /** 1234 * User slug setting field 1234 * User slug setting field. 1235 1235 * 1236 1236 * @since 2.0.0 bbPress (r2786) … … 1247 1247 1248 1248 /** 1249 * Topic archive slug setting field 1249 * Topic archive slug setting field. 1250 1250 * 1251 1251 * @since 2.0.0 bbPress (r2786) … … 1262 1262 1263 1263 /** 1264 * Reply archive slug setting field 1264 * Reply archive slug setting field. 1265 1265 * 1266 1266 * @since 2.4.0 bbPress (r4932) … … 1277 1277 1278 1278 /** 1279 * Favorites slug setting field 1279 * Favorites slug setting field. 1280 1280 * 1281 1281 * @since 2.4.0 bbPress (r4932) … … 1292 1292 1293 1293 /** 1294 * Subscriptions slug setting field 1294 * Subscriptions slug setting field. 1295 1295 * 1296 1296 * @since 2.4.0 bbPress (r4932) … … 1307 1307 1308 1308 /** 1309 * Engagements slug setting field 1309 * Engagements slug setting field. 1310 1310 * 1311 1311 * @since 2.6.0 bbPress (r6320) … … 1324 1324 1325 1325 /** 1326 * Slugs settings section description for the settings page 1326 * Slugs settings section description for the settings page. 1327 1327 * 1328 1328 * @since 2.0.0 bbPress (r2786) … … 1337 1337 1338 1338 /** 1339 * Forum slug setting field 1339 * Forum slug setting field. 1340 1340 * 1341 1341 * @since 2.0.0 bbPress (r2786) … … 1352 1352 1353 1353 /** 1354 * Topic slug setting field 1354 * Topic slug setting field. 1355 1355 * 1356 1356 * @since 2.0.0 bbPress (r2786) … … 1367 1367 1368 1368 /** 1369 * Reply slug setting field 1369 * Reply slug setting field. 1370 1370 * 1371 1371 * @since 2.0.0 bbPress (r2786) … … 1382 1382 1383 1383 /** 1384 * Topic tag slug setting field 1384 * Topic tag slug setting field. 1385 1385 * 1386 1386 * @since 2.0.0 bbPress (r2786) … … 1398 1398 1399 1399 /** 1400 * View slug setting field 1400 * View slug setting field. 1401 1401 * 1402 1402 * @since 2.0.0 bbPress (r2789) … … 1413 1413 1414 1414 /** 1415 * Search slug setting field 1415 * Search slug setting field. 1416 1416 * 1417 1417 * @since 2.3.0 bbPress (r4579) … … 1428 1428 1429 1429 /** 1430 * Edit slug setting field 1430 * Edit slug setting field. 1431 1431 * 1432 1432 * @since 2.6.2 bbPress (r6965) … … 1445 1445 1446 1446 /** 1447 * Extension settings section description for the settings page 1447 * Extension settings section description for the settings page. 1448 1448 * 1449 1449 * @since 2.1.0 bbPress (r3575) … … 1458 1458 1459 1459 /** 1460 * Allow BuddyPress group forums setting field 1460 * Allow BuddyPress group forums setting field. 1461 1461 * 1462 1462 * @since 2.1.0 bbPress (r3575) … … 1472 1472 1473 1473 /** 1474 * Replies per page setting field 1474 * Replies per page setting field. 1475 1475 * 1476 1476 * @since 2.1.0 bbPress (r3575) … … 1536 1536 1537 1537 /** 1538 * Extension settings section description for the settings page 1538 * Extension settings section description for the settings page. 1539 1539 * 1540 1540 * @since 2.1.0 bbPress (r3575) … … 1550 1550 1551 1551 /** 1552 * Allow Akismet setting field 1552 * Allow Akismet setting field. 1553 1553 * 1554 1554 * @since 2.1.0 bbPress (r3575) … … 1566 1566 1567 1567 /** 1568 * The main settings page 1568 * The main settings page. 1569 1569 * 1570 1570 * @since 2.0.0 bbPress (r2643) … … 1595 1595 1596 1596 /** 1597 * Main settings section description for the settings page 1597 * Main settings section description for the settings page. 1598 1598 * 1599 1599 * @since 2.1.0 bbPress (r3813) … … 1608 1608 1609 1609 /** 1610 * Edit Platform setting field 1610 * Edit Platform setting field. 1611 1611 * 1612 1612 * @since 2.1.0 bbPress (r3813) … … 1631 1631 1632 1632 /** 1633 * Edit Database Server setting field 1633 * Edit Database Server setting field. 1634 1634 * 1635 1635 * @since 2.1.0 bbPress (r3813) … … 1658 1658 1659 1659 /** 1660 * Edit Database Server Port setting field 1660 * Edit Database Server Port setting field. 1661 1661 * 1662 1662 * @since 2.1.0 bbPress (r3813) … … 1686 1686 1687 1687 /** 1688 * Edit Database User setting field 1688 * Edit Database User setting field. 1689 1689 * 1690 1690 * @since 2.1.0 bbPress (r3813) … … 1700 1700 1701 1701 /** 1702 * Edit Database Pass setting field 1702 * Edit Database Pass setting field. 1703 1703 * 1704 1704 * @since 2.1.0 bbPress (r3813) … … 1720 1720 1721 1721 /** 1722 * Edit Database Name setting field 1722 * Edit Database Name setting field. 1723 1723 * 1724 1724 * @since 2.1.0 bbPress (r3813) … … 1734 1734 1735 1735 /** 1736 * Main settings section description for the settings page 1736 * Main settings section description for the settings page. 1737 1737 * 1738 1738 * @since 2.1.0 bbPress (r3813) … … 1747 1747 1748 1748 /** 1749 * Edit Table Prefix setting field 1749 * Edit Table Prefix setting field. 1750 1750 * 1751 1751 * @since 2.1.0 bbPress (r3813) … … 1768 1768 1769 1769 /** 1770 * Edit Rows Limit setting field 1770 * Edit Rows Limit setting field. 1771 1771 * 1772 1772 * @since 2.1.0 bbPress (r3813) … … 1783 1783 1784 1784 /** 1785 * Edit Delay Time setting field 1785 * Edit Delay Time setting field. 1786 1786 * 1787 1787 * @since 2.1.0 bbPress (r3813) … … 1798 1798 1799 1799 /** 1800 * Edit Halt setting field 1800 * Edit Halt setting field. 1801 1801 * 1802 1802 * @since 2.6.0 bbPress (r6599) … … 1814 1814 1815 1815 /** 1816 * Edit Restart setting field 1816 * Edit Restart setting field. 1817 1817 * 1818 1818 * @since 2.1.0 bbPress (r3813) … … 1829 1829 1830 1830 /** 1831 * Edit Clean setting field 1831 * Edit Clean setting field. 1832 1832 * 1833 1833 * @since 2.1.0 bbPress (r3813) … … 1844 1844 1845 1845 /** 1846 * Edit Convert Users setting field 1846 * Edit Convert Users setting field. 1847 1847 * 1848 1848 * @since 2.1.0 bbPress (r3813) … … 1861 1861 1862 1862 /** 1863 * The main settings page 1863 * The main settings page. 1864 1864 * 1865 1865 * @since 2.1.0 bbPress (r3186) … … 1942 1942 1943 1943 /** 1944 * Contextual help for Forums settings page 1944 * Contextual help for Forums settings page. 1945 1945 * 1946 1946 * @since 2.0.0 bbPress (r3119) … … 2057 2057 2058 2058 /** 2059 * Output settings API option 2059 * Output settings API option. 2060 2060 * 2061 2061 * @since 2.0.0 bbPress (r3203) … … 2070 2070 2071 2071 /** 2072 * Return settings API option 2072 * Return settings API option. 2073 2073 * 2074 2074 * @since 2.0.0 bbPress (r3203) -
trunk/src/includes/admin/tools.php
r7378 r7380 2 2 3 3 /** 4 * bbPress Admin Tools Page 4 * bbPress Admin Tools Page. 5 5 * 6 6 * @package bbPress … … 12 12 13 13 /** 14 * Output a bbPress specific tools box 14 * Output a bbPress specific tools box. 15 15 * 16 16 * @since 2.6.0 bbPress (r6273) … … 54 54 55 55 /** 56 * Register an admin area repair tool 56 * Register an admin area repair tool. 57 57 * 58 58 * @since 2.6.0 bbPress (r5885) … … 107 107 108 108 /** 109 * Register the default repair tools 109 * Register the default repair tools. 110 110 * 111 111 * @since 2.6.0 bbPress (r5885) … … 515 515 516 516 /** 517 * Output the tabs in the admin area 517 * Output the tabs in the admin area. 518 518 * 519 519 * @since 2.1.0 bbPress (r3872) 520 520 * 521 * @param string $active_tab Name of the tab that is active 521 * @param string $active_tab Name of the tab that is active. 522 522 */ 523 523 function bbp_tools_admin_tabs( $active_tab = '' ) { … … 526 526 527 527 /** 528 * Output the tabs in the admin area 528 * Output the tabs in the admin area. 529 529 * 530 530 * @since 2.1.0 bbPress (r3872) 531 531 * 532 * @param string $active_tab Name of the tab that is active 532 * @param string $active_tab Name of the tab that is active. 533 533 */ 534 534 function bbp_get_tools_admin_tabs( $active_tab = '' ) { … … 564 564 565 565 /** 566 * Return possible tools pages 566 * Return possible tools pages. 567 567 * 568 568 * @since 2.6.0 bbPress (r6273) -
trunk/src/includes/admin/tools/common.php
r7378 r7380 2 2 3 3 /** 4 * bbPress Admin Tools Common 4 * bbPress Admin Tools Common. 5 5 * 6 6 * @package bbPress … … 12 12 13 13 /** 14 * Return the current admin repair tool page 14 * Return the current admin repair tool page. 15 15 * 16 16 * @since 2.6.0 bbPress (r6894) … … 23 23 24 24 /** 25 * Return the current admin repair tool page ID 25 * Return the current admin repair tool page ID. 26 26 * 27 27 * @since 2.6.0 bbPress (r6894) … … 45 45 46 46 /** 47 * Return a URL to the repair tool page 47 * Return a URL to the repair tool page. 48 48 * 49 49 * @since 2.6.0 bbPress (r6894) … … 67 67 68 68 /** 69 * Output the URL to run a specific repair tool 69 * Output the URL to run a specific repair tool. 70 70 * 71 71 * @since 2.6.0 bbPress (r5885) … … 78 78 79 79 /** 80 * Return the URL to run a specific repair tool 80 * Return the URL to run a specific repair tool. 81 81 * 82 82 * @since 2.6.0 bbPress (r5885) … … 106 106 107 107 /** 108 * Assemble the admin notices 108 * Assemble the admin notices. 109 109 * 110 110 * @since 2.0.0 bbPress (r2613) … … 121 121 122 122 /** 123 * Handle the processing and feedback of the admin tools page 123 * Handle the processing and feedback of the admin tools page. 124 124 * 125 125 * @since 2.0.0 bbPress (r2613) … … 187 187 188 188 /** 189 * Get the array of available repair tools 189 * Get the array of available repair tools. 190 190 * 191 191 * @since 2.6.0 bbPress (r5885) … … 211 211 212 212 /** 213 * Return array of components from the array of registered tools 213 * Return array of components from the array of registered tools. 214 214 * 215 215 * @since 2.5.0 bbPress (r5885) … … 251 251 252 252 /** 253 * Output the repair list search form 253 * Output the repair list search form. 254 254 * 255 255 * @since 2.6.0 bbPress (r5885) … … 268 268 269 269 /** 270 * Output a select drop-down of components to filter by 270 * Output a select drop-down of components to filter by. 271 271 * 272 272 * @since 2.5.0 bbPress (r5885) … … 303 303 304 304 /** 305 * Return array of versions from the array of registered tools 305 * Return array of versions from the array of registered tools. 306 306 * 307 307 * @since 2.6.0 bbPress (r6894) … … 354 354 355 355 /** 356 * Output a select drop-down of versions to filter by 356 * Output a select drop-down of versions to filter by. 357 357 * 358 358 * @since 2.5.0 bbPress (r6894) … … 391 391 392 392 /** 393 * Maybe translate a repair tool overhead name 393 * Maybe translate a repair tool overhead name. 394 394 * 395 395 * @since 2.6.0 bbPress (r6177) … … 420 420 421 421 /** 422 * Maybe translate a repair tool component name 422 * Maybe translate a repair tool component name. 423 423 * 424 424 * @since 2.6.0 bbPress (r5885) … … 467 467 468 468 /** 469 * Maybe translate a repair tool overhead name 469 * Maybe translate a repair tool overhead name. 470 470 * 471 471 * @since 2.6.0 bbPress (r6894) … … 504 504 * @since 2.0.0 bbPress (r2613) 505 505 * 506 * @return array Repair list of options 506 * @return array Repair list of options. 507 507 */ 508 508 function bbp_admin_repair_list( $type = 'repair' ) { … … 613 613 614 614 /** 615 * Get filter links for components for a specific admin repair tool 615 * Get filter links for components for a specific admin repair tool. 616 616 * 617 617 * @since 2.6.0 bbPress (r5885) … … 650 650 651 651 /** 652 * Get filter links for versions for a specific admin repair tool 652 * Get filter links for versions for a specific admin repair tool. 653 653 * 654 654 * @since 2.6.0 bbPress (r6894) … … 687 687 688 688 /** 689 * Get filter links for overhead for a specific admin repair tool 689 * Get filter links for overhead for a specific admin repair tool. 690 690 * 691 691 * @since 2.6.0 bbPress (r5885) … … 726 726 727 727 /** 728 * Output filter links for overheads for a specific admin repair tool 728 * Output filter links for overheads for a specific admin repair tool. 729 729 * 730 730 * @since 2.6.0 bbPress (r5885) … … 737 737 738 738 /** 739 * Get filter links for overheads for a specific admin repair tool 739 * Get filter links for overheads for a specific admin repair tool. 740 740 * 741 741 * @since 2.6.0 bbPress (r5885) … … 860 860 861 861 /** 862 * Output filter links for statuses 862 * Output filter links for statuses. 863 863 * 864 864 * @since 2.6.0 bbPress (r6925) … … 871 871 872 872 /** 873 * Get filter links for statuses 873 * Get filter links for statuses. 874 874 * 875 875 * @since 2.6.0 bbPress (r5885) -
trunk/src/includes/admin/tools/converter.php
r7379 r7380 2 2 3 3 /** 4 * bbPress Converter 4 * bbPress Converter. 5 5 * 6 * Based on the hard work of Adam Ellis 6 * Based on the hard work of Adam Ellis. 7 7 * 8 8 * @package bbPress … … 14 14 15 15 /** 16 * Return an array of available converters 16 * Return an array of available converters. 17 17 * 18 18 * @since 2.6.0 bbPress (r6447) -
trunk/src/includes/admin/tools/help.php
r7378 r7380 2 2 3 3 /** 4 * bbPress Admin Tools Help 4 * bbPress Admin Tools Help. 5 5 * 6 6 * @package bbPress … … 12 12 13 13 /** 14 * Contextual help for Repair Forums tools page 14 * Contextual help for Repair Forums tools page. 15 15 * 16 16 * @since 2.6.0 bbPress (r5314) … … 51 51 52 52 /** 53 * Contextual help for Reset Forums tools page 53 * Contextual help for Reset Forums tools page. 54 54 * 55 55 * @since 2.6.0 bbPress (r5314) … … 82 82 83 83 /** 84 * Contextual help for Import Forums tools page 84 * Contextual help for Import Forums tools page. 85 85 * 86 86 * @since 2.6.0 bbPress (r5314) -
trunk/src/includes/admin/tools/repair.php
r7378 r7380 2 2 3 3 /** 4 * bbPress Admin Repair Page 4 * bbPress Admin Repair Page. 5 5 * 6 6 * @package bbPress … … 12 12 13 13 /** 14 * Admin repair page 14 * Admin repair page. 15 15 * 16 16 * @since 2.0.0 bbPress (r2613) Converted from bbPress 1.2 … … 18 18 * 19 19 * @todo Use a real list table 20 *21 20 */ 22 21 function bbp_admin_repair_page() { … … 228 227 229 228 /** 230 * Recount topic replies 229 * Recount topic replies. 231 230 * 232 231 * @since 2.0.0 bbPress (r2613) 233 232 * 234 * @return array An array of the status code and the message 233 * @return array An array of the status code and the message. 235 234 */ 236 235 function bbp_admin_repair_topic_reply_count() { … … 278 277 279 278 /** 280 * Recount topic voices 279 * Recount topic voices. 281 280 * 282 281 * @since 2.0.0 bbPress (r2613) 283 282 * 284 * @return array An array of the status code and the message 283 * @return array An array of the status code and the message. 285 284 */ 286 285 function bbp_admin_repair_topic_voice_count() { … … 336 335 337 336 /** 338 * Recount non-public replies per topic (pending/spammed/trashed) 337 * Recount non-public replies per topic (pending/spammed/trashed). 339 338 * 340 339 * @since 2.0.0 bbPress (r2747) 341 340 * 342 * @return array An array of the status code and the message 341 * @return array An array of the status code and the message. 343 342 */ 344 343 function bbp_admin_repair_topic_hidden_reply_count() { … … 371 370 372 371 /** 373 * Recount forum topics 372 * Recount forum topics. 374 373 * 375 374 * @since 2.0.0 bbPress (r2613) 376 375 * 377 * @return array An array of the status code and the message 376 * @return array An array of the status code and the message. 378 377 */ 379 378 function bbp_admin_repair_forum_topic_count() { … … 410 409 411 410 /** 412 * Recount topic in each topic-tag 411 * Recount topic in each topic-tag. 413 412 * 414 413 * @since 2.6.0 bbPress (r6256) 415 414 * 416 * @return array An array of the status code and the message 415 * @return array An array of the status code and the message. 417 416 */ 418 417 function bbp_admin_repair_topic_tag_count() { … … 462 461 463 462 /** 464 * Recount forum replies 463 * Recount forum replies. 465 464 * 466 465 * @since 2.0.0 bbPress (r2613) 467 466 * 468 * @return array An array of the status code and the message 467 * @return array An array of the status code and the message. 469 468 */ 470 469 function bbp_admin_repair_forum_reply_count() { … … 510 509 511 510 /** 512 * Recount non-public forum replies 511 * Recount non-public forum replies. 513 512 * 514 513 * @since 2.6.0 bbPress (r6922) 515 514 * @since 2.6.0 bbPress (r6932) Rename to match the topic reply recount function 516 515 * 517 * @return array An array of the status code and the message 516 * @return array An array of the status code and the message. 518 517 */ 519 518 function bbp_admin_repair_forum_hidden_reply_count() { … … 559 558 560 559 /** 561 * Recount topics by the users 560 * Recount topics by the users. 562 561 * 563 562 * @since 2.1.0 bbPress (r3889) 564 563 * 565 * @return array An array of the status code and the message 564 * @return array An array of the status code and the message. 566 565 */ 567 566 function bbp_admin_repair_user_topic_count() { … … 610 609 611 610 /** 612 * Recount topic replied by the users 611 * Recount topic replied by the users. 613 612 * 614 613 * @since 2.0.0 bbPress (r2613) 615 614 * 616 * @return array An array of the status code and the message 615 * @return array An array of the status code and the message. 617 616 */ 618 617 function bbp_admin_repair_user_reply_count() { … … 661 660 662 661 /** 663 * Repair user favorites 662 * Repair user favorites. 664 663 * 665 664 * @since 2.0.0 bbPress (r2613) 666 665 * 667 * @return array An array of the status code and the message 666 * @return array An array of the status code and the message. 668 667 */ 669 668 function bbp_admin_repair_user_favorites() { … … 732 731 733 732 /** 734 * Clean the user topic subscriptions 733 * Clean the user topic subscriptions. 735 734 * 736 735 * @since 2.0.0 bbPress (r2668) 737 736 * 738 * @return array An array of the status code and the message 737 * @return array An array of the status code and the message. 739 738 */ 740 739 function bbp_admin_repair_user_topic_subscriptions() { … … 802 801 803 802 /** 804 * Clean the user forum subscriptions 803 * Clean the user forum subscriptions. 805 804 * 806 805 * @since 2.5.0 bbPress (r5155) 807 806 * 808 * @return array An array of the status code and the message 807 * @return array An array of the status code and the message. 809 808 */ 810 809 function bbp_admin_repair_user_forum_subscriptions() { … … 994 993 995 994 /** 996 * Repair the last post in every topic and forum 995 * Repair the last post in every topic and forum. 997 996 * 998 997 * @since 2.0.0 bbPress (r3040) 999 998 * 1000 * @return array An array of the status code and the message 999 * @return array An array of the status code and the message. 1001 1000 */ 1002 1001 function bbp_admin_repair_freshness() { … … 1148 1147 1149 1148 /** 1150 * Repair the relationship of sticky topics to the actual parent forum 1149 * Repair the relationship of sticky topics to the actual parent forum. 1151 1150 * 1152 1151 * @since 2.3.0 bbPress (r4695) 1153 1152 * 1154 * @return array An array of the status code and the message 1153 * @return array An array of the status code and the message. 1155 1154 */ 1156 1155 function bbp_admin_repair_sticky() { … … 1209 1208 1210 1209 /** 1211 * Repair closed topics 1210 * Repair closed topics. 1212 1211 * 1213 1212 * Closed topics that are missing the post-meta "_bbp_status" key value "publish" … … 1263 1262 1264 1263 /** 1265 * Repair the private and hidden forums 1264 * Repair the private and hidden forums. 1266 1265 * 1267 1266 * @since 2.2.0 bbPress (r4104) 1268 1267 * 1269 * @return array An array of the status code and the message 1268 * @return array An array of the status code and the message. 1270 1269 */ 1271 1270 function bbp_admin_repair_forum_visibility() { … … 1284 1283 1285 1284 /** 1286 * Repair the parent forum meta for each topic and reply 1285 * Repair the parent forum meta for each topic and reply. 1287 1286 * 1288 1287 * @since 2.1.0 bbPress (r3876) 1289 1288 * 1290 * @return array An array of the status code and the message 1289 * @return array An array of the status code and the message. 1291 1290 */ 1292 1291 function bbp_admin_repair_forum_meta() { … … 1359 1358 1360 1359 /** 1361 * Repair the topic for each post 1360 * Repair the topic for each post. 1362 1361 * 1363 1362 * @since 2.1.0 bbPress (r3876) 1364 1363 * 1365 * @return array An array of the status code and the message 1364 * @return array An array of the status code and the message. 1366 1365 */ 1367 1366 function bbp_admin_repair_topic_meta() { … … 1419 1418 1420 1419 /** 1421 * Recalculate reply menu order 1420 * Recalculate reply menu order. 1422 1421 * 1423 1422 * @since 2.5.4 bbPress (r5367) 1424 1423 * 1425 * @return array An array of the status code and the message 1424 * @return array An array of the status code and the message. 1426 1425 */ 1427 1426 function bbp_admin_repair_reply_menu_order() { -
trunk/src/includes/admin/tools/reset.php
r7378 r7380 2 2 3 3 /** 4 * bbPress Admin Tools Reset 4 * bbPress Admin Tools Reset. 5 5 * 6 6 * @package bbPress … … 12 12 13 13 /** 14 * Admin reset page 14 * Admin reset page. 15 15 * 16 16 * @since 2.0.0 bbPress (r2613) 17 *18 17 */ 19 18 function bbp_admin_reset_page() { … … 106 105 * @since 2.6.0 bbPress (r6758) 107 106 * 108 * @param array $args Array of query, message, and possible responses 107 * @param array $args Array of query, message, and possible responses. 109 108 * 110 109 * @return string -
trunk/src/includes/admin/tools/upgrade.php
r7378 r7380 2 2 3 3 /** 4 * bbPress Admin Upgrade Functions 4 * bbPress Admin Upgrade Functions. 5 5 * 6 6 * @package bbPress … … 12 12 13 13 /** 14 * Admin repair page 14 * Admin repair page. 15 15 * 16 16 * @since 2.6.0 bbPress (r6278) 17 *18 17 */ 19 18 function bbp_admin_upgrade_page() { … … 242 241 243 242 /** 244 * Upgrade user engagements for bbPress 2.6 and higher 243 * Upgrade user engagements for bbPress 2.6 and higher. 245 244 * 246 245 * @since 2.6.0 bbPress (r6320) 247 246 * 248 * @return array An array of the status code and the message 247 * @return array An array of the status code and the message. 249 248 */ 250 249 function bbp_admin_upgrade_user_engagements() { … … 294 293 295 294 /** 296 * Upgrade group forum ID mappings after a bbPress 1.x to bbPress 2.x conversion 297 * 298 * Previously named: bbp_admin_repair_group_forum_relationships() 295 * Upgrade group forum ID mappings after a bbPress 1.x to bbPress 2.x conversion. 296 * 297 * Previously named: bbp_admin_repair_group_forum_relationships(). 299 298 * 300 299 * @since 2.6.0 bbPress (r4395) 301 300 * 302 * @return If a wp_error() occurs and no converted forums are found 301 * @return If a wp_error() occurs and no converted forums are found. 303 302 */ 304 303 function bbp_admin_upgrade_group_forum_relationships() { … … 447 446 448 447 /** 449 * Upgrade user favorites for bbPress 2.6 and higher 448 * Upgrade user favorites for bbPress 2.6 and higher. 450 449 * 451 450 * @since 2.6.0 bbPress (r6174) 452 451 * 453 * @return array An array of the status code and the message 452 * @return array An array of the status code and the message. 454 453 */ 455 454 function bbp_admin_upgrade_user_favorites() { … … 509 508 510 509 /** 511 * Upgrade user topic subscriptions for bbPress 2.6 and higher 510 * Upgrade user topic subscriptions for bbPress 2.6 and higher. 512 511 * 513 512 * @since 2.6.0 bbPress (r6174) 514 513 * 515 * @return array An array of the status code and the message 514 * @return array An array of the status code and the message. 516 515 */ 517 516 function bbp_admin_upgrade_user_topic_subscriptions() { … … 571 570 572 571 /** 573 * Upgrade user forum subscriptions for bbPress 2.6 and higher 572 * Upgrade user forum subscriptions for bbPress 2.6 and higher. 574 573 * 575 574 * @since 2.6.0 bbPress (r6193) 576 575 * 577 * @return array An array of the status code and the message 576 * @return array An array of the status code and the message. 578 577 */ 579 578 function bbp_admin_upgrade_user_forum_subscriptions() { … … 633 632 634 633 /** 635 * Remove favorites data from user meta for bbPress 2.6 and higher 634 * Remove favorites data from user meta for bbPress 2.6 and higher. 636 635 * 637 636 * @since 2.6.0 bbPress (r6281) 638 637 * 639 * @return array An array of the status code and the message 638 * @return array An array of the status code and the message. 640 639 */ 641 640 function bbp_admin_upgrade_remove_favorites_from_usermeta() { … … 671 670 672 671 /** 673 * Remove topic subscriptions data from user meta for bbPress 2.6 and higher 672 * Remove topic subscriptions data from user meta for bbPress 2.6 and higher. 674 673 * 675 674 * @since 2.6.0 bbPress (r6281) 676 675 * 677 * @return array An array of the status code and the message 676 * @return array An array of the status code and the message. 678 677 */ 679 678 function bbp_admin_upgrade_remove_topic_subscriptions_from_usermeta() { … … 709 708 710 709 /** 711 * Remove topic subscriptions data from user meta for bbPress 2.6 and higher 710 * Remove topic subscriptions data from user meta for bbPress 2.6 and higher. 712 711 * 713 712 * @since 2.6.0 bbPress (r6281) 714 713 * 715 * @return array An array of the status code and the message 714 * @return array An array of the status code and the message. 716 715 */ 717 716 function bbp_admin_upgrade_remove_forum_subscriptions_from_usermeta() { -
trunk/src/includes/admin/topics.php
r7379 r7380 2 2 3 3 /** 4 * bbPress Topics Admin Class 4 * bbPress Topics Admin Class. 5 5 * 6 6 * @package bbPress … … 13 13 if ( ! class_exists( 'BBP_Topics_Admin' ) ) : 14 14 /** 15 * Loads bbPress topics admin area 15 * Loads bbPress topics admin area. 16 16 * 17 17 * @package bbPress … … 24 24 25 25 /** 26 * @var The post type of this admin component 26 * @var The post type of this admin component. 27 27 */ 28 28 private $post_type = ''; … … 31 31 32 32 /** 33 * The main bbPress topics admin loader 33 * The main bbPress topics admin loader. 34 34 * 35 35 * @since 2.0.0 bbPress (r2515) … … 41 41 42 42 /** 43 * Setup the admin hooks, actions and filters 43 * Setup the admin hooks, actions and filters. 44 44 * 45 45 * @since 2.0.0 bbPress (r2646) … … 95 95 96 96 /** 97 * Admin globals 97 * Admin globals. 98 98 * 99 99 * @since 2.0.0 bbPress (r2646) … … 108 108 109 109 /** 110 * Contextual help for bbPress topic edit page 110 * Contextual help for bbPress topic edit page. 111 111 * 112 112 * @since 2.0.0 bbPress (r3119) … … 180 180 181 181 /** 182 * Contextual help for bbPress topic edit page 182 * Contextual help for bbPress topic edit page. 183 183 * 184 184 * @since 2.0.0 bbPress (r3119) … … 356 356 357 357 /** 358 * Add the topic attributes meta-box 358 * Add the topic attributes meta-box. 359 359 * 360 360 * @since 2.0.0 bbPress (r2744) … … 372 372 373 373 /** 374 * Add the author info meta-box 374 * Add the author info meta-box. 375 375 * 376 376 * @since 2.0.0 bbPress (r2828) … … 395 395 396 396 /** 397 * Add the replies meta-box 397 * Add the replies meta-box. 398 398 * 399 399 * Allows viewing & moderating of replies to a topic, based on the way … … 421 421 422 422 /** 423 * Add the engagements meta-box 423 * Add the engagements meta-box. 424 424 * 425 425 * Allows viewing of users who have engaged in a topic. … … 451 451 452 452 /** 453 * Add the favorites meta-box 453 * Add the favorites meta-box. 454 454 * 455 455 * Allows viewing of users who have favorited a topic. … … 481 481 482 482 /** 483 * Add the subscriptions meta-box 483 * Add the subscriptions meta-box. 484 484 * 485 485 * Allows viewing of users who have subscribed to a topic. … … 511 511 512 512 /** 513 * Remove comments & discussion meta-boxes if comments are not supported 513 * Remove comments & discussion meta-boxes if comments are not supported. 514 514 * 515 515 * @since 2.6.0 bbPress (r6186) … … 523 523 524 524 /** 525 * Pass the topic attributes for processing 525 * Pass the topic attributes for processing. 526 526 * 527 527 * @since 2.0.0 bbPress (r2746) 528 528 * 529 * @param int $topic_id Topic id 530 * @return int Parent id 529 * @param int $topic_id Topic id. 530 * @return int Parent id. 531 531 */ 532 532 public function save_meta_boxes( $topic_id ) { … … 576 576 577 577 /** 578 * Toggle topic 578 * Toggle topic. 579 579 * 580 580 * Handles the admin-side opening/closing, sticking/unsticking and 581 * spamming/unspamming of topics 581 * spamming/unspamming of topics. 582 582 * 583 583 * @since 2.0.0 bbPress (r2727) … … 695 695 696 696 /** 697 * Toggle topic notices 697 * Toggle topic notices. 698 698 * 699 699 * Display the success/error notices from … … 817 817 818 818 /** 819 * Returns an array of keys used to sort row actions 819 * Returns an array of keys used to sort row actions. 820 820 * 821 821 * @since 2.6.0 bbPress (r6771) … … 845 845 846 846 /** 847 * Returns an array of notice toggles 847 * Returns an array of notice toggles. 848 848 * 849 849 * @since 2.6.0 bbPress (r6396) … … 871 871 872 872 /** 873 * Returns an array of notice toggles 873 * Returns an array of notice toggles. 874 874 * 875 875 * @since 2.6.0 bbPress (r6396) … … 892 892 893 893 /** 894 * Manage the column headers for the topics page 894 * Manage the column headers for the topics page. 895 895 * 896 896 * @since 2.0.0 bbPress (r2485) 897 897 * 898 * @param array $columns The columns 899 * 900 * @return array $columns bbPress topic columns 898 * @param array $columns The columns. 899 * 900 * @return array $columns bbPress topic columns. 901 901 */ 902 902 public function column_headers( $columns ) { … … 917 917 918 918 /** 919 * Print extra columns for the topics page 919 * Print extra columns for the topics page. 920 920 * 921 921 * @since 2.0.0 bbPress (r2485) 922 922 * 923 * @param string $column Column 924 * @param int $topic_id Topic id 923 * @param string $column Column. 924 * @param int $topic_id Topic id. 925 925 */ 926 926 public function column_data( $column, $topic_id ) { … … 997 997 998 998 /** 999 * Topic Row actions 999 * Topic Row actions. 1000 1000 * 1001 1001 * Remove the quick-edit action link under the topic title and add the 1002 * content and close/stick/spam links 1002 * content and close/stick/spam links. 1003 1003 * 1004 1004 * @since 2.0.0 bbPress (r2485) 1005 1005 * 1006 * @param array $actions Actions 1007 * @param object $topic Topic object 1008 * 1009 * @return array $actions Actions 1006 * @param array $actions Actions. 1007 * @param object $topic Topic object. 1008 * 1009 * @return array $actions Actions. 1010 1010 */ 1011 1011 public function row_actions( $actions = array(), $topic = false ) { … … 1122 1122 1123 1123 /** 1124 * Sort row actions by key 1124 * Sort row actions by key. 1125 1125 * 1126 1126 * @since 2.6.0 … … 1151 1151 1152 1152 /** 1153 * Add forum dropdown to topic and reply list table filters 1153 * Add forum dropdown to topic and reply list table filters. 1154 1154 * 1155 1155 * @since 2.0.0 bbPress (r2991) 1156 1156 * 1157 * @return bool False. If post type is not topic or reply 1157 * @return bool False. If post type is not topic or reply. 1158 1158 */ 1159 1159 public function filter_dropdown() { … … 1174 1174 1175 1175 /** 1176 * Add "Empty Spam" button for moderators 1176 * Add "Empty Spam" button for moderators. 1177 1177 * 1178 1178 * @since 2.6.0 bbPress (r6791) … … 1210 1210 1211 1211 /** 1212 * Adjust the request query and include the forum id 1212 * Adjust the request query and include the forum id. 1213 1213 * 1214 1214 * @since 2.0.0 bbPress (r2991) 1215 1215 * 1216 * @param array $query_vars Query variables from {@link WP_Query} 1217 * @return array Processed Query Vars 1216 * @param array $query_vars Query variables from {@link WP_Query}. 1217 * @return array Processed Query Vars. 1218 1218 */ 1219 1219 public function filter_post_rows( $query_vars ) { … … 1231 1231 1232 1232 /** 1233 * Custom user feedback messages for topic post type 1233 * Custom user feedback messages for topic post type. 1234 1234 * 1235 1235 * @since 2.0.0 bbPress (r3080) … … 1324 1324 1325 1325 /** 1326 * Setup bbPress Topics Admin 1326 * Setup bbPress Topics Admin. 1327 1327 * 1328 1328 * This is currently here to make hooking and unhooking of the admin UI easy. … … 1331 1331 * @since 2.0.0 bbPress (r2596) 1332 1332 * 1333 * @param WP_Screen $current_screen Current screen object 1333 * @param WP_Screen $current_screen Current screen object. 1334 1334 */ 1335 1335 function bbp_admin_topics( $current_screen ) { -
trunk/src/includes/admin/users.php
r7378 r7380 2 2 3 3 /** 4 * bbPress Users Admin Class 4 * bbPress Users Admin Class. 5 5 * 6 6 * @package bbPress … … 13 13 if ( ! class_exists( 'BBP_Users_Admin' ) ) : 14 14 /** 15 * Loads bbPress users admin area 15 * Loads bbPress users admin area. 16 16 * 17 17 * @package bbPress … … 22 22 23 23 /** 24 * The bbPress users admin loader 24 * The bbPress users admin loader. 25 25 * 26 26 * @since 2.0.0 bbPress (r2515) … … 31 31 32 32 /** 33 * Setup the admin hooks, actions and filters 33 * Setup the admin hooks, actions and filters. 34 34 * 35 35 * @since 2.0.0 bbPress (r2646) … … 69 69 70 70 /** 71 * Default interface for setting a forum role 71 * Default interface for setting a forum role. 72 72 * 73 73 * @since 2.2.0 bbPress (r4285) … … 130 130 131 131 /** 132 * Add bulk forums role dropdown to the WordPress users table 132 * Add bulk forums role dropdown to the WordPress users table. 133 133 * 134 134 * @since 2.2.0 bbPress (r4360) … … 174 174 175 175 /** 176 * Process bulk dropdown form submission from the WordPress Users 177 * Table 176 * Process bulk dropdown form submission from the WordPress Users Table. 178 177 * 179 178 * @since 2.2.0 bbPress (r4365) 180 *181 * @return bool Always false182 179 */ 183 180 public function user_role_bulk_change() { … … 243 240 244 241 /** 245 * Add a "View" link for each user 242 * Add a "View" link for each user. 246 243 * 247 244 * @since 2.6.0 bbPress (r6502) … … 250 247 * @param WP_User $user 251 248 * 252 * @return array Actions with 'view' link added to them 249 * @return array Actions with 'view' link added to them. 253 250 */ 254 251 public function user_row_actions( $actions = array(), $user = false ) { … … 266 263 /** 267 264 * Add Forum Role column to the WordPress Users table, and change the 268 * core role title to "Site Role" 265 * core role title to "Site Role". 269 266 * 270 267 * @since 2.2.0 bbPress (r4337) 271 268 * 272 * @param array $columns Users table columns 269 * @param array $columns Users table columns. 273 270 * @return array $columns 274 271 */ … … 293 290 294 291 /** 295 * Return user's forums role for display in the WordPress Users list table 292 * Return user's forums role for display in the WordPress Users list table. 296 293 * 297 294 * @since 2.2.0 bbPress (r4337) … … 301 298 * @param int $user_id 302 299 * 303 * @return string Displayable bbPress user role 300 * @return string Displayable bbPress user role. 304 301 */ 305 302 public static function user_role_row( $retval = '', $column_name = '', $user_id = 0 ) { … … 324 321 325 322 /** 326 * Filter the list of roles included in the WordPress site role list 323 * Filter the list of roles included in the WordPress site role list. 327 324 * 328 325 * Ensures forum roles are only displayed under the Forum Role list in the 329 * WordPress Users list table 326 * WordPress Users list table. 330 327 * 331 328 * @since 2.6.0 bbPress (r6051) -
trunk/src/includes/common/ajax.php
r7379 r7380 2 2 3 3 /** 4 * bbPress Common AJAX Functions 4 * bbPress Common AJAX Functions. 5 5 * 6 6 * Common AJAX functions are ones that are used to setup and/or use during … … 15 15 16 16 /** 17 * Output the URL to use for theme-side bbPress AJAX requests 17 * Output the URL to use for theme-side bbPress AJAX requests. 18 18 * 19 19 * @since 2.3.0 bbPress (r4543) … … 22 22 echo esc_url( bbp_get_ajax_url() ); 23 23 } 24 25 /** 26 * Return the URL to use for theme-side bbPress AJAX requests. 27 * 28 * @since 2.3.0 bbPress (r4543) 29 * 30 * @global WP $wp 31 * @return string 32 */ 33 function bbp_get_ajax_url() { 34 global $wp; 35 36 $ssl = bbp_get_url_scheme(); 37 $url = trailingslashit( $wp->request ); 38 $base_url = home_url( $url, $ssl ); 39 $ajaxurl = add_query_arg( array( 'bbp-ajax' => 'true' ), $base_url ); 40 24 41 /** 25 * Return the URL to use for theme-side bbPress AJAX requests42 * Filters the URL used for theme-side bbPress AJAX requests. 26 43 * 27 44 * @since 2.3.0 bbPress (r4543) 28 45 * 29 * @ global WP $wp30 * @return string 46 * @param string $ajaxurl The URL for bbPress AJAX requests. 47 * @return string The filtered URL for bbPress AJAX requests. 31 48 */ 32 function bbp_get_ajax_url() { 33 global $wp; 34 35 $ssl = bbp_get_url_scheme(); 36 $url = trailingslashit( $wp->request ); 37 $base_url = home_url( $url, $ssl ); 38 $ajaxurl = add_query_arg( array( 'bbp-ajax' => 'true' ), $base_url ); 39 40 /** 41 * Filters the URL used for theme-side bbPress AJAX requests. 42 * 43 * @since 2.3.0 bbPress (r4543) 44 * 45 * @param string $ajaxurl The URL for bbPress AJAX requests. 46 * @return string The filtered URL for bbPress AJAX requests. 47 */ 48 return apply_filters( 'bbp_get_ajax_url', $ajaxurl ); 49 } 49 return apply_filters( 'bbp_get_ajax_url', $ajaxurl ); 50 } 50 51 51 52 /** … … 54 55 * @since 2.3.0 bbPress (r4543) 55 56 * 56 * @return bool Looking for bbp-ajax 57 * @return bool Looking for bbp-ajax. 57 58 */ 58 59 function bbp_is_ajax() { … … 69 70 * @since 2.3.0 bbPress (r4543) 70 71 * 71 * @param string $action Sanitized action from bbp_post_request/bbp_get_request 72 * @param string $action Sanitized action from bbp_post_request/bbp_get_request. 72 73 * 73 * @return If not a bbPress AJAX request 74 * @return If not a bbPress AJAX request. 74 75 */ 75 76 function bbp_do_ajax( $action = '' ) { … … 112 113 113 114 /** 114 * Send headers for AJAX specific requests 115 * Send headers for AJAX specific requests. 115 116 * 116 117 * This was abstracted from bbp_do_ajax() for use in custom theme-side AJAX … … 133 134 134 135 /** 135 * Helper method to return JSON response for bbPress AJAX calls 136 * Helper method to return JSON response for bbPress AJAX calls. 136 137 * 137 138 * @since 2.3.0 bbPress (r4542) -
trunk/src/includes/common/classes.php
r7378 r7380 2 2 3 3 /** 4 * bbPress Classes 4 * bbPress Classes. 5 5 * 6 6 * @package bbPress … … 13 13 if ( ! class_exists( 'BBP_Component' ) ) : 14 14 /** 15 * bbPress Component Class 15 * bbPress Component Class. 16 16 * 17 17 * The bbPress component class is responsible for simplifying the creation … … 28 28 29 29 /** 30 * @var string Unique name (for internal identification) 30 * @var string Unique name (for internal identification). 31 31 * @internal 32 32 */ … … 34 34 35 35 /** 36 * @var Unique ID (normally for custom post type) 36 * @var Unique ID (normally for custom post type). 37 37 */ 38 38 public $id; 39 39 40 40 /** 41 * @var string Unique slug (used in query string and permalinks) 41 * @var string Unique slug (used in query string and permalinks). 42 42 */ 43 43 public $slug; 44 44 45 45 /** 46 * @var WP_Query The loop for this component 46 * @var WP_Query The loop for this component. 47 47 */ 48 48 public $query; 49 49 50 50 /** 51 * @var string The current ID of the queried object 51 * @var string The current ID of the queried object. 52 52 */ 53 53 public $current_id; … … 57 57 58 58 /** 59 * bbPress Component loader 59 * bbPress Component loader. 60 60 * 61 61 * @since 2.0.0 bbPress (r2700) … … 79 79 80 80 /** 81 * Component global variables 81 * Component global variables. 82 82 * 83 83 * @since 2.0.0 bbPress (r2700) … … 92 92 93 93 /** 94 * Include required files 94 * Include required files. 95 95 * 96 96 * @since 2.0.0 bbPress (r2700) … … 103 103 104 104 /** 105 * Setup the actions 105 * Setup the actions. 106 106 * 107 107 * @since 2.0.0 bbPress (r2700) … … 120 120 121 121 /** 122 * Setup the component post types 122 * Setup the component post types. 123 123 * 124 124 * @since 2.0.0 bbPress (r2700) … … 129 129 130 130 /** 131 * Register component specific taxonomies 131 * Register component specific taxonomies. 132 132 * 133 133 * @since 2.0.0 bbPress (r2700) … … 138 138 139 139 /** 140 * Add any additional rewrite tags 140 * Add any additional rewrite tags. 141 141 * 142 142 * @since 2.0.0 bbPress (r2700) … … 147 147 148 148 /** 149 * Generate any additional rewrite rules 149 * Generate any additional rewrite rules. 150 150 * 151 151 * @since 2.0.0 bbPress (r2700) … … 192 192 193 193 /** 194 * Set the tree_type 194 * Set the tree_type. 195 195 * 196 196 * @since 2.0.0 bbPress (r2746) … … 273 273 274 274 /** 275 * Confirm the tree_type 275 * Confirm the tree_type. 276 276 * 277 277 * @since 2.6.0 bbPress (r5389) … … 286 286 * @since 2.4.0 bbPress (r4944) 287 287 * 288 * @param string $output Passed by reference. Used to append additional content 289 * @param int $depth Depth of reply 290 * @param array $args Uses 'style' argument for type of HTML list 288 * @param string $output Passed by reference. Used to append additional content. 289 * @param int $depth Depth of reply. 290 * @param array $args Uses 'style' argument for type of HTML list. 291 291 */ 292 292 public function start_lvl( &$output = '', $depth = 0, $args = array() ) { … … 311 311 * @since 2.4.0 bbPress (r4944) 312 312 * 313 * @param string $output Passed by reference. Used to append additional content 314 * @param int $depth Depth of reply 315 * @param array $args Will only append content if style argument value is 'ol' or 'ul' 313 * @param string $output Passed by reference. Used to append additional content. 314 * @param int $depth Depth of reply. 315 * @param array $args Will only append content if style argument value is 'ol' or 'ul'. 316 316 */ 317 317 public function end_lvl( &$output = '', $depth = 0, $args = array() ) { … … 444 444 445 445 /** 446 * Confirm the tree_type 446 * Confirm the tree_type. 447 447 * 448 448 * @since 2.6.0 bbPress (r5389) … … 468 468 * selected HTML attribute for option element. 469 469 * 470 * @param int $current_object_id Not Used 470 * @param int $current_object_id Not Used. 471 471 */ 472 472 public function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) { -
trunk/src/includes/common/engagements.php
r7379 r7380 2 2 3 3 /** 4 * bbPress Common Engagements 4 * bbPress Common Engagements. 5 5 * 6 6 * This file contains the common classes and functions for interacting with the … … 15 15 16 16 /** 17 * Return the strategy used for storing user engagements 17 * Return the strategy used for storing user engagements. 18 18 * 19 19 * @since 2.6.0 bbPress (r6722) 20 20 * 21 * @param string $rel_key The key used to index this relationship 22 * @param string $rel_type The type of meta to look in 21 * @param string $rel_key The key used to index this relationship. 22 * @param string $rel_type The type of meta to look in. 23 23 * 24 24 * @return string … … 46 46 47 47 /** 48 * Add a user id to an object 49 * 50 * @since 2.6.0 bbPress (r6722) 51 * 52 * @param int $object_id The object id 53 * @param int $user_id The user id 54 * @param string $meta_key The relationship key 55 * @param string $meta_type The relationship type (usually 'post') 56 * @param bool $unique Whether meta key should be unique to the object 57 * 58 * @return bool Returns true on success, false on failure 48 * Add a user id to an object. 49 * 50 * @since 2.6.0 bbPress (r6722) 51 * 52 * @param int $object_id The object id. 53 * @param int $user_id The user id. 54 * @param string $meta_key The relationship key. 55 * @param string $meta_type The relationship type (usually 'post'). 56 * @param bool $unique Whether meta key should be unique to the object. 57 * 58 * @return bool Returns true on success, false on failure. 59 59 */ 60 60 public function add_user_to_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post', $unique = false ) { … … 63 63 64 64 /** 65 * Remove a user id from an object 66 * 67 * @since 2.6.0 bbPress (r6722) 68 * 69 * @param int $object_id The object id 70 * @param int $user_id The user id 71 * @param string $meta_key The relationship key 72 * @param string $meta_type The relationship type (usually 'post') 73 * 74 * @return bool Returns true on success, false on failure 65 * Remove a user id from an object. 66 * 67 * @since 2.6.0 bbPress (r6722) 68 * 69 * @param int $object_id The object id. 70 * @param int $user_id The user id. 71 * @param string $meta_key The relationship key. 72 * @param string $meta_type The relationship type (usually 'post'). 73 * 74 * @return bool Returns true on success, false on failure. 75 75 */ 76 76 public function remove_user_from_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post' ) { … … 79 79 80 80 /** 81 * Remove a user id from all objects 82 * 83 * @since 2.6.0 bbPress (r6722) 84 * 85 * @param int $user_id The user id 86 * @param string $meta_key The relationship key 87 * @param string $meta_type The relationship type (usually 'post') 88 * 89 * @return bool Returns true on success, false on failure 81 * Remove a user id from all objects. 82 * 83 * @since 2.6.0 bbPress (r6722) 84 * 85 * @param int $user_id The user id. 86 * @param string $meta_key The relationship key. 87 * @param string $meta_type The relationship type (usually 'post'). 88 * 89 * @return bool Returns true on success, false on failure. 90 90 */ 91 91 public function remove_user_from_all_objects( $user_id = 0, $meta_key = '', $meta_type = 'post' ) { … … 94 94 95 95 /** 96 * Remove an object from all users 97 * 98 * @since 2.6.0 bbPress (r6722) 99 * 100 * @param int $object_id The object id 101 * @param int $user_id The user id 102 * @param string $meta_key The relationship key 103 * @param string $meta_type The relationship type (usually 'post') 104 * 105 * @return bool Returns true on success, false on failure 96 * Remove an object from all users. 97 * 98 * @since 2.6.0 bbPress (r6722) 99 * 100 * @param int $object_id The object id. 101 * @param int $user_id The user id. 102 * @param string $meta_key The relationship key. 103 * @param string $meta_type The relationship type (usually 'post'). 104 * 105 * @return bool Returns true on success, false on failure. 106 106 */ 107 107 public function remove_object_from_all_users( $object_id = 0, $meta_key = '', $meta_type = 'post' ) { … … 110 110 111 111 /** 112 * Remove all users from all objects 113 * 114 * @since 2.6.0 bbPress (r6722) 115 * 116 * @param string $meta_key The relationship key 117 * @param string $meta_type The relationship type (usually 'post') 118 * 119 * @return bool Returns true on success, false on failure 112 * Remove all users from all objects. 113 * 114 * @since 2.6.0 bbPress (r6722) 115 * 116 * @param string $meta_key The relationship key. 117 * @param string $meta_type The relationship type (usually 'post'). 118 * 119 * @return bool Returns true on success, false on failure. 120 120 */ 121 121 public function remove_all_users_from_all_objects( $meta_key = '', $meta_type = 'post' ) { … … 124 124 125 125 /** 126 * Get users of an object 127 * 128 * @since 2.6.0 bbPress (r6722) 129 * 130 * @param int $object_id The object id 131 * @param string $meta_key The key used to index this relationship 132 * @param string $meta_type The type of meta to look in 133 * 134 * @return array Returns ids of users 126 * Get users of an object. 127 * 128 * @since 2.6.0 bbPress (r6722) 129 * 130 * @param int $object_id The object id. 131 * @param string $meta_key The key used to index this relationship. 132 * @param string $meta_type The type of meta to look in. 133 * 134 * @return array Returns ids of users. 135 135 */ 136 136 public function get_users_for_object( $object_id = 0, $meta_key = '', $meta_type = 'post' ) { … … 155 155 156 156 /** 157 * Meta strategy for interfacing with User Engagements 157 * Meta strategy for interfacing with User Engagements. 158 158 * 159 159 * @since 2.6.0 bbPress (r6722) … … 171 171 172 172 /** 173 * Add a user id to an object 174 * 175 * @since 2.6.0 bbPress (r6722) 176 * 177 * @param int $object_id The object id 178 * @param int $user_id The user id 179 * @param string $meta_key The relationship key 180 * @param string $meta_type The relationship type (usually 'post') 181 * @param bool $unique Whether meta key should be unique to the object 182 * 183 * @return bool Returns true on success, false on failure 173 * Add a user id to an object. 174 * 175 * @since 2.6.0 bbPress (r6722) 176 * 177 * @param int $object_id The object id. 178 * @param int $user_id The user id. 179 * @param string $meta_key The relationship key. 180 * @param string $meta_type The relationship type (usually 'post'). 181 * @param bool $unique Whether meta key should be unique to the object. 182 * 183 * @return bool Returns true on success, false on failure. 184 184 */ 185 185 public function add_user_to_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post', $unique = false ) { … … 188 188 189 189 /** 190 * Remove a user id from an object 191 * 192 * @since 2.6.0 bbPress (r6722) 193 * 194 * @param int $object_id The object id 195 * @param int $user_id The user id 196 * @param string $meta_key The relationship key 197 * @param string $meta_type The relationship type (usually 'post') 190 * Remove a user id from an object. 191 * 192 * @since 2.6.0 bbPress (r6722) 193 * 194 * @param int $object_id The object id. 195 * @param int $user_id The user id. 196 * @param string $meta_key The relationship key. 197 * @param string $meta_type The relationship type (usually 'post'). 198 198 * 199 199 * @return bool Returns true on success, false on failure … … 204 204 205 205 /** 206 * Remove a user id from all objects 207 * 208 * @since 2.6.0 bbPress (r6722) 209 * 210 * @param int $user_id The user id 211 * @param string $meta_key The relationship key 212 * @param string $meta_type The relationship type (usually 'post') 213 * 214 * @return bool Returns true on success, false on failure 206 * Remove a user id from all objects. 207 * 208 * @since 2.6.0 bbPress (r6722) 209 * 210 * @param int $user_id The user id. 211 * @param string $meta_key The relationship key. 212 * @param string $meta_type The relationship type (usually 'post'). 213 * 214 * @return bool Returns true on success, false on failure. 215 215 */ 216 216 public function remove_user_from_all_objects( $user_id = 0, $meta_key = '', $meta_type = 'post' ) { … … 219 219 220 220 /** 221 * Remove an object from all users 222 * 223 * @since 2.6.0 bbPress (r6722) 224 * 225 * @param int $object_id The object id 226 * @param int $user_id The user id 227 * @param string $meta_key The relationship key 228 * @param string $meta_type The relationship type (usually 'post') 229 * 230 * @return bool Returns true on success, false on failure 221 * Remove an object from all users. 222 * 223 * @since 2.6.0 bbPress (r6722) 224 * 225 * @param int $object_id The object id. 226 * @param int $user_id The user id. 227 * @param string $meta_key The relationship key. 228 * @param string $meta_type The relationship type (usually 'post'). 229 * 230 * @return bool Returns true on success, false on failure. 231 231 */ 232 232 public function remove_object_from_all_users( $object_id = 0, $meta_key = '', $meta_type = 'post' ) { … … 235 235 236 236 /** 237 * Remove all users from all objects 238 * 239 * @since 2.6.0 bbPress (r6722) 240 * 241 * @param string $meta_key The relationship key 242 * @param string $meta_type The relationship type (usually 'post') 243 * 244 * @return bool Returns true on success, false on failure 237 * Remove all users from all objects. 238 * 239 * @since 2.6.0 bbPress (r6722) 240 * 241 * @param string $meta_key The relationship key. 242 * @param string $meta_type The relationship type (usually 'post'). 243 * 244 * @return bool Returns true on success, false on failure. 245 245 */ 246 246 public function remove_all_users_from_all_objects( $meta_key = '', $meta_type = 'post' ) { … … 249 249 250 250 /** 251 * Get users of an object 252 * 253 * @since 2.6.0 bbPress (r6722) 254 * 255 * @param int $object_id The object id 256 * @param string $meta_key The key used to index this relationship 257 * @param string $meta_type The type of meta to look in 258 * 259 * @return array Returns ids of users 251 * Get users of an object. 252 * 253 * @since 2.6.0 bbPress (r6722) 254 * 255 * @param int $object_id The object id. 256 * @param string $meta_key The key used to index this relationship. 257 * @param string $meta_type The type of meta to look in. 258 * 259 * @return array Returns ids of users. 260 260 */ 261 261 public function get_users_for_object( $object_id = 0, $meta_key = '', $meta_type = 'post' ) { … … 306 306 307 307 /** 308 * Term strategy for interfacing with User Engagements 308 * Term strategy for interfacing with User Engagements. 309 309 * 310 310 * @since 2.6.0 bbPress (r6737) … … 322 322 323 323 /** 324 * Register an engagement taxonomy just-in-time for immediate use 324 * Register an engagement taxonomy just-in-time for immediate use. 325 325 * 326 326 * @since 2.6.0 bbPress (r6737) … … 366 366 367 367 /** 368 * Add a user id to an object 369 * 370 * @since 2.6.0 bbPress (r6737) 371 * 372 * @param int $object_id The object id 373 * @param int $user_id The user id 374 * @param string $meta_key The relationship key 375 * @param string $meta_type The relationship type (usually 'post') 376 * @param bool $unique Whether meta key should be unique to the object 377 * 378 * @return bool Returns true on success, false on failure 368 * Add a user id to an object. 369 * 370 * @since 2.6.0 bbPress (r6737) 371 * 372 * @param int $object_id The object id. 373 * @param int $user_id The user id. 374 * @param string $meta_key The relationship key. 375 * @param string $meta_type The relationship type (usually 'post'). 376 * @param bool $unique Whether meta key should be unique to the object. 377 * 378 * @return bool Returns true on success, false on failure. 379 379 */ 380 380 public function add_user_to_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post', $unique = false ) { … … 387 387 388 388 /** 389 * Remove a user id from an object 390 * 391 * @since 2.6.0 bbPress (r6737) 392 * 393 * @param int $object_id The object id 394 * @param int $user_id The user id 395 * @param string $meta_key The relationship key 396 * @param string $meta_type The relationship type (usually 'post') 397 * 398 * @return bool Returns true on success, false on failure 389 * Remove a user id from an object. 390 * 391 * @since 2.6.0 bbPress (r6737) 392 * 393 * @param int $object_id The object id. 394 * @param int $user_id The user id. 395 * @param string $meta_key The relationship key. 396 * @param string $meta_type The relationship type (usually 'post'). 397 * 398 * @return bool Returns true on success, false on failure. 399 399 */ 400 400 public function remove_user_from_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post' ) { … … 407 407 408 408 /** 409 * Remove a user id from all objects 410 * 411 * @since 2.6.0 bbPress (r6737) 412 * 413 * @param int $user_id The user id 414 * @param string $meta_key The relationship key 415 * @param string $meta_type The relationship type (usually 'post') 416 * 417 * @return bool Returns true on success, false on failure 409 * Remove a user id from all objects. 410 * 411 * @since 2.6.0 bbPress (r6737) 412 * 413 * @param int $user_id The user id. 414 * @param string $meta_key The relationship key. 415 * @param string $meta_type The relationship type (usually 'post'). 416 * 417 * @return bool Returns true on success, false on failure. 418 418 */ 419 419 public function remove_user_from_all_objects( $user_id = 0, $meta_key = '', $meta_type = 'post' ) { … … 427 427 428 428 /** 429 * Remove an object from all users 430 * 431 * @since 2.6.0 bbPress (r6737) 432 * 433 * @param int $object_id The object id 434 * @param int $user_id The user id 435 * @param string $meta_key The relationship key 436 * @param string $meta_type The relationship type (usually 'post') 437 * 438 * @return bool Returns true on success, false on failure 429 * Remove an object from all users. 430 * 431 * @since 2.6.0 bbPress (r6737) 432 * 433 * @param int $object_id The object id. 434 * @param int $user_id The user id. 435 * @param string $meta_key The relationship key. 436 * @param string $meta_type The relationship type (usually 'post'). 437 * 438 * @return bool Returns true on success, false on failure. 439 439 */ 440 440 public function remove_object_from_all_users( $object_id = 0, $meta_key = '', $meta_type = 'post' ) { … … 443 443 444 444 /** 445 * Remove all users from all objects 446 * 447 * @since 2.6.0 bbPress (r6737) 448 * 449 * @param string $meta_key The relationship key 450 * @param string $meta_type The relationship type (usually 'post') 451 * 452 * @return bool Returns true on success, false on failure 445 * Remove all users from all objects. 446 * 447 * @since 2.6.0 bbPress (r6737) 448 * 449 * @param string $meta_key The relationship key. 450 * @param string $meta_type The relationship type (usually 'post'). 451 * 452 * @return bool Returns true on success, false on failure. 453 453 */ 454 454 public function remove_all_users_from_all_objects( $meta_key = '', $meta_type = 'post' ) { … … 457 457 458 458 /** 459 * Get users of an object 460 * 461 * @since 2.6.0 bbPress (r6737) 462 * 463 * @param int $object_id The object id 464 * @param string $meta_key The key used to index this relationship 465 * @param string $meta_type The type of meta to look in 466 * 467 * @return array Returns ids of users 459 * Get users of an object. 460 * 461 * @since 2.6.0 bbPress (r6737) 462 * 463 * @param int $object_id The object id. 464 * @param string $meta_key The key used to index this relationship. 465 * @param string $meta_type The type of meta to look in. 466 * 467 * @return array Returns ids of users. 468 468 */ 469 469 public function get_users_for_object( $object_id = 0, $meta_key = '', $meta_type = 'post' ) { … … 540 540 541 541 /** 542 * User strategy for interfacing with User Engagements 542 * User strategy for interfacing with User Engagements. 543 543 * 544 544 * This strategy largely exists for backwards compatibility with bbPress 2.5, … … 673 673 * @param int $object_id 674 674 * 675 * @return mixed Results from cache get 675 * @return mixed Results from cache get. 676 676 */ 677 677 private function cache_get( $meta_key = '', $object_id = 0 ) { … … 692 692 * @param int $object_id 693 693 * 694 * @return mixed Results from cache set 694 * @return mixed Results from cache set. 695 695 */ 696 696 private function cache_set( $meta_key = '', $object_id = 0, $user_ids = array() ) { … … 712 712 * @param int $object_id 713 713 * 714 * @return mixed Results from cache delete 714 * @return mixed Results from cache delete. 715 715 */ 716 716 private function cache_delete( $meta_key = '', $object_id = 0 ) { … … 733 733 734 734 /** 735 * Add a user id to an object 735 * Add a user id to an object. 736 736 * 737 737 * @since 2.6.0 bbPress (r6844) 738 738 * 739 * @param int $object_id The object id 740 * @param int $user_id The user id 741 * @param string $meta_key The relationship key 742 * @param string $meta_type The relationship type (usually 'post') 743 * @param bool $unique Whether meta key should be unique to the object 744 * 745 * @return bool Returns true on success, false on failure 739 * @param int $object_id The object id. 740 * @param int $user_id The user id. 741 * @param string $meta_key The relationship key. 742 * @param string $meta_type The relationship type (usually 'post'). 743 * @param bool $unique Whether meta key should be unique to the object. 744 * 745 * @return bool Returns true on success, false on failure. 746 746 */ 747 747 public function add_user_to_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post', $unique = false ) { … … 768 768 769 769 /** 770 * Remove a user id from an object 770 * Remove a user id from an object. 771 771 * 772 772 * @since 2.6.0 bbPress (r6844) 773 773 * 774 * @param int $object_id The object id 775 * @param int $user_id The user id 776 * @param string $meta_key The relationship key 777 * @param string $meta_type The relationship type (usually 'post') 778 * 779 * @return bool Returns true on success, false on failure 774 * @param int $object_id The object id. 775 * @param int $user_id The user id. 776 * @param string $meta_key The relationship key. 777 * @param string $meta_type The relationship type (usually 'post'). 778 * 779 * @return bool Returns true on success, false on failure. 780 780 */ 781 781 public function remove_user_from_object( $object_id = 0, $user_id = 0, $meta_key = '', $meta_type = 'post' ) { … … 805 805 806 806 /** 807 * Remove a user id from all objects 807 * Remove a user id from all objects. 808 808 * 809 809 * @since 2.6.0 bbPress (r6844) 810 810 * 811 * @param int $user_id The user id 812 * @param string $meta_key The relationship key 813 * @param string $meta_type The relationship type (usually 'post') 814 * 815 * @return bool Returns true on success, false on failure 811 * @param int $user_id The user id. 812 * @param string $meta_key The relationship key. 813 * @param string $meta_type The relationship type (usually 'post'). 814 * 815 * @return bool Returns true on success, false on failure. 816 816 */ 817 817 public function remove_user_from_all_objects( $user_id = 0, $meta_key = '', $meta_type = 'post' ) { … … 838 838 839 839 /** 840 * Remove an object from all users 840 * Remove an object from all users. 841 841 * 842 842 * @since 2.6.0 bbPress (r6844) 843 843 * 844 * @param int $object_id The object id 845 * @param int $user_id The user id 846 * @param string $meta_key The relationship key 847 * @param string $meta_type The relationship type (usually 'post') 848 * 849 * @return bool Returns true on success, false on failure 844 * @param int $object_id The object id. 845 * @param int $user_id The user id. 846 * @param string $meta_key The relationship key. 847 * @param string $meta_type The relationship type (usually 'post'). 848 * 849 * @return bool Returns true on success, false on failure. 850 850 */ 851 851 public function remove_object_from_all_users( $object_id = 0, $meta_key = '', $meta_type = 'post' ) { … … 876 876 877 877 /** 878 * Remove all users from all objects 878 * Remove all users from all objects. 879 879 * 880 880 * @since 2.6.0 bbPress (r6844) 881 881 * 882 * @param string $meta_key The relationship key 883 * @param string $meta_type The relationship type (usually 'post') 884 * 885 * @return bool Returns true on success, false on failure 882 * @param string $meta_key The relationship key. 883 * @param string $meta_type The relationship type (usually 'post'). 884 * 885 * @return bool Returns true on success, false on failure. 886 886 */ 887 887 public function remove_all_users_from_all_objects( $meta_key = '', $meta_type = 'post' ) { … … 914 914 915 915 /** 916 * Get users of an object 916 * Get users of an object. 917 917 * 918 918 * The database queries in this function were cached in bbPress versions … … 921 921 * @since 2.6.0 bbPress (r6844) 922 922 * 923 * @param int $object_id The object id 924 * @param string $meta_key The key used to index this relationship 925 * @param string $meta_type The type of meta to look in 926 * 927 * @return array Returns ids of users 923 * @param int $object_id The object id. 924 * @param string $meta_key The key used to index this relationship. 925 * @param string $meta_type The type of meta to look in. 926 * 927 * @return array Returns ids of users. 928 928 */ 929 929 public function get_users_for_object( $object_id = 0, $meta_key = '', $meta_type = 'post' ) { -
trunk/src/includes/common/formatting.php
r7379 r7380 2 2 3 3 /** 4 * bbPress Formatting 4 * bbPress Formatting. 5 5 * 6 6 * @package bbPress … … 14 14 15 15 /** 16 * Custom allowed tags for forum topics and replies 17 * 18 * Allows all users to post links, quotes, code, formatting, lists, and images 16 * Custom allowed tags for forum topics and replies. 17 * 18 * Allows all users to post links, quotes, code, formatting, lists, and images. 19 19 * 20 20 * @since 2.3.0 bbPress (r4603) 21 21 * 22 * @return array Associative array of allowed tags and attributes 22 * @return array Associative array of allowed tags and attributes. 23 23 */ 24 24 function bbp_kses_allowed_tags() { … … 80 80 81 81 /** 82 * Custom kses filter for forum topics and replies, for filtering incoming data 82 * Custom kses filter for forum topics and replies, for filtering incoming data. 83 83 * 84 84 * @since 2.3.0 bbPress (r4603) 85 85 * 86 * @param string $data Content to filter, expected to be escaped with slashes 87 * @return string Filtered content 86 * @param string $data Content to filter, expected to be escaped with slashes. 87 * @return string Filtered content. 88 88 */ 89 89 function bbp_filter_kses( $data = '' ) { … … 92 92 93 93 /** 94 * Custom kses filter for forum topics and replies, for raw data 94 * Custom kses filter for forum topics and replies, for raw data. 95 95 * 96 96 * @since 2.3.0 bbPress (r4603) 97 97 * 98 * @param string $data Content to filter, expected to not be escaped 99 * @return string Filtered content 98 * @param string $data Content to filter, expected to not be escaped. 99 * @return string Filtered content. 100 100 */ 101 101 function bbp_kses_data( $data = '' ) { … … 106 106 107 107 /** 108 * Filter the topic or reply content and output code and pre tags 108 * Filter the topic or reply content and output code and pre tags. 109 109 * 110 110 * @since 2.3.0 bbPress (r4641) 111 111 * 112 * @param string $content Topic and reply content 113 * @return string Partially encoded content 112 * @param string $content Topic and reply content. 113 * @return string Partially encoded content. 114 114 */ 115 115 function bbp_code_trick( $content = '' ) { … … 127 127 * @since 2.3.0 bbPress (r4641) 128 128 * 129 * @param string $content Topic and reply content 130 * @return string Partially encoded content 129 * @param string $content Topic and reply content. 130 * @return string Partially encoded content. 131 131 */ 132 132 function bbp_code_trick_reverse( $content = '' ) { … … 147 147 148 148 /** 149 * Filter the content and encode any bad HTML tags 149 * Filter the content and encode any bad HTML tags. 150 150 * 151 151 * @since 2.3.0 bbPress (r4641) 152 152 * 153 * @param string $content Topic and reply content 154 * @return string Partially encoded content 153 * @param string $content Topic and reply content. 154 * @return string Partially encoded content. 155 155 */ 156 156 function bbp_encode_bad( $content = '' ) { … … 190 190 191 191 /** 192 * Callback to encode the tags in topic or reply content 192 * Callback to encode the tags in topic or reply content. 193 193 * 194 194 * @since 2.3.0 bbPress (r4641) … … 226 226 227 227 /** 228 * Callback to decode the tags in topic or reply content 228 * Callback to decode the tags in topic or reply content. 229 229 * 230 230 * @since 2.3.0 bbPress (r4641) … … 255 255 256 256 /** 257 * Callback to replace empty HTML tags in a content string 257 * Callback to replace empty HTML tags in a content string. 258 258 * 259 259 * @since 2.3.0 bbPress (r4641) … … 271 271 272 272 /** 273 * Callback to replace normal HTML tags in a content string 273 * Callback to replace normal HTML tags in a content string. 274 274 * 275 275 * @since 2.3.0 bbPress (r4641) … … 290 290 291 291 /** 292 * Catches links so rel=nofollow can be added (on output, not save) 292 * Catches links so rel=nofollow can be added (on output, not save). 293 293 * 294 294 * @since 2.3.0 bbPress (r4865) 295 295 * 296 * @param string $text Post text 297 * @return string $text Text with rel=nofollow added to any links 296 * @param string $text Post text. 297 * @return string $text Text with rel=nofollow added to any links. 298 298 */ 299 299 function bbp_rel_nofollow( $text = '' ) { … … 302 302 303 303 /** 304 * Adds rel=nofollow to a link 304 * Adds rel=nofollow to a link. 305 305 * 306 306 * @since 2.3.0 bbPress (r4865) 307 307 * 308 308 * @param array $matches 309 * @return string $text Link with rel=nofollow added 309 * @return string $text Link with rel=nofollow added. 310 310 */ 311 311 function bbp_rel_nofollow_callback( $matches = array() ) { … … 408 408 409 409 /** 410 * Make URLs clickable in content areas 410 * Make URLs clickable in content areas. 411 411 * 412 412 * @since 2.6.0 bbPress (r6014) … … 436 436 437 437 /** 438 * Make FTP clickable in content areas 438 * Make FTP clickable in content areas. 439 439 * 440 440 * @since 2.6.0 bbPress (r6014) … … 450 450 451 451 /** 452 * Make emails clickable in content areas 452 * Make emails clickable in content areas. 453 453 * 454 454 * @since 2.6.0 bbPress (r6014) … … 464 464 465 465 /** 466 * Make mentions clickable in content areas 467 * 468 * Allows ' ', '>', '[', and '(' before as '@' username mention 466 * Make mentions clickable in content areas. 467 * 468 * Allows ' ', '>', '[', and '(' before as '@' username mention. 469 469 * 470 470 * @since 2.6.0 bbPress (r6014) … … 573 573 574 574 /** 575 * A bbPress specific method of formatting numeric values 575 * A bbPress specific method of formatting numeric values. 576 576 * 577 577 * @since 2.0.0 bbPress (r2486) 578 578 * 579 * @param string $number Number to format 580 * @param string $decimals Optional. Display decimals 581 * 582 * @return string Formatted string 579 * @param string $number Number to format. 580 * @param string $decimals Optional. Display decimals. 581 * 582 * @return string Formatted string. 583 583 */ 584 584 function bbp_number_format( $number = 0, $decimals = false, $dec_point = '.', $thousands_sep = ',' ) { … … 594 594 595 595 /** 596 * A bbPress specific method of formatting numeric values 596 * A bbPress specific method of formatting numeric values. 597 597 * 598 598 * @since 2.1.0 bbPress (r3857) 599 599 * 600 * @param string $number Number to format 601 * @param string $decimals Optional. Display decimals 602 * 603 * @return string Formatted string 600 * @param string $number Number to format. 601 * @param string $decimals Optional. Display decimals. 602 * 603 * @return string Formatted string. 604 604 */ 605 605 function bbp_number_format_i18n( $number = 0, $decimals = false ) { … … 626 626 * @param bool $translate Optional. Default is false. Whether to translate the 627 627 * 628 * @return string Returns timestamp 628 * @return string Returns timestamp. 629 629 */ 630 630 function bbp_convert_date( $time, $d = 'U', $translate = false ) { … … 738 738 // Finding the biggest chunk (if the chunk fits, break) 739 739 $count = floor( $since / $seconds ); 740 if ( 0 !== $count) {740 if ( ! empty( $count ) ) { 741 741 break; 742 742 } … … 758 758 759 759 // Add to output var 760 if ( 0 !== $count2) {760 if ( ! empty( $count2 ) ) { 761 761 $output .= _x( ',', 'Separator in time since', 'bbpress' ) . ' '; 762 762 $output .= sprintf( translate_nooped_plural( $chunks[ $i + 1 ][1], $count2, 'bbpress' ), bbp_number_format_i18n( $count2 ) ); … … 828 828 * @since 2.6.14 829 829 * 830 * @param string $display_name The author display 830 * @param string $display_name The author display. 831 831 * @return string 832 832 */ -
trunk/src/includes/common/functions.php
r7379 r7380 2 2 3 3 /** 4 * bbPress Common Functions 4 * bbPress Common Functions. 5 5 * 6 6 * Common functions are ones that are used by more than one component, like … … 15 15 16 16 /** 17 * Return array of bbPress registered post types 17 * Return array of bbPress registered post types. 18 18 * 19 19 * @since 2.6.0 bbPress (r6813) 20 20 * 21 * @param array $args Array of arguments to pass into `get_post_types()` 21 * @param array $args Array of arguments to pass into `get_post_types()`. 22 22 * 23 23 * @return array … … 41 41 42 42 /** 43 * Return the unescaped redirect_to request value 43 * Return the unescaped redirect_to request value. 44 44 * 45 45 * @bbPress (r4655) 46 46 * 47 * @return string The URL to redirect to, if set 47 * @return string The URL to redirect to, if set. 48 48 */ 49 49 function bbp_get_redirect_to() { … … 63 63 * @since 2.0.0 bbPress (r3325) 64 64 * 65 * @param string $original_link Original Link to be modified 66 * @param bool $force Override bbp_get_view_all() check 67 * @return string The link with 'view=all' appended if necessary 65 * @param string $original_link Original Link to be modified. 66 * @param bool $force Override bbp_get_view_all() check. 67 * @return string The link with 'view=all' appended if necessary. 68 68 */ 69 69 function bbp_add_view_all( $original_link = '', $force = false ) { … … 79 79 80 80 /** 81 * Remove 'view=all' from query string 81 * Remove 'view=all' from query string. 82 82 * 83 83 * @since 2.0.0 bbPress (r3325) 84 84 * 85 * @param string $original_link Original Link to be modified 86 * @return string The link with 'view=all' appended if necessary 85 * @param string $original_link Original Link to be modified. 86 * @return string The link with 'view=all' appended if necessary. 87 87 */ 88 88 function bbp_remove_view_all( $original_link = '' ) { … … 96 96 97 97 /** 98 * If current user can and is viewing all topics/replies 98 * If current user can and is viewing all topics/replies. 99 99 * 100 100 * @since 2.0.0 bbPress (r3325) 101 101 * 102 * @param string $cap Capability used to ensure user can view all 103 * 104 * @return bool Whether current user can and is viewing all 102 * @param string $cap Capability used to ensure user can view all. 103 * @return bool Whether current user can and is viewing all. 105 104 */ 106 105 function bbp_get_view_all( $cap = 'moderate' ) { … … 112 111 113 112 /** 114 * Assist pagination by returning correct page number 113 * Assist pagination by returning correct page number. 115 114 * 116 115 * @since 2.0.0 bbPress (r2628) 117 116 * 118 * @return int Current page number 117 * @return int Current page number. 119 118 */ 120 119 function bbp_get_paged() { … … 146 145 * @since 2.6.0 bbPress (r6481) 147 146 * 148 * @param array $arr Array to get values of 147 * @param array $arr Array to get values of. 149 148 * 150 149 * @return array … … 155 154 156 155 /** 157 * Fix post author id on post save 156 * Fix post author id on post save. 158 157 * 159 158 * When a logged in user changes the status of an anonymous reply or topic, or … … 163 162 * @since 2.0.0 bbPress (r2734) 164 163 * 165 * @param array $data Post data 166 * @param array $postarr Original post array (includes post id) 167 * @return array Data 164 * @param array $data Post data. 165 * @param array $postarr Original post array (includes post id). 166 * @return array Data. 168 167 */ 169 168 function bbp_fix_post_author( $data = array(), $postarr = array() ) { … … 203 202 * @since 2.6.10 bbPress (r7233) 204 203 * 205 * @param string $new_status New status to use when untrashing. Default: 'draft' 206 * @param int $post_id Post ID 207 * @param string $previous_status Previous post status from '_wp_trash_meta_status' meta key. Default: 'pending' 204 * @param string $new_status New status to use when untrashing. Default: 'draft'. 205 * @param int $post_id Post ID. 206 * @param string $previous_status Previous post status from '_wp_trash_meta_status' meta key. Default: 'pending'. 208 207 */ 209 208 function bbp_fix_untrash_post_status( $new_status = 'draft', $post_id = 0, $previous_status = 'pending' ) { … … 231 230 * @since 2.6.0 bbPress (r6868) Inverted some logic and added unit tests 232 231 * 233 * @param string $datetime Gets run through strtotime() 232 * @param string $datetime Gets run through strtotime(). 234 233 * @param boolean $utc Default true. Is the timestamp in UTC? 235 234 * … … 291 290 * @since 2.6.0 bbPress (r6424) 292 291 * 293 * @param string $context Provide context for additional filtering 294 * @return int Number of days items remain in trash 292 * @param string $context Provide context for additional filtering. 293 * @return int Number of days items remain in trash. 295 294 */ 296 295 function bbp_get_trash_days( $context = 'forum' ) { … … 311 310 312 311 /** 313 * Get the forum statistics 312 * Get the forum statistics. 314 313 * 315 314 * @since 2.0.0 bbPress (r2769) … … 602 601 603 602 /** 604 * Filter anonymous post data 603 * Filter anonymous post data. 605 604 * 606 605 * We use REMOTE_ADDR here directly. If you are behind a proxy, you should … … 615 614 * @since 2.0.0 bbPress (r2734) 616 615 * 617 * @param array $args Optional. If no args are there, then $_POST values are 618 * @return bool|array False on errors, values in an array on success 616 * @param array $args Optional. If no args are there, then $_POST values are. 617 * @return bool|array False on errors, values in an array on success. 619 618 */ 620 619 function bbp_filter_anonymous_post_data( $args = array() ) { … … 654 653 655 654 /** 656 * Sanitize an array of anonymous post author data 655 * Sanitize an array of anonymous post author data. 657 656 * 658 657 * @since 2.6.0 bbPress (r6400) … … 693 692 694 693 /** 695 * Update the relevant meta-data for an anonymous post author 694 * Update the relevant meta-data for an anonymous post author. 696 695 * 697 696 * @since 2.6.0 bbPress (r6400) … … 739 738 740 739 /** 741 * Check for duplicate topics/replies 742 * 743 * Check to make sure that a user is not making a duplicate post 740 * Check for duplicate topics/replies. 741 * 742 * Check to make sure that a user is not making a duplicate post. 744 743 * 745 744 * @since 2.0.0 bbPress (r2763) 746 745 * 747 * @param array $post_data Contains information about the comment 748 * @return bool True if it is not a duplicate, false if it is 746 * @param array $post_data Contains information about the comment. 747 * @return bool True if it is not a duplicate, false if it is. 749 748 */ 750 749 function bbp_check_for_duplicate( $post_data = array() ) { … … 832 831 833 832 /** 834 * Check for flooding 833 * Check for flooding. 835 834 * 836 835 * Check to make sure that a user is not making too many posts in a short amount … … 841 840 * @param array $anonymous_data Optional - if it's an anonymous post. Do not 842 841 * supply if supplying $author_id. Should be 843 * sanitized (see {@link bbp_filter_anonymous_post_data()} 842 * sanitized (see {@link bbp_filter_anonymous_post_data()}. 844 843 * @param int $author_id Optional. Supply if it's a post by a logged in user. 845 844 * Do not supply if supplying $anonymous_data. 846 * @return bool True if there is no flooding, false if there is 845 * @return bool True if there is no flooding, false if there is. 847 846 */ 848 847 function bbp_check_for_flood( $anonymous_data = array(), $author_id = 0 ) { … … 883 882 884 883 /** 885 * Checks topics and replies against the discussion moderation of blocked keys 884 * Checks topics and replies against the discussion moderation of blocked keys. 886 885 * 887 886 * @since 2.1.0 bbPress (r3581) … … 890 889 * supply if supplying $author_id. Should be 891 890 * sanitized (see {@link bbp_filter_anonymous_post_data()} 892 * @param int $author_id Topic or reply author ID 893 * @param string $title The title of the content 894 * @param string $content The content being posted 891 * @param int $author_id Topic or reply author ID. 892 * @param string $title The title of the content. 893 * @param string $content The content being posted. 895 894 * @param mixed $strict False for moderation_keys. True for disallowed_keys. 896 895 * String for custom keys. 897 * @return bool True if test is passed, false if fail 896 * @return bool True if test is passed, false if fail. 898 897 */ 899 898 function bbp_check_for_moderation( $anonymous_data = array(), $author_id = 0, $title = '', $content = '', $strict = false ) { … … 1099 1098 1100 1099 /** 1101 * Sends notification emails for new replies to subscribed topics 1100 * Sends notification emails for new replies to subscribed topics. 1102 1101 * 1103 1102 * Gets new post ID and check if there are subscribed users to that topic, and 1104 * if there are, send notifications 1103 * if there are, send notifications. 1105 1104 * 1106 1105 * Note: in bbPress 2.6, we've moved away from 1 email per subscriber to 1 email … … 1112 1111 * @since 2.6.0 bbPress (r5413) 1113 1112 * 1114 * @param int $reply_id ID of the newly made reply 1115 * @param int $topic_id ID of the topic of the reply 1116 * @param int $forum_id ID of the forum of the reply 1113 * @param int $reply_id ID of the newly made reply. 1114 * @param int $topic_id ID of the topic of the reply. 1115 * @param int $forum_id ID of the forum of the reply. 1117 1116 * @param array $anonymous_data Optional - if it's an anonymous post. Do not 1118 1117 * supply if supplying $author_id. Should be 1119 * sanitized (see {@link bbp_filter_anonymous_post_data()} 1120 * @param int $reply_author ID of the topic author ID 1121 * @return bool True on success, false on failure 1118 * sanitized (see {@link bbp_filter_anonymous_post_data()}. 1119 * @param int $reply_author ID of the topic author ID. 1120 * @return bool True on success, false on failure. 1122 1121 */ 1123 1122 function bbp_notify_topic_subscribers( $reply_id = 0, $topic_id = 0, $forum_id = 0, $anonymous_data = array(), $reply_author = 0 ) { … … 1273 1272 1274 1273 /** 1275 * Sends notification emails for new topics to subscribed forums 1274 * Sends notification emails for new topics to subscribed forums. 1276 1275 * 1277 1276 * Gets new post ID and check if there are subscribed users to that forum, and 1278 * if there are, send notifications 1277 * if there are, send notifications. 1279 1278 * 1280 1279 * Note: in bbPress 2.6, we've moved away from 1 email per subscriber to 1 email … … 1286 1285 * @since 2.5.0 bbPress (r5156) 1287 1286 * 1288 * @param int $topic_id ID of the newly made reply 1289 * @param int $forum_id ID of the forum for the topic 1287 * @param int $topic_id ID of the newly made reply. 1288 * @param int $forum_id ID of the forum for the topic. 1290 1289 * @param array $anonymous_data Optional - if it's an anonymous post. Do not 1291 1290 * supply if supplying $author_id. Should be 1292 1291 * sanitized (see {@link bbp_filter_anonymous_post_data()} 1293 * @param int $topic_author ID of the topic author ID 1294 * @return bool True on success, false on failure 1292 * @param int $topic_author ID of the topic author ID. 1293 * @return bool True on success, false on failure. 1295 1294 */ 1296 1295 function bbp_notify_forum_subscribers( $topic_id = 0, $forum_id = 0, $anonymous_data = array(), $topic_author = 0 ) { … … 1445 1444 1446 1445 /** 1447 * Sends notification emails for new replies to subscribed topics 1448 * 1449 * This function is deprecated. Please use: bbp_notify_topic_subscribers() 1446 * Sends notification emails for new replies to subscribed topics. 1447 * 1448 * This function is deprecated. Please use: bbp_notify_topic_subscribers(). 1450 1449 * 1451 1450 * @since 2.0.0 bbPress (r2668) … … 1453 1452 * @deprecated 2.6.0 bbPress (r5412) 1454 1453 * 1455 * @param int $reply_id ID of the newly made reply 1456 * @param int $topic_id ID of the topic of the reply 1457 * @param int $forum_id ID of the forum of the reply 1454 * @param int $reply_id ID of the newly made reply. 1455 * @param int $topic_id ID of the topic of the reply. 1456 * @param int $forum_id ID of the forum of the reply. 1458 1457 * @param array $anonymous_data Optional - if it's an anonymous post. Do not 1459 1458 * supply if supplying $author_id. Should be 1460 * sanitized (see {@link bbp_filter_anonymous_post_data()} 1461 * @param int $reply_author ID of the topic author ID 1462 * 1463 * @return bool True on success, false on failure 1459 * sanitized (see {@link bbp_filter_anonymous_post_data()}. 1460 * @param int $reply_author ID of the topic author ID. 1461 * 1462 * @return bool True on success, false on failure. 1464 1463 */ 1465 1464 function bbp_notify_subscribers( $reply_id = 0, $topic_id = 0, $forum_id = 0, $anonymous_data = array(), $reply_author = 0 ) { … … 1468 1467 1469 1468 /** 1470 * Return an array of user email addresses from an array of user IDs 1469 * Return an array of user email addresses from an array of user IDs. 1471 1470 * 1472 1471 * @since 2.6.0 bbPress (r6722) … … 1611 1610 1612 1611 /** 1613 * Return a clean and reliable logout URL 1612 * Return a clean and reliable logout URL. 1614 1613 * 1615 1614 * This function is used to filter `logout_url`. If no $redirect_to value is … … 1620 1619 * @since 2.1.0 bbPress (2815) 1621 1620 * 1622 * @param string $url URL used to log out 1621 * @param string $url URL used to log out. 1623 1622 * @param string $redirect_to Where to redirect to? 1624 1623 * 1625 * @return string The url 1624 * @return string The url. 1626 1625 */ 1627 1626 function bbp_logout_url( $url = '', $redirect_to = '' ) { … … 1673 1672 * @since 2.1.0 bbPress (r3839) 1674 1673 * 1675 * @param string|array $args Value to merge with $defaults 1674 * @param string|array $args Value to merge with $defaults. 1676 1675 * @param array $defaults Array that serves as the defaults. 1677 * @param string $filter_key String to key the filters from 1676 * @param string $filter_key String to key the filters from. 1678 1677 * @return array Merged user defined values with defaults. 1679 1678 */ … … 1709 1708 1710 1709 /** 1711 * Adds ability to include or exclude specific post_parent ID's 1710 * Adds ability to include or exclude specific post_parent ID's. 1712 1711 * 1713 1712 * @since 2.0.0 bbPress (r2996) … … 1757 1756 1758 1757 /** 1759 * Query the DB and get the last public post_id that has parent_id as post_parent 1758 * Query the DB and get the last public post_id that has parent_id as post_parent. 1760 1759 * 1761 1760 * @since 2.0.0 bbPress (r2868) … … 1764 1763 * @param int $parent_id Parent id. 1765 1764 * @param string $post_type Post type. Defaults to 'post'. 1766 * @return int The last active post_id 1765 * @return int The last active post_id. 1767 1766 */ 1768 1767 function bbp_get_public_child_last_id( $parent_id = 0, $post_type = 'post' ) { … … 1821 1820 1822 1821 /** 1823 * Query the database for child counts, grouped by type & status 1822 * Query the database for child counts, grouped by type & status. 1824 1823 * 1825 1824 * @since 2.6.0 bbPress (r6826) … … 1892 1891 1893 1892 /** 1894 * Filter a list of child counts, from `bbp_get_child_counts()` 1893 * Filter a list of child counts, from `bbp_get_child_counts()`. 1895 1894 * 1896 1895 * @since 2.6.0 bbPress (r6826) 1897 1896 * 1898 * @param int $parent_id ID of post to get child counts from 1899 * @param array $types Optional. An array of post types to filter by 1900 * @param array $statuses Optional. An array of post statuses to filter by 1897 * @param int $parent_id ID of post to get child counts from. 1898 * @param array $types Optional. An array of post types to filter by. 1899 * @param array $statuses Optional. An array of post statuses to filter by. 1901 1900 * 1902 1901 * @return array A list of objects or object fields. … … 1932 1931 1933 1932 /** 1934 * Query the DB and get a count of public children 1933 * Query the DB and get a count of public children. 1935 1934 * 1936 1935 * @since 2.0.0 bbPress (r2868) … … 1939 1938 * @param int $parent_id Parent id. 1940 1939 * @param string $post_type Post type. Defaults to 'post'. 1941 * @return int The number of children 1940 * @return int The number of children. 1942 1941 */ 1943 1942 function bbp_get_public_child_count( $parent_id = 0, $post_type = 'post' ) { … … 1978 1977 } 1979 1978 /** 1980 * Query the DB and get a count of public children 1979 * Query the DB and get a count of public children. 1981 1980 * 1982 1981 * @since 2.0.0 bbPress (r2868) 1983 * @since 2.6.0 bbPress (r5954) Replace direct queries with WP_Query() objects 1982 * @since 2.6.0 bbPress (r5954) Replace direct queries with WP_Query() objects. 1984 1983 * 1985 1984 * @param int $parent_id Parent id. 1986 1985 * @param string $post_type Post type. Defaults to 'post'. 1987 * @return int The number of children 1986 * @return int The number of children. 1988 1987 */ 1989 1988 function bbp_get_non_public_child_count( $parent_id = 0, $post_type = 'post' ) { … … 2029 2028 2030 2029 /** 2031 * Query the DB and get the child id's of public children 2030 * Query the DB and get the child id's of public children. 2032 2031 * 2033 2032 * @since 2.0.0 bbPress (r2868) … … 2037 2036 * @param string $post_type Post type. Defaults to 'post'. 2038 2037 * 2039 * @return array The array of children 2038 * @return array The array of children. 2040 2039 */ 2041 2040 function bbp_get_public_child_ids( $parent_id = 0, $post_type = 'post' ) { … … 2099 2098 2100 2099 /** 2101 * Query the DB and get the child id's of all children 2100 * Query the DB and get the child id's of all children. 2102 2101 * 2103 2102 * @since 2.0.0 bbPress (r3325) 2104 2103 * 2105 * @param int $parent_id Parent id 2106 * @param string $post_type Post type. Defaults to 'post' 2107 * 2108 * @return array The array of children 2104 * @param int $parent_id Parent id. 2105 * @param string $post_type Post type. Defaults to 'post'. 2106 * 2107 * @return array The array of children. 2109 2108 */ 2110 2109 function bbp_get_all_child_ids( $parent_id = 0, $post_type = 'post' ) { … … 2169 2168 * @since 2.6.0 bbPress (r6699) 2170 2169 * 2171 * @param array $objects Array of objects, fresh from a query 2172 * 2173 * @return bool True if some IDs were cached 2170 * @param array $objects Array of objects, fresh from a query. 2171 * 2172 * @return bool True if some IDs were cached. 2174 2173 */ 2175 2174 function bbp_update_post_family_caches( $objects = array() ) { … … 2242 2241 * @since 2.6.0 bbPress (r6699) 2243 2242 * 2244 * @param array $objects Array of objects, fresh from a query 2245 * 2246 * @return bool True if some IDs were cached 2243 * @param array $objects Array of objects, fresh from a query. 2244 * 2245 * @return bool True if some IDs were cached. 2247 2246 */ 2248 2247 function bbp_update_post_author_caches( $objects = array() ) { … … 2287 2286 2288 2287 /** 2289 * Get the unfiltered value of a global $post's key 2290 * 2291 * Used most frequently when editing a forum/topic/reply 2288 * Get the unfiltered value of a global $post's key. 2289 * 2290 * Used most frequently when editing a forum/topic/reply. 2292 2291 * 2293 2292 * @since 2.1.0 bbPress (r3694) 2294 2293 * 2295 * @param string $field Name of the key 2296 * @param string $context How to sanitize - raw|edit|db|display|attribute|js 2297 * @return string Field value 2294 * @param string $field Name of the key. 2295 * @param string $context How to sanitize - raw|edit|db|display|attribute|js. 2296 * @return string Field value. 2298 2297 */ 2299 2298 function bbp_get_global_post_field( $field = 'ID', $context = 'edit' ) { … … 2318 2317 * @since 2.1.0 bbPress (r4022) 2319 2318 * 2320 * @param string $action Action nonce 2321 * @param string $query_arg where to look for nonce in $_REQUEST 2319 * @param string $action Action nonce. 2320 * @param string $query_arg where to look for nonce in $_REQUEST. 2322 2321 */ 2323 2322 function bbp_verify_nonce_request( $action = '', $query_arg = '_wpnonce' ) { … … 2632 2631 2633 2632 /** 2634 * Used to guess if page exists at requested path 2633 * Used to guess if page exists at requested path. 2635 2634 * 2636 2635 * @since 2.0.0 bbPress (r3304) 2637 2636 * 2638 2637 * @param string $path 2639 * @return mixed False if no page, Page object if true 2638 * @return mixed False if no page, Page object if true. 2640 2639 */ 2641 2640 function bbp_get_page_by_path( $path = '' ) { … … 2665 2664 * @since 2.6.0 bbPress (r6583) Use status_header() & nocache_headers() 2666 2665 * 2667 * @param WP_Query $query The query being checked 2668 * 2669 * @return bool Always returns true 2666 * @param WP_Query $query The query being checked. 2667 * 2668 * @return bool Always returns true. 2670 2669 */ 2671 2670 function bbp_set_404( $query = null ) { … … 2694 2693 2695 2694 /** 2696 * Maybe handle the default 404 handling for some bbPress conditions 2695 * Maybe handle the default 404 handling for some bbPress conditions. 2697 2696 * 2698 2697 * Some conditions (like private/hidden forums and edits) have their own checks … … 2701 2700 * @since 2.6.0 bbPress (r6555) 2702 2701 * 2703 * @param bool $override Whether to override the default handler 2704 * @param WP_Query $wp_query The posts query being referenced 2705 * 2706 * @return bool False to leave alone, true to override 2702 * @param bool $override Whether to override the default handler. 2703 * @param WP_Query $wp_query The posts query being referenced. 2704 * 2705 * @return bool False to leave alone, true to override. 2707 2706 */ 2708 2707 function bbp_pre_handle_404( $override = false, $wp_query = false ) { … … 2734 2733 * @since 2.6.0 bbPress (r6580) 2735 2734 * 2736 * @param mixed $posts Default null. Array of posts (possibly empty) 2735 * @param mixed $posts Default null. Array of posts (possibly empty). 2737 2736 * @param WP_Query $wp_query 2738 2737 * -
trunk/src/includes/common/locale.php
r7378 r7380 2 2 3 3 /** 4 * bbPress Localization 4 * bbPress Localization. 5 5 * 6 6 * @package bbPress -
trunk/src/includes/common/locks.php
r7379 r7380 18 18 * @since 2.6.0 bbPress (r6340) 19 19 * 20 * @param int $post_id ID of the post to check for editing 20 * @param int $post_id ID of the post to check for editing. 21 21 * @return integer False: not locked or locked by current user. Int: user ID of user with lock. 22 22 */ … … 54 54 55 55 /** 56 * Mark the post as currently being edited by the current user 56 * Mark the post as currently being edited by the current user. 57 57 * 58 58 * @since 2.6.0 bbPress (r6340) 59 59 * 60 * @param int $post_id ID of the post to being edited 60 * @param int $post_id ID of the post to being edited. 61 61 * @return bool|array Returns false if the post doesn't exist of there is no current user, or 62 62 * an array of the lock time and the user ID. -
trunk/src/includes/common/shortcodes.php
r7378 r7380 22 22 23 23 /** 24 * @var array Shortcode => function 24 * Shortcode => function. 25 * 26 * @var array 25 27 */ 26 28 public $codes = array(); -
trunk/src/includes/common/template.php
r7379 r7380 18 18 * @since 2.1.0 bbPress (r3979) 19 19 * 20 * @param string $path Additional path with leading slash 20 * @param string $path Additional path with leading slash. 21 21 */ 22 22 function bbp_forums_url( $path = '/' ) { … … 29 29 * @since 2.1.0 bbPress (r3979) 30 30 * 31 * @param string $path Additional path with leading slash 31 * @param string $path Additional path with leading slash. 32 32 */ 33 33 function bbp_get_forums_url( $path = '/' ) { … … 40 40 * @since 2.1.0 bbPress (r3979) 41 41 * 42 * @param string $path Additional path with leading slash 42 * @param string $path Additional path with leading slash. 43 43 */ 44 44 function bbp_topics_url( $path = '/' ) { … … 51 51 * @since 2.1.0 bbPress (r3979) 52 52 * 53 * @param string $path Additional path with leading slash 54 * 55 * @return The URL to the topics archive 53 * @param string $path Additional path with leading slash. 54 * 55 * @return The URL to the topics archive. 56 56 */ 57 57 function bbp_get_topics_url( $path = '/' ) { … … 88 88 * @param int $site_id 89 89 * 90 * @return bool True if site is public, false if private 90 * @return bool True if site is public, false if private. 91 91 */ 92 92 function bbp_is_site_public( $site_id = 0 ) { … … 111 111 * @since 2.0.0 bbPress (r2549) 112 112 * 113 * @param int $post_id Possible post_id to check 114 * 115 * @return bool True if it's a forum page, false if not 113 * @param int $post_id Possible post_id to check. 114 * 115 * @return bool True if it's a forum page, false if not. 116 116 */ 117 117 function bbp_is_forum( $post_id = 0 ) { … … 186 186 * @global string $pagenow The filename of the current screen. 187 187 * 188 * @return bool True if it's the forum edit page, false if not 188 * @return bool True if it's the forum edit page, false if not. 189 189 */ 190 190 function bbp_is_forum_edit() { … … 215 215 * @since 2.0.0 bbPress (r2549) 216 216 * 217 * @param int $post_id Possible post_id to check 218 * 219 * @return bool True if it's a topic page, false if not 217 * @param int $post_id Possible post_id to check. 218 * 219 * @return bool True if it's a topic page, false if not. 220 220 */ 221 221 function bbp_is_topic( $post_id = 0 ) { … … 287 287 * @global string $pagenow The filename of the current screen. 288 288 * 289 * @return bool True if it's the topic edit page, false if not 289 * @return bool True if it's the topic edit page, false if not. 290 290 */ 291 291 function bbp_is_topic_edit() { … … 316 316 * @since 2.0.0 bbPress (r2756) 317 317 * 318 * @return bool True if it's the topic merge page, false if not 318 * @return bool True if it's the topic merge page, false if not. 319 319 */ 320 320 function bbp_is_topic_merge() { … … 337 337 * @since 2.0.0 bbPress (r2756) 338 338 * 339 * @return bool True if it's the topic split page, false if not 339 * @return bool True if it's the topic split page, false if not. 340 340 */ 341 341 function bbp_is_topic_split() { … … 358 358 * @since 2.0.0 bbPress (r3311) 359 359 * 360 * @return bool True if it's a topic tag, false if not 360 * @return bool True if it's a topic tag, false if not. 361 361 */ 362 362 function bbp_is_topic_tag() { … … 392 392 * @global string $taxnow The taxonomy of the current screen. 393 393 * 394 * @return bool True if editing a topic tag, false if not 394 * @return bool True if editing a topic tag, false if not. 395 395 */ 396 396 function bbp_is_topic_tag_edit() { … … 455 455 * @since 2.0.0 bbPress (r2549) 456 456 * 457 * @param int $post_id Possible post_id to check 458 * 459 * @return bool True if it's a reply page, false if not 457 * @param int $post_id Possible post_id to check. 458 * 459 * @return bool True if it's a reply page, false if not. 460 460 */ 461 461 function bbp_is_reply( $post_id = 0 ) { … … 480 480 * @global string $pagenow The filename of the current screen. 481 481 * 482 * @return bool True if it's the reply edit page, false if not 482 * @return bool True if it's the reply edit page, false if not. 483 483 */ 484 484 function bbp_is_reply_edit() { … … 507 507 * Check if current page is a reply move page. 508 508 * 509 * @return bool True if it's the reply move page, false if not 509 * @return bool True if it's the reply move page, false if not. 510 510 */ 511 511 function bbp_is_reply_move() { … … 554 554 * @since 2.0.0 bbPress (r2652) 555 555 * 556 * @return bool True if it's the favorites page, false if not 556 * @return bool True if it's the favorites page, false if not. 557 557 */ 558 558 function bbp_is_favorites() { … … 578 578 * @since 2.0.0 bbPress (r2652) 579 579 * 580 * @return bool True if it's the subscriptions page, false if not 580 * @return bool True if it's the subscriptions page, false if not. 581 581 */ 582 582 function bbp_is_subscriptions() { … … 603 603 * @since 2.0.0 bbPress (r2688) 604 604 * 605 * @return bool True if it's the topics created page, false if not 605 * @return bool True if it's the topics created page, false if not. 606 606 */ 607 607 function bbp_is_topics_created() { … … 628 628 * @since 2.2.0 bbPress (r4225) 629 629 * 630 * @return bool True if it's the replies created page, false if not 630 * @return bool True if it's the replies created page, false if not. 631 631 */ 632 632 function bbp_is_replies_created() { … … 652 652 * @since 2.0.0 bbPress (r2688) 653 653 * 654 * @return bool True if it's the user's home, false if not 654 * @return bool True if it's the user's home, false if not. 655 655 */ 656 656 function bbp_is_user_home() { … … 676 676 * @since 2.1.0 bbPress (r3918) 677 677 * 678 * @return bool True if it's the user's home, false if not 678 * @return bool True if it's the user's home, false if not. 679 679 */ 680 680 function bbp_is_user_home_edit() { … … 696 696 * @since 2.0.0 bbPress (r2688) 697 697 * 698 * @return bool True if it's a user's profile page, false if not 698 * @return bool True if it's a user's profile page, false if not. 699 699 */ 700 700 function bbp_is_single_user() { … … 720 720 * @since 2.0.0 bbPress (r2688) 721 721 * 722 * @return bool True if it's a user's profile edit page, false if not 722 * @return bool True if it's a user's profile edit page, false if not. 723 723 */ 724 724 function bbp_is_single_user_edit() { … … 744 744 * @since 2.2.0 bbPress (r4225) 745 745 * 746 * @return bool True if it's a user's profile page, false if not 746 * @return bool True if it's a user's profile page, false if not. 747 747 */ 748 748 function bbp_is_single_user_profile() { … … 768 768 * @since 2.2.0 bbPress (r4225) 769 769 * 770 * @return bool True if it's a user's topics page, false if not 770 * @return bool True if it's a user's topics page, false if not. 771 771 */ 772 772 function bbp_is_single_user_topics() { … … 792 792 * @since 2.2.0 bbPress (r4225) 793 793 * 794 * @return bool True if it's a user's replies page, false if not 794 * @return bool True if it's a user's replies page, false if not. 795 795 */ 796 796 function bbp_is_single_user_replies() { … … 816 816 * @since 2.6.0 bbPress (r6320) 817 817 * 818 * @return bool True if it's a user's replies page, false if not 818 * @return bool True if it's a user's replies page, false if not. 819 819 */ 820 820 function bbp_is_single_user_engagements() { … … 840 840 * @since 2.0.0 bbPress (r2789) 841 841 * 842 * @global WP_Query $wp_query To check if WP_Query::bbp_is_view is true 842 * @global WP_Query $wp_query To check if WP_Query::bbp_is_view is true. 843 843 * 844 844 * @return bool Is it a view page? … … 871 871 * @since 2.3.0 bbPress (r4579) 872 872 * 873 * @global WP_Query $wp_query To check if WP_Query::bbp_is_search is true 873 * @global WP_Query $wp_query To check if WP_Query::bbp_is_search is true. 874 874 * 875 875 * @return bool Is it a search page? … … 915 915 * @since 2.4.0 bbPress (r4919) 916 916 * 917 * @global WP_Query $wp_query To check if WP_Query::bbp_is_search is true 917 * @global WP_Query $wp_query To check if WP_Query::bbp_is_search is true. 918 918 * 919 919 * @return bool Is it a search page? … … 956 956 * @since 2.1.0 bbPress (r3585) 957 957 * 958 * @return bool True if it's the edit page, false if not 958 * @return bool True if it's the edit page, false if not. 959 959 */ 960 960 function bbp_is_edit() { … … 1174 1174 * @since 2.0.0 bbPress (r3344) 1175 1175 * 1176 * @return bool In a bbPress page 1176 * @return bool In a bbPress page. 1177 1177 */ 1178 1178 function is_bbpress() { … … 1312 1312 * @since 2.0.0 bbPress (r2815) 1313 1313 * 1314 * @param string $redirect_to Pass a URL to redirect to 1314 * @param string $redirect_to Pass a URL to redirect to. 1315 1315 */ 1316 1316 function bbp_redirect_to_field( $redirect_to = '' ) { … … 1361 1361 * textarea|password|select|radio|checkbox 1362 1362 * 1363 * @return string Sanitized value ready for screen display 1363 * @return string Sanitized value ready for screen display. 1364 1364 */ 1365 1365 function bbp_get_sanitize_val( $request = '', $input_type = 'text' ) { … … 1405 1405 * 1406 1406 * @param int $auto_increment Optional. Default true. Set to false to prevent 1407 * increment 1407 * increment. 1408 1408 */ 1409 1409 function bbp_tab_index( $auto_increment = true ) { … … 1423 1423 * 1424 1424 * @param int $auto_increment Optional. Default true. Set to false to 1425 * prevent the increment 1426 * 1427 * @return int $bbp->tab_index The global tab index 1425 * prevent the increment. 1426 * 1427 * @return int $bbp->tab_index The global tab index. 1428 1428 */ 1429 1429 function bbp_get_tab_index( $auto_increment = true ) { … … 1448 1448 * @since 2.6.0 bbPress (r6424) 1449 1449 * 1450 * @param mixed $tab False to skip, any integer to use 1450 * @param mixed $tab False to skip, any integer to use. 1451 1451 */ 1452 1452 function bbp_tab_index_attribute( $tab = false ) { … … 1464 1464 * @since 2.6.0 bbPress (r6424) 1465 1465 * 1466 * @param mixed $tab False to skip, any integer to use 1466 * @param mixed $tab False to skip, any integer to use. 1467 1467 * 1468 1468 * @return string … … 1487 1487 * @since 2.0.0 bbPress (r2746) 1488 1488 * 1489 * @param array $args See {@link bbp_get_dropdown()} for arguments 1489 * @param array $args See {@link bbp_get_dropdown()} for arguments. 1490 1490 */ 1491 1491 function bbp_dropdown( $args = array() ) { … … 1797 1797 * Merge topic form fields. 1798 1798 * 1799 * Output the required hidden fields when merging a topic 1799 * Output the required hidden fields when merging a topic. 1800 1800 * 1801 1801 * @since 2.0.0 bbPress (r2756) … … 1813 1813 * Split topic form fields. 1814 1814 * 1815 * Output the required hidden fields when splitting a topic 1815 * Output the required hidden fields when splitting a topic. 1816 1816 * 1817 1817 * @since 2.0.0 bbPress (r2756) … … 1829 1829 * Move reply form fields. 1830 1830 * 1831 * Output the required hidden fields when moving a reply 1831 * Output the required hidden fields when moving a reply. 1832 * 1833 * @since 2.1.0 bbPress (r3586) 1832 1834 */ 1833 1835 function bbp_move_reply_form_fields() { … … 2057 2059 * @since 2.0.0 bbPress (r2789) 2058 2060 * 2059 * @param string $view Optional. View id 2061 * @param string $view Optional. View id. 2060 2062 */ 2061 2063 function bbp_view_id( $view = '' ) { … … 2072 2074 * @param string $view Optional. View id. 2073 2075 * 2074 * @return bool|string ID on success, false on failure 2076 * @return bool|string ID on success, false on failure. 2075 2077 */ 2076 2078 function bbp_get_view_id( $view = '' ) { … … 2099 2101 * @since 2.0.0 bbPress (r2789) 2100 2102 * 2101 * @param string $view Optional. View id 2103 * @param string $view Optional. View id. 2102 2104 */ 2103 2105 function bbp_view_title( $view = '' ) { … … 2113 2115 * @since 2.0.0 bbPress (r2789) 2114 2116 * 2115 * @param string $view Optional. View id 2116 * 2117 * @return bool|string Title on success, false on failure 2117 * @param string $view Optional. View id. 2118 * 2119 * @return bool|string Title on success, false on failure. 2118 2120 */ 2119 2121 function bbp_get_view_title( $view = '' ) { … … 2133 2135 * @since 2.0.0 bbPress (r2789) 2134 2136 * 2135 * @param string $view Optional. View id 2137 * @param string $view Optional. View id. 2136 2138 */ 2137 2139 function bbp_view_url( $view = false ) { … … 2143 2145 * @since 2.0.0 bbPress (r2789) 2144 2146 * 2145 * @param string $view Optional. View id 2146 * used view id 2147 * 2148 * @return string View url (or home url if the view was not found ) 2147 * @param string $view Optional. View id. 2148 * 2149 * @return string View url (or home url if the view was not found). 2149 2150 */ 2150 2151 function bbp_get_view_url( $view = false ) { … … 2183 2184 * @since 2.0.0 bbPress (r2980) 2184 2185 * 2185 * @return bool True if match, false if not 2186 * @return bool True if match, false if not. 2186 2187 */ 2187 2188 function bbp_is_query_name( $name = '' ) { … … 2194 2195 * @since 2.0.0 bbPress (r2695) 2195 2196 * 2196 * @return string To return the query var value 2197 * @return string To return the query var value. 2197 2198 */ 2198 2199 function bbp_get_query_name() { … … 2205 2206 * @since 2.0.0 bbPress (r2692) 2206 2207 * 2207 * @param string $name What to set the query var to 2208 * @param string $name What to set the query var to. 2208 2209 */ 2209 2210 function bbp_set_query_name( $name = '' ) { … … 2245 2246 * @since 2.0.0 bbPress (r2589) 2246 2247 * 2247 * @param string $sep Separator. Defaults to '←' 2248 * @param bool $current_page Include the current item 2249 * @param bool $root Include the root page if one exists 2250 * 2251 * @return string Breadcrumbs 2248 * @param string $sep Separator. Defaults to '←'. 2249 * @param bool $current_page Include the current item. 2250 * @param bool $root Include the root page if one exists. 2251 * 2252 * @return string Breadcrumbs. 2252 2253 */ 2253 2254 function bbp_get_breadcrumb( $args = array() ) { … … 2547 2548 * @since 2.0.0 bbPress (r2780) 2548 2549 * 2549 * @return string HTML allowed tags entity encoded 2550 * @return string HTML allowed tags entity encoded. 2550 2551 */ 2551 2552 function bbp_get_allowed_tags() { … … 2636 2637 * @since 2.0.0 bbPress (r2827) 2637 2638 * 2638 * @param string $redirect_to Redirect to url 2639 * @param string $redirect_to Redirect to url. 2639 2640 */ 2640 2641 function bbp_logout_link( $redirect_to = '' ) { … … 2647 2648 * @since 2.0.0 bbPress (r2827) 2648 2649 * 2649 * @param string $redirect_to Redirect to url 2650 * redirect to url 2651 * 2652 * @return string The logout link 2650 * @param string $redirect_to Redirect to url. 2651 * redirect to url. 2652 * 2653 * @return string The logout link. 2653 2654 */ 2654 2655 function bbp_get_logout_link( $redirect_to = '' ) { … … 2672 2673 * various items within the page title. 2673 2674 * @param string $seplocation Optional. Direction to display title, 'right'. 2674 * separator and separator location 2675 * 2676 * @return string The title 2675 * separator and separator location. 2676 * 2677 * @return string The title. 2677 2678 */ 2678 2679 function bbp_title( $title = '', $sep = '»', $seplocation = '' ) { … … 2886 2887 * @since 2.7.0 2887 2888 * 2888 * @param string $prepend text displayed before a post title 2889 * @param int|WP_Post $post current post object 2889 * @param string $prepend text displayed before a post title. 2890 * @param int|WP_Post $post current post object. 2890 2891 * 2891 2892 * @return string -
trunk/src/includes/common/widgets.php
r7379 r7380 2 2 3 3 /** 4 * bbPress Widgets 4 * bbPress Widgets. 5 5 * 6 6 * Contains the forum list, topic list, reply list and login form widgets. … … 14 14 15 15 /** 16 * bbPress Login Widget 17 * 18 * Adds a widget which displays the login form 16 * bbPress Login Widget. 17 * 18 * Adds a widget which displays the login form. 19 19 * 20 20 * @since 2.0.0 bbPress (r2827) … … 23 23 24 24 /** 25 * bbPress Login Widget 26 * 27 * Registers the login widget 25 * bbPress Login Widget. 26 * 27 * Registers the login widget. 28 28 * 29 29 * @since 2.0.0 bbPress (r2827) … … 43 43 44 44 /** 45 * Register the widget 45 * Register the widget. 46 46 * 47 47 * @since 2.0.0 bbPress (r3389) … … 52 52 53 53 /** 54 * Displays the output, the login form 54 * Displays the output, the login form. 55 55 * 56 56 * @since 2.0.0 bbPress (r2827) 57 57 * 58 * @param array $args Arguments 59 * @param array $instance Instance 58 * @param array $args Arguments. 59 * @param array $instance Instance. 60 60 */ 61 61 public function widget( $args = array(), $instance = array() ) { … … 147 147 148 148 /** 149 * Update the login widget options 149 * Update the login widget options. 150 150 * 151 151 * @since 2.0.0 bbPress (r2827) 152 152 * 153 * @param array $new_instance The new instance options 154 * @param array $old_instance The old instance options 153 * @param array $new_instance The new instance options. 154 * @param array $old_instance The old instance options. 155 155 */ 156 156 public function update( $new_instance, $old_instance ) { … … 164 164 165 165 /** 166 * Output the login widget options form 166 * Output the login widget options form. 167 167 * 168 168 * @since 2.0.0 bbPress (r2827) 169 169 * 170 * @param $instance Instance 170 * @param $instance Instance. 171 171 */ 172 172 public function form( $instance = array() ) { … … 198 198 * @since 2.3.0 bbPress (r4802) 199 199 * 200 * @param $instance Instance 200 * @param $instance Instance. 201 201 */ 202 202 public function parse_settings( $instance = array() ) { … … 214 214 215 215 /** 216 * bbPress Views Widget 217 * 218 * Adds a widget which displays the view list 216 * bbPress Views Widget. 217 * 218 * Adds a widget which displays the view list. 219 219 * 220 220 * @since 2.0.0 bbPress (r3020) … … 223 223 224 224 /** 225 * bbPress View Widget 226 * 227 * Registers the view widget 225 * bbPress View Widget. 226 * 227 * Registers the view widget. 228 228 * 229 229 * @since 2.0.0 bbPress (r3020) … … 243 243 244 244 /** 245 * Register the widget 245 * Register the widget. 246 246 * 247 247 * @since 2.0.0 bbPress (r3389) … … 252 252 253 253 /** 254 * Displays the output, the view list 254 * Displays the output, the view list. 255 255 * 256 256 * @since 2.0.0 bbPress (r3020) 257 257 * 258 * @param array $args Arguments 259 * @param array $instance Instance 258 * @param array $args Arguments. 259 * @param array $instance Instance. 260 260 */ 261 261 public function widget( $args = array(), $instance = array() ) { … … 301 301 302 302 /** 303 * Update the view widget options 303 * Update the view widget options. 304 304 * 305 305 * @since 2.0.0 bbPress (r3020) 306 306 * 307 * @param array $new_instance The new instance options 308 * @param array $old_instance The old instance options 307 * @param array $new_instance The new instance options. 308 * @param array $old_instance The old instance options. 309 309 */ 310 310 public function update( $new_instance = array(), $old_instance = array() ) { … … 316 316 317 317 /** 318 * Output the view widget options form 318 * Output the view widget options form. 319 319 * 320 320 * @since 2.0.0 bbPress (r3020) 321 321 * 322 * @param $instance Instance 322 * @param $instance Instance. 323 323 */ 324 324 public function form( $instance = array() ) { … … 341 341 * @since 2.3.0 bbPress (r4802) 342 342 * 343 * @param $instance Instance 343 * @param $instance Instance. 344 344 */ 345 345 public function parse_settings( $instance = array() ) { … … 355 355 356 356 /** 357 * bbPress Search Widget 358 * 359 * Adds a widget which displays the forum search form 357 * bbPress Search Widget. 358 * 359 * Adds a widget which displays the forum search form. 360 360 * 361 361 * @since 2.3.0 bbPress (r4579) … … 364 364 365 365 /** 366 * bbPress Search Widget 367 * 368 * Registers the search widget 366 * bbPress Search Widget. 367 * 368 * Registers the search widget. 369 369 * 370 370 * @since 2.3.0 bbPress (r4579) … … 384 384 385 385 /** 386 * Register the widget 386 * Register the widget. 387 387 * 388 388 * @since 2.3.0 bbPress (r4579) … … 393 393 394 394 /** 395 * Displays the output, the search form 395 * Displays the output, the search form. 396 396 * 397 397 * @since 2.3.0 bbPress (r4579) … … 425 425 426 426 /** 427 * Update the widget options 427 * Update the widget options. 428 428 * 429 429 * @since 2.3.0 bbPress (r4579) 430 430 * 431 * @param array $new_instance The new instance options 432 * @param array $old_instance The old instance options 431 * @param array $new_instance The new instance options. 432 * @param array $old_instance The old instance options. 433 433 */ 434 434 public function update( $new_instance, $old_instance ) { … … 440 440 441 441 /** 442 * Output the search widget options form 442 * Output the search widget options form. 443 443 * 444 444 * @since 2.3.0 bbPress (r4579) 445 445 * 446 * @param $instance Instance 446 * @param $instance Instance. 447 447 */ 448 448 public function form( $instance ) { … … 465 465 * @since 2.3.0 bbPress (r4802) 466 466 * 467 * @param $instance Instance 467 * @param $instance Instance. 468 468 */ 469 469 public function parse_settings( $instance = array() ) { … … 479 479 480 480 /** 481 * bbPress Forum Widget 482 * 483 * Adds a widget which displays the forum list 481 * bbPress Forum Widget. 482 * 483 * Adds a widget which displays the forum list. 484 484 * 485 485 * @since 2.0.0 bbPress (r2653) … … 488 488 489 489 /** 490 * bbPress Forum Widget 491 * 492 * Registers the forum widget 490 * bbPress Forum Widget. 491 * 492 * Registers the forum widget. 493 493 * 494 494 * @since 2.0.0 bbPress (r2653) … … 508 508 509 509 /** 510 * Register the widget 510 * Register the widget. 511 511 * 512 512 * @since 2.0.0 bbPress (r3389) … … 517 517 518 518 /** 519 * Displays the output, the forum list 519 * Displays the output, the forum list. 520 520 * 521 521 * @since 2.0.0 bbPress (r2653) 522 522 * 523 * @param array $args Arguments 524 * @param array $instance Instance 523 * @param array $args Arguments. 524 * @param array $instance Instance. 525 525 */ 526 526 public function widget( $args, $instance ) { … … 592 592 593 593 /** 594 * Update the forum widget options 594 * Update the forum widget options. 595 595 * 596 596 * @since 2.0.0 bbPress (r2653) 597 597 * 598 * @param array $new_instance The new instance options 599 * @param array $old_instance The old instance options 598 * @param array $new_instance The new instance options. 599 * @param array $old_instance The old instance options. 600 600 */ 601 601 public function update( $new_instance, $old_instance ) { … … 613 613 614 614 /** 615 * Output the forum widget options form 615 * Output the forum widget options form. 616 616 * 617 617 * @since 2.0.0 bbPress (r2653) 618 618 * 619 * @param $instance Instance 619 * @param $instance Instance. 620 620 */ 621 621 public function form( $instance ) { … … 648 648 * @since 2.3.0 bbPress (r4802) 649 649 * 650 * @param $instance Instance 650 * @param $instance Instance. 651 651 */ 652 652 public function parse_settings( $instance = array() ) { … … 663 663 664 664 /** 665 * bbPress Topic Widget 666 * 667 * Adds a widget which displays the topic list 665 * bbPress Topic Widget. 666 * 667 * Adds a widget which displays the topic list. 668 668 * 669 669 * @since 2.0.0 bbPress (r2653) … … 672 672 673 673 /** 674 * bbPress Topic Widget 675 * 676 * Registers the topic widget 674 * bbPress Topic Widget. 675 * 676 * Registers the topic widget. 677 677 * 678 678 * @since 2.0.0 bbPress (r2653) … … 692 692 693 693 /** 694 * Register the widget 694 * Register the widget. 695 695 * 696 696 * @since 2.0.0 bbPress (r3389) … … 701 701 702 702 /** 703 * Displays the output, the topic list 703 * Displays the output, the topic list. 704 704 * 705 705 * @since 2.0.0 bbPress (r2653) … … 876 876 877 877 /** 878 * Update the topic widget options 878 * Update the topic widget options. 879 879 * 880 880 * @since 2.0.0 bbPress (r2653) 881 881 * 882 * @param array $new_instance The new instance options 883 * @param array $old_instance The old instance options 882 * @param array $new_instance The new instance options. 883 * @param array $old_instance The old instance options. 884 884 */ 885 885 public function update( $new_instance = array(), $old_instance = array() ) { … … 909 909 910 910 /** 911 * Output the topic widget options form 911 * Output the topic widget options form. 912 912 * 913 913 * @since 2.0.0 bbPress (r2653) 914 914 * 915 * @param $instance Instance 915 * @param $instance Instance. 916 916 */ 917 917 public function form( $instance = array() ) { … … 953 953 * @since 2.3.0 bbPress (r4802) 954 954 * 955 * @param $instance Instance 955 * @param $instance Instance. 956 956 */ 957 957 public function parse_settings( $instance = array() ) { … … 972 972 973 973 /** 974 * bbPress Statistics Widget 975 * 976 * Adds a widget which displays the forum statistics 974 * bbPress Statistics Widget. 975 * 976 * Adds a widget which displays the forum statistics. 977 977 * 978 978 * @since 2.3.0 bbPress (r4509) … … 981 981 982 982 /** 983 * bbPress Statistics Widget 984 * 985 * Registers the statistics widget 983 * bbPress Statistics Widget. 984 * 985 * Registers the statistics widget. 986 986 * 987 987 * @since 2.3.0 bbPress (r4509) … … 1001 1001 1002 1002 /** 1003 * Register the widget 1003 * Register the widget. 1004 1004 * 1005 1005 * @since 2.3.0 bbPress (r4509) … … 1010 1010 1011 1011 /** 1012 * Displays the output, the statistics 1012 * Displays the output, the statistics. 1013 1013 * 1014 1014 * @since 2.3.0 bbPress (r4509) 1015 1015 * 1016 * @param array $args Arguments 1017 * @param array $instance Instance 1016 * @param array $args Arguments. 1017 * @param array $instance Instance. 1018 1018 */ 1019 1019 public function widget( $args = array(), $instance = array() ) { … … 1040 1040 1041 1041 /** 1042 * Update the statistics widget options 1042 * Update the statistics widget options. 1043 1043 * 1044 1044 * @since 2.3.0 bbPress (r4509) 1045 1045 * 1046 * @param array $new_instance The new instance options 1047 * @param array $old_instance The old instance options 1046 * @param array $new_instance The new instance options. 1047 * @param array $old_instance The old instance options. 1048 1048 * 1049 1049 * @return array … … 1057 1057 1058 1058 /** 1059 * Output the statistics widget options form 1059 * Output the statistics widget options form. 1060 1060 * 1061 1061 * @since 2.3.0 bbPress (r4509) … … 1084 1084 * @since 2.3.0 bbPress (r4802) 1085 1085 * 1086 * @param $instance Instance 1086 * @param $instance Instance. 1087 1087 */ 1088 1088 public function parse_settings( $instance = array() ) { … … 1098 1098 1099 1099 /** 1100 * bbPress Replies Widget 1101 * 1102 * Adds a widget which displays the replies list 1100 * bbPress Replies Widget. 1101 * 1102 * Adds a widget which displays the replies list. 1103 1103 * 1104 1104 * @since 2.0.0 bbPress (r2653) … … 1107 1107 1108 1108 /** 1109 * bbPress Replies Widget 1110 * 1111 * Registers the replies widget 1109 * bbPress Replies Widget. 1110 * 1111 * Registers the replies widget. 1112 1112 * 1113 1113 * @since 2.0.0 bbPress (r2653) … … 1127 1127 1128 1128 /** 1129 * Register the widget 1129 * Register the widget. 1130 1130 * 1131 1131 * @since 2.0.0 bbPress (r3389) … … 1136 1136 1137 1137 /** 1138 * Displays the output, the replies list 1138 * Displays the output, the replies list. 1139 1139 * 1140 1140 * @since 2.0.0 bbPress (r2653) … … 1254 1254 1255 1255 /** 1256 * Update the reply widget options 1256 * Update the reply widget options. 1257 1257 * 1258 1258 * @since 2.0.0 bbPress (r2653) 1259 1259 * 1260 * @param array $new_instance The new instance options 1261 * @param array $old_instance The old instance options 1260 * @param array $new_instance The new instance options. 1261 * @param array $old_instance The old instance options. 1262 1262 */ 1263 1263 public function update( $new_instance = array(), $old_instance = array() ) { … … 1280 1280 1281 1281 /** 1282 * Output the reply widget options form 1282 * Output the reply widget options form. 1283 1283 * 1284 1284 * @since 2.0.0 bbPress (r2653) 1285 1285 * 1286 * @param $instance Instance 1286 * @param $instance Instance. 1287 1287 */ 1288 1288 public function form( $instance = array() ) { … … 1304 1304 * @since 2.3.0 bbPress (r4802) 1305 1305 * 1306 * @param $instance Instance 1306 * @param $instance Instance. 1307 1307 */ 1308 1308 public function parse_settings( $instance = array() ) { -
trunk/src/includes/core/abstraction.php
r7378 r7380 2 2 3 3 /** 4 * bbPress Abstractions 4 * bbPress Abstractions. 5 5 * 6 6 * This file contains functions for abstracting WordPress core functionality … … 18 18 19 19 /** 20 * Setup Admin 20 * Setup Admin. 21 21 * 22 22 * This exists outside of "/includes/admin/" because the converter may need to … … 46 46 47 47 /** 48 * Setup Converter 48 * Setup Converter. 49 49 * 50 50 * This exists outside of "/includes/admin/" because the converter may need to … … 79 79 80 80 /** 81 * Lookup and return a global variable 81 * Lookup and return a global variable. 82 82 * 83 83 * @since 2.5.8 bbPress (r5814) 84 84 * 85 * @param string $name Name of global variable 86 * @param string $type Type of variable to check with `is_a()` 87 * @param mixed $default Default value to return if no global found 88 * 89 * @return mixed Verified object if valid, Default or null if invalid 85 * @param string $name Name of global variable. 86 * @param string $type Type of variable to check with `is_a()`. 87 * @param mixed $default Default value to return if no global found. 88 * 89 * @return mixed Verified object if valid, Default or null if invalid. 90 90 */ 91 91 function bbp_get_global_object( $name = '', $type = '', $default = null ) { … … 113 113 114 114 /** 115 * Get the `$wp_query` global without needing to declare it everywhere 115 * Get the `$wp_query` global without needing to declare it everywhere. 116 116 * 117 117 * @since 2.6.0 bbPress (r6582) … … 124 124 125 125 /** 126 * Get the `$wp_roles` global without needing to declare it everywhere 126 * Get the `$wp_roles` global without needing to declare it everywhere. 127 127 * 128 128 * @since 2.2.0 bbPress (r4293) … … 174 174 175 175 /** 176 * Get the root URL 176 * Get the root URL. 177 177 * 178 178 * @since 2.5.8 bbPress (r5814) … … 196 196 197 197 /** 198 * Get the slug used for paginated requests 198 * Get the slug used for paginated requests. 199 199 * 200 200 * @since 2.4.0 bbPress (r4926) … … 222 222 * @since 2.5.8 bbPress (r5814) 223 223 * 224 * @global object $wp_rewrite The WP_Rewrite object 224 * @global object $wp_rewrite The WP_Rewrite object. 225 225 * 226 226 * @return bool … … 251 251 * @since 2.6.0 bbPress (r6678) 252 252 * 253 * @param string $pagination_links The HTML links used for pagination 253 * @param string $pagination_links The HTML links used for pagination. 254 254 * 255 255 * @return string … … 320 320 321 321 /** 322 * Parse the WordPress core version number 322 * Parse the WordPress core version number. 323 323 * 324 324 * @since 2.6.0 bbPress (r6051) … … 341 341 * @since 2.6.0 bbPress (r6242) 342 342 * 343 * @return bool True if more than 10000 users, false not 343 * @return bool True if more than 10000 users, false not. 344 344 */ 345 345 function bbp_is_large_install() { … … 355 355 356 356 /** 357 * Get the total number of users on the forums 357 * Get the total number of users on the forums. 358 358 * 359 359 * @since 2.0.0 bbPress (r2769) 360 360 * 361 * @return int Total number of users 361 * @return int Total number of users. 362 362 */ 363 363 function bbp_get_total_users() { … … 408 408 * @since 2.6.0 409 409 * 410 * @staticvar mixed $rand Null by default, random string on first call 410 * @staticvar mixed $rand Null by default, random string on first call. 411 411 * 412 412 * @return string … … 437 437 438 438 /** 439 * Whether a value has been intercepted 439 * Whether a value has been intercepted. 440 440 * 441 441 * @since 2.6.0 … … 452 452 * @since 2.6.0 453 453 * 454 * @param string $action Typically the name of the caller function 455 * @param array $args Typically the results of caller function func_get_args() 454 * @param string $action Typically the name of the caller function. 455 * @param array $args Typically the results of caller function func_get_args(). 456 456 * 457 457 * @return mixed Intercept results. Default bbp_default_intercept(). -
trunk/src/includes/core/actions.php
r7376 r7380 2 2 3 3 /** 4 * bbPress Actions 4 * bbPress Actions. 5 5 * 6 6 * This file contains the actions that are used through-out bbPress. They are … … 23 23 24 24 /** 25 * Attach bbPress to WordPress 25 * Attach bbPress to WordPress. 26 26 * 27 27 * bbPress uses its own internal actions to help aid in third-party plugin … … 57 57 58 58 /** 59 * bbp_loaded - Attached to 'plugins_loaded' above 59 * bbp_loaded - Attached to 'plugins_loaded' above. 60 60 * 61 61 * Attach various loader actions to the bbp_loaded action. … … 72 72 73 73 /** 74 * bbp_init - Attached to 'init' above 74 * bbp_init - Attached to 'init' above. 75 75 * 76 76 * Attach various initialization actions to the init action. … … 87 87 88 88 /** 89 * bbp_setup_theme - Attached to 'setup_theme' above 89 * bbp_setup_theme - Attached to 'setup_theme' above. 90 90 * 91 91 * Attach various theme related actions to the setup_theme action. … … 96 96 97 97 /** 98 * bbp_roles_init - Attached to 'wp_roles_init' above 98 * bbp_roles_init - Attached to 'wp_roles_init' above. 99 99 * 100 100 * Attach various role related actions to the wp_roles_init action. … … 113 113 114 114 /** 115 * bbp_register - Attached to 'init' above on 0 priority 115 * bbp_register - Attached to 'init' above on 0 priority. 116 116 * 117 117 * Attach various initialization actions early to the init action. … … 135 135 136 136 /** 137 * bbp_ready - attached to end 'bbp_init' above 137 * bbp_ready - attached to end 'bbp_init' above. 138 138 * 139 139 * Attach actions to the ready action after bbPress has fully initialized. -
trunk/src/includes/core/cache.php
r6585 r7380 2 2 3 3 /** 4 * bbPress Cache Helpers 4 * bbPress Cache Helpers. 5 5 * 6 6 * Helper functions used to communicate with WordPress's various caches. Many … … 34 34 35 35 /** 36 * @var int Post ID being updated 36 * @var int Post ID being updated. 37 37 */ 38 38 private $updating_post = 0; 39 39 40 40 /** 41 * @var bool The original value of $_wp_suspend_cache_invalidation global 41 * @var bool The original value of $_wp_suspend_cache_invalidation global. 42 42 */ 43 43 private $original_cache_invalidation = false; … … 63 63 * @since 2.1.0 bbPress (r4011) 64 64 * 65 * @param int $post_id The post ID being updated 66 * @return If invalid post data 65 * @param int $post_id The post ID being updated. 67 66 */ 68 67 public function pre_post_update( $post_id = 0 ) { … … 87 86 * @since 2.1.0 bbPress (r4011) 88 87 * 89 * @param int $post_id The post ID of the cache being invalidated 90 * @return If invalid post data 88 * @param int $post_id The post ID of the cache being invalidated. 91 89 */ 92 90 public function skip_related_posts( $post_id = 0 ) { -
trunk/src/includes/core/capabilities.php
r7378 r7380 2 2 3 3 /** 4 * bbPress Capabilit es4 * bbPress Capabilities. 5 5 * 6 6 * The functions in this file are used primarily as convenient wrappers for … … 22 22 * @since 2.0.0 bbPress (r2994) 23 23 * 24 * @todo Map all of these and deprecate 25 * 26 * @param string $role Optional. Defaults to The role to load caps for 27 * 28 * @return array Capabilities for $role 24 * @todo Map all of these and deprecate. 25 * 26 * @param string $role Optional. Defaults to The role to load caps for. 27 * 28 * @return array Capabilities for $role. 29 29 */ 30 30 function bbp_get_caps_for_role( $role = '' ) { … … 246 246 247 247 /** 248 * Get the available roles, minus the dynamic roles that come with bbPress 248 * Get the available roles, minus the dynamic roles that come with bbPress. 249 249 * 250 250 * @since 2.4.0 bbPress (r5064) … … 280 280 * @since 2.2.0 bbPress (r4290) 281 281 * 282 * @param WP_Roles $wp_roles The array of WP_Role objects that was initialized 283 * 284 * @return WP_Roles The main $wp_roles global 282 * @param WP_Roles $wp_roles The array of WP_Role objects that was initialized. 283 * 284 * @return WP_Roles The main $wp_roles global. 285 285 */ 286 286 function bbp_add_forums_roles( $wp_roles = null ) { … … 311 311 312 312 /** 313 * Helper function to add filter to option_wp_user_roles 313 * Helper function to add filter to option_wp_user_roles. 314 314 * 315 315 * @since 2.2.0 bbPress (r4363) … … 343 343 * @deprecated 2.6.0 bbPress (r6105) 344 344 * 345 * @internal Used by bbPress to reinitialize dynamic roles on blog switch 345 * @internal Used by bbPress to reinitialize dynamic roles on blog switch. 346 346 * 347 347 * @param array $roles 348 * @return array Combined array of database roles and dynamic bbPress roles 348 * @return array Combined array of database roles and dynamic bbPress roles. 349 349 */ 350 350 function _bbp_reinit_dynamic_roles( $roles = array() ) { … … 389 389 390 390 /** 391 * Gets a translated role name from a role ID 391 * Gets a translated role name from a role ID. 392 392 * 393 393 * @since 2.3.0 bbPress (r4792) … … 395 395 * 396 396 * @param string $role_id 397 * @return string Translated role name 397 * @return string Translated role name. 398 398 */ 399 399 function bbp_get_dynamic_role_name( $role_id = '' ) { … … 408 408 409 409 /** 410 * Removes the bbPress roles from the editable roles array 410 * Removes the bbPress roles from the editable roles array. 411 411 * 412 412 * This used to use array_diff_assoc() but it randomly broke before 2.2 release. … … 415 415 * @since 2.2.0 bbPress (r4303) 416 416 * 417 * @param array $all_roles All registered roles 417 * @param array $all_roles All registered roles. 418 418 * @return array 419 419 */ … … 437 437 438 438 /** 439 * The keymaster role for bbPress users 439 * The keymaster role for bbPress users. 440 440 * 441 441 * @since 2.2.0 bbPress (r4284) … … 450 450 451 451 /** 452 * The moderator role for bbPress users 452 * The moderator role for bbPress users. 453 453 * 454 454 * @since 2.0.0 bbPress (r3410) … … 463 463 464 464 /** 465 * The participant role for registered user that can participate in forums 465 * The participant role for registered user that can participate in forums. 466 466 * 467 467 * @since 2.0.0 bbPress (r3410) … … 476 476 477 477 /** 478 * The spectator role is for registered users without any capabilities 478 * The spectator role is for registered users without any capabilities. 479 479 * 480 480 * @since 2.1.0 bbPress (r3860) … … 489 489 490 490 /** 491 * The blocked role is for registered users that cannot spectate or participate 491 * The blocked role is for registered users that cannot spectate or participate. 492 492 * 493 493 * @since 2.2.0 bbPress (r4284) -
trunk/src/includes/core/extend.php
r6284 r7380 2 2 3 3 /** 4 * bbPress Exten tions4 * bbPress Extensions. 5 5 * 6 6 * There's a world of really cool plugins out there, and bbPress comes with … … 15 15 16 16 /** 17 * Loads Akismet inside the bbPress global class 17 * Loads Akismet inside the bbPress global class. 18 18 * 19 19 * @since 2.0.0 bbPress (r3277) 20 20 * 21 * @return If bbPress is not active 21 * @return If bbPress is not active. 22 22 */ 23 23 function bbp_setup_akismet() { … … 42 42 /** 43 43 * Requires and creates the BuddyPress extension, and adds component creation 44 * action to bp_init hook. @see bbp_setup_buddypress_component() 44 * action to bp_init hook. @see bbp_setup_buddypress_component(). 45 45 * 46 46 * @since 2.0.0 bbPress (r3395) 47 47 * 48 * @return If BuddyPress is not active 48 * @return If BuddyPress is not active. 49 49 */ 50 50 function bbp_setup_buddypress() { -
trunk/src/includes/core/filters.php
r7378 r7380 377 377 378 378 /** 379 * Deprecated locale filter 379 * Deprecated locale filter. 380 380 * 381 381 * @since 2.2.0 bbPress (r4213) 382 382 * 383 383 * @param string $locale 384 * @return string $domain384 * @return string $domain 385 385 */ 386 386 function _bbp_filter_locale( $locale = '', $domain = '' ) { … … 396 396 397 397 /** 398 * Deprecated forums query filter 398 * Deprecated forums query filter. 399 399 * 400 400 * @since 2.1.0 bbPress (r3961) … … 411 411 412 412 /** 413 * Deprecated topics query filter 413 * Deprecated topics query filter. 414 414 * 415 415 * @since 2.1.0 bbPress (r3961) … … 426 426 427 427 /** 428 * Deprecated replies query filter 428 * Deprecated replies query filter. 429 429 * 430 430 * @since 2.1.0 bbPress (r3961) -
trunk/src/includes/core/functions.php
r7190 r7380 2 2 3 3 /** 4 * bbPress Core Functions 4 * bbPress Core Functions. 5 5 * 6 6 * @package bbPress … … 14 14 15 15 /** 16 * Output the bbPress version 16 * Output the bbPress version. 17 17 * 18 18 * @since 2.0.0 bbPress (r3468) … … 21 21 echo bbp_get_version(); 22 22 } 23 /** 24 * Return the bbPress version 25 * 26 * @since 2.0.0 bbPress (r3468) 27 * 28 * @retrun string The bbPress version 29 */ 30 function bbp_get_version() { 31 return bbpress()->version; 32 } 33 34 /** 35 * Output the bbPress asset version 23 24 /** 25 * Return the bbPress version. 26 * 27 * @since 2.0.0 bbPress (r3468) 28 * 29 * @return string The bbPress version. 30 */ 31 function bbp_get_version() { 32 return bbpress()->version; 33 } 34 35 /** 36 * Output the bbPress asset version. 36 37 * 37 38 * @since 2.6.7 bbPress (r7188) … … 40 41 echo bbp_get_asset_version(); 41 42 } 42 /** 43 * Return the bbPress asset version 44 * 45 * @since 2.6.7 bbPress (r7188) 46 * 47 * @retrun string The bbPress asset version 48 */ 49 function bbp_get_asset_version() { 50 return bbp_doing_script_debug() 51 ? (string) time() 52 : bbp_get_version(); 53 } 54 55 /** 56 * Output the bbPress database version 43 44 /** 45 * Return the bbPress asset version. 46 * 47 * @since 2.6.7 bbPress (r7188) 48 * 49 * @return string The bbPress asset version. 50 */ 51 function bbp_get_asset_version() { 52 return bbp_doing_script_debug() 53 ? (string) time() 54 : bbp_get_version(); 55 } 56 57 /** 58 * Output the bbPress database version. 57 59 * 58 60 * @since 2.0.0 bbPress (r3468) … … 61 63 echo bbp_get_db_version(); 62 64 } 63 /** 64 * Return the bbPress database version 65 * 66 * @since 2.0.0 bbPress (r3468) 67 * 68 * @retrun string The bbPress version 69 */ 70 function bbp_get_db_version() { 71 return bbpress()->db_version; 72 } 73 74 /** 75 * Output the bbPress database version directly from the database 65 66 /** 67 * Return the bbPress database version. 68 * 69 * @since 2.0.0 bbPress (r3468) 70 * 71 * @return string The bbPress version. 72 */ 73 function bbp_get_db_version() { 74 return bbpress()->db_version; 75 } 76 77 /** 78 * Output the bbPress database version directly from the database. 76 79 * 77 80 * @since 2.0.0 bbPress (r3468) … … 80 83 echo bbp_get_db_version_raw(); 81 84 } 82 /** 83 * Return the bbPress database version directly from the database 84 * 85 * @since 2.0.0 bbPress (r3468) 86 * 87 * @retrun string The current bbPress version 88 */ 89 function bbp_get_db_version_raw() { 90 return get_option( '_bbp_db_version', '' ); 91 } 85 86 /** 87 * Return the bbPress database version directly from the database. 88 * 89 * @since 2.0.0 bbPress (r3468) 90 * 91 * @return string The current bbPress version. 92 */ 93 function bbp_get_db_version_raw() { 94 return get_option( '_bbp_db_version', '' ); 95 } 92 96 93 97 /** Post Meta *****************************************************************/ 94 98 95 99 /** 96 * Update the forum meta ID of a post 100 * Update the forum meta ID of a post. 97 101 * 98 102 * @since 2.0.0 bbPress (r3181) 99 103 * 100 * @param int $post_id The post to update 101 * @param int $forum_id The forum 104 * @param int $post_id The post to update. 105 * @param int $forum_id The forum id. 102 106 */ 103 107 function bbp_update_forum_id( $post_id = 0, $forum_id = 0 ) { … … 113 117 114 118 /** 115 * Update the topic meta ID of a post 119 * Update the topic meta ID of a post. 116 120 * 117 121 * @since 2.0.0 bbPress (r3181) 118 122 * 119 * @param int $post_id The post to update 120 * @param int $topic_id The topic 123 * @param int $post_id The post to update. 124 * @param int $topic_id The topic id. 121 125 */ 122 126 function bbp_update_topic_id( $post_id = 0, $topic_id = 0 ) { … … 132 136 133 137 /** 134 * Update the reply meta ID of a post 138 * Update the reply meta ID of a post. 135 139 * 136 140 * @since 2.0.0 bbPress (r3181) 137 141 * 138 * @param int $post_id The post to update 139 * @param int $reply_id The reply 142 * @param int $post_id The post to update. 143 * @param int $reply_id The reply id. 140 144 */ 141 145 function bbp_update_reply_id( $post_id = 0, $reply_id = 0 ) { … … 151 155 152 156 /** 153 * Update the reply-to meta ID of a post 157 * Update the reply-to meta ID of a post. 154 158 * 155 159 * @since 2.6.0 bbPress (r5735) 156 160 * 157 * @param int $post_id The post to update 158 * @param int $reply_id The reply ID161 * @param int $post_id The post to update. 162 * @param int $reply_id The reply id. 159 163 */ 160 164 function bbp_update_reply_to_id( $post_id = 0, $reply_id = 0 ) { … … 172 176 173 177 /** 174 * Get the registered views 175 * 176 * Does nothing much other than return the {@link $bbp->views} variable 178 * Get the registered views. 179 * 180 * Does nothing much other than return the {@link $bbp->views} variable. 177 181 * 178 182 * @since 2.0.0 bbPress (r2789) 179 183 * 180 * @return array Views 184 * @return array Views. 181 185 */ 182 186 function bbp_get_views() { … … 185 189 186 190 /** 187 * Register a bbPress view 191 * Register a bbPress view. 188 192 * 189 193 * @since 2.0.0 bbPress (r2789) 190 194 * 191 * @param string $view View name 192 * @param string $title View title 195 * @param string $view View name. 196 * @param string $title View title. 193 197 * @param mixed $query_args {@link bbp_has_topics()} arguments. 194 198 * @param bool $feed Have a feed for the view? Defaults to true. 195 * @param string $capability Capability that the current user must have 196 * 197 * @return array The just registered (but processed) view 199 * @param string $capability Capability that the current user must have. 200 * 201 * @return array The just registered (but processed) view. 198 202 */ 199 203 function bbp_register_view( $view, $title, $query_args = '', $feed = true, $capability = '' ) { … … 229 233 230 234 /** 231 * Deregister a bbPress view 235 * Deregister a bbPress view. 232 236 * 233 237 * @since 2.0.0 bbPress (r2789) 234 238 * 235 * @param string $view View name 236 * @return bool False if the view doesn't exist, true on success 239 * @param string $view View name. 240 * 241 * @return bool False if the view doesn't exist, true on success. 237 242 */ 238 243 function bbp_deregister_view( $view ) { … … 250 255 251 256 /** 252 * Run the query of a topic-view 257 * Run the query of a topic-view. 253 258 * 254 259 * @since 2.0.0 bbPress (r2789) 255 260 * 256 * @param string $view Optional. View id 261 * @param string $view Optional. View id. 257 262 * @param mixed $new_args New arguments. See {@link bbp_has_topics()} 258 * @return bool False if the view doesn't exist, otherwise if topics are there 263 * 264 * @return bool False if the view doesn't exist, otherwise if topics are there. 259 265 */ 260 266 function bbp_view_query( $view = '', $new_args = '' ) { … … 277 283 278 284 /** 279 * Return the query arguments of a topic-view 285 * Return the query arguments of a topic-view. 280 286 * 281 287 * @since 2.0.0 bbPress (r2789) 282 288 * 283 * @param string $view View name 284 * @return array Query arguments 289 * @param string $view View name. 290 * 291 * @return array Query arguments. 285 292 */ 286 293 function bbp_get_view_query_args( $view = '' ) { … … 298 305 299 306 /** 300 * Adds an error message to later be output in the theme 307 * Adds an error message to later be output in the theme. 301 308 * 302 309 * @since 2.0.0 bbPress (r3381) … … 304 311 * @see WP_Error() 305 312 * 306 * @param string $code Unique code for the error message 307 * @param string $message Translated error message 308 * @param string $data Any additional data passed with the error message 313 * @param string $code Unique code for the error message. 314 * @param string $message Translated error message. 315 * @param string $data Any additional data passed with the error message. 309 316 */ 310 317 function bbp_add_error( $code = '', $message = '', $data = '' ) { … … 313 320 314 321 /** 315 * Check if error messages exist in queue 322 * Check if error messages exist in queue. 316 323 * 317 324 * @since 2.0.0 bbPress (r3381) … … 338 345 * @deprecated 2.6.0 bbp_make_clickable() 339 346 * 340 * @return string Pattern to match usernames with 347 * @return string Pattern to match usernames with. 341 348 */ 342 349 function bbp_find_mentions_pattern() { … … 352 359 * @deprecated 2.6.0 bbp_make_clickable() 353 360 * 354 * @param string $content The content 361 * @param string $content The content. 362 * 355 363 * @return bool|array $usernames Existing usernames. False if no matches. 356 364 */ … … 370 378 371 379 /** 372 * Finds and links @-mentioned users in the content 380 * Finds and links @-mentioned users in the content. 373 381 * 374 382 * @since 2.2.0 bbPress (r4323) 375 383 * @deprecated 2.6.0 bbp_make_clickable() 376 384 * 377 * @return string $content Content filtered for mentions 385 * @return string $content Content filtered for mentions. 378 386 */ 379 387 function bbp_mention_filter( $content = '' ) { … … 411 419 412 420 /** 413 * Return the public post status ID 421 * Return the public post status ID. 414 422 * 415 423 * @since 2.0.0 bbPress (r3504) … … 422 430 423 431 /** 424 * Return the pending post status ID 432 * Return the pending post status ID. 425 433 * 426 434 * @since 2.1.0 bbPress (r3581) … … 433 441 434 442 /** 435 * Return the private post status ID 443 * Return the private post status ID. 436 444 * 437 445 * @since 2.0.0 bbPress (r3504) … … 444 452 445 453 /** 446 * Return the hidden post status ID 454 * Return the hidden post status ID. 447 455 * 448 456 * @since 2.0.0 bbPress (r3504) … … 455 463 456 464 /** 457 * Return the closed post status ID 465 * Return the closed post status ID. 458 466 * 459 467 * @since 2.0.0 bbPress (r3504) … … 466 474 467 475 /** 468 * Return the spam post status ID 476 * Return the spam post status ID. 469 477 * 470 478 * @since 2.0.0 bbPress (r3504) … … 477 485 478 486 /** 479 * Return the trash post status ID 487 * Return the trash post status ID. 480 488 * 481 489 * @since 2.0.0 bbPress (r3504) … … 488 496 489 497 /** 490 * Return the orphan post status ID 498 * Return the orphan post status ID. 491 499 * 492 500 * @since 2.0.0 bbPress (r3504) … … 501 509 502 510 /** 503 * Return the unique ID for user profile rewrite rules 511 * Return the unique ID for user profile rewrite rules. 504 512 * 505 513 * @since 2.1.0 bbPress (r3762) … … 523 531 524 532 /** 525 * Return the unique ID for all search rewrite rules 533 * Return the unique ID for all search rewrite rules. 526 534 * 527 535 * @since 2.3.0 bbPress (r4579) … … 534 542 535 543 /** 536 * Return the unique ID for user topics rewrite rules 544 * Return the unique ID for user topics rewrite rules. 537 545 * 538 546 * @since 2.2.0 bbPress (r4321) … … 545 553 546 554 /** 547 * Return the unique ID for user replies rewrite rules 555 * Return the unique ID for user replies rewrite rules. 548 556 * 549 557 * @since 2.2.0 bbPress (r4321) … … 556 564 557 565 /** 558 * Return the unique ID for user favorites rewrite rules 566 * Return the unique ID for user favorites rewrite rules. 559 567 * 560 568 * @since 2.2.0 bbPress (r4181) … … 567 575 568 576 /** 569 * Return the unique ID for user subscriptions rewrite rules 577 * Return the unique ID for user subscriptions rewrite rules. 570 578 * 571 579 * @since 2.2.0 bbPress (r4181) … … 578 586 579 587 /** 580 * Return the unique ID for user engagement rewrite rules 588 * Return the unique ID for user engagement rewrite rules. 581 589 * 582 590 * @since 2.6.0 bbPress (r6320) … … 589 597 590 598 /** 591 * Return the unique ID for topic view rewrite rules 599 * Return the unique ID for topic view rewrite rules. 592 600 * 593 601 * @since 2.1.0 bbPress (r3762) … … 602 610 603 611 /** 604 * Get the id used for paginated requests 612 * Get the id used for paginated requests. 605 613 * 606 614 * @since 2.4.0 bbPress (r4926) … … 625 633 626 634 /** 627 * Return true|false if this is a POST request 635 * Return true|false if this is a POST request. 628 636 * 629 637 * @since 2.3.0 bbPress (r4790) … … 636 644 637 645 /** 638 * Return true|false if this is a GET request 646 * Return true|false if this is a GET request. 639 647 * 640 648 * @since 2.3.0 bbPress (r4790) … … 649 657 650 658 /** 651 * Perform a safe, local redirect somewhere inside the current site 659 * Perform a safe, local redirect somewhere inside the current site. 652 660 * 653 661 * On some setups, passing the value of wp_get_referer() may result in an empty … … 681 689 682 690 /** 683 * Return if debugging scripts or not 691 * Return if debugging scripts or not. 684 692 * 685 693 * @since 2.6.7 (r7188) … … 692 700 693 701 /** 694 * Return if auto-saving or not 702 * Return if auto-saving or not. 695 703 * 696 704 * @since 2.6.7 (r7188) -
trunk/src/includes/core/options.php
r6967 r7380 2 2 3 3 /** 4 * bbPress Options 4 * bbPress Options. 5 5 * 6 6 * @package bbPress … … 18 18 * @since 2.0.0 bbPress (r3421) 19 19 * 20 * @return array Filtered option names and values 20 * @return array Filtered option names and values. 21 21 */ 22 22 function bbp_get_default_options() { … … 156 156 157 157 /** 158 * Add default options 158 * Add default options. 159 159 * 160 160 * Hooked to bbp_activate, it is only called once when bbPress is activated. … … 175 175 176 176 /** 177 * Delete default options 177 * Delete default options. 178 178 * 179 179 * Hooked to bbp_uninstall, it is only called once when bbPress is uninstalled. … … 219 219 * @access private 220 220 * 221 * @param bool $value Default value false 222 * @param string $option Name of the option 223 * 224 * @return mixed false if not overloaded, mixed if set 221 * @param bool $value Default value false. 222 * @param string $option Name of the option. 223 * 224 * @return mixed false if not overloaded, mixed if set. 225 225 */ 226 226 function bbp_filter_pre_get_option( $value = false, $option = '' ) { … … 243 243 * @access private 244 244 * 245 * @param bool $value Optional. Default value false 246 * @return mixed false if not overloaded, mixed if set 245 * @param bool $value Optional. Default value false. 246 * @return mixed false if not overloaded, mixed if set. 247 247 */ 248 248 function bbp_filter_default_option( $default = false, $option = '', $passed_default = false ) { … … 328 328 * @since 2.0.0 bbPress (r2658) 329 329 * 330 * @param bool $default Optional.Default value true 331 * @return bool Is favorites enabled or not 330 * @param bool $default Optional.Default value true. 331 * @return bool Is favorites enabled or not. 332 332 */ 333 333 function bbp_is_favorites_active( $default = 1 ) { … … 342 342 * @since 2.0.0 bbPress (r2658) 343 343 * 344 * @param bool $default Optional.Default value true 345 * @return bool Is subscription enabled or not 344 * @param bool $default Optional.Default value true. 345 * @return bool Is subscription enabled or not. 346 346 */ 347 347 function bbp_is_subscriptions_active( $default = 1 ) { … … 356 356 * @since 2.6.0 bbPress (r6320) 357 357 * 358 * @param bool $default Optional.Default value true 359 * @return bool Is engagements enabled or not 358 * @param bool $default Optional.Default value true. 359 * @return bool Is engagements enabled or not. 360 360 */ 361 361 function bbp_is_engagements_active( $default = 1 ) { … … 370 370 * @since 2.6.0 bbPress (r6441) 371 371 * 372 * @param bool $default Optional. Default value false 372 * @param bool $default Optional. Default value false. 373 373 * @return bool Is content editing allowed? 374 374 */ … … 384 384 * @since 2.6.0 bbPress (r6441) 385 385 * 386 * @param bool $default Optional. Default value false 386 * @param bool $default Optional. Default value false. 387 387 * @return bool Is content throttling allowed? 388 388 */ … … 394 394 395 395 /** 396 * Are topic tags allowed 396 * Are topic tags allowed. 397 397 * 398 398 * @since 2.2.0 bbPress (r4097) 399 399 * 400 * @param bool $default Optional. Default value true 400 * @param bool $default Optional. Default value true. 401 401 * @return bool Are tags allowed? 402 402 */ … … 408 408 409 409 /** 410 * Are per-forum moderators allowed 410 * Are per-forum moderators allowed. 411 411 * 412 412 * @since 2.6.0 bbPress (r5834) … … 423 423 424 424 /** 425 * Are moderators allowed to edit users 425 * Are moderators allowed to edit users. 426 426 * 427 427 * @since 2.6.0 bbPress (r6562) … … 438 438 439 439 /** 440 * Is forum-wide searching allowed 440 * Is forum-wide searching allowed. 441 441 * 442 442 * @since 2.4.0 bbPress (r4970) 443 443 * 444 * @param bool $default Optional. Default value true 444 * @param bool $default Optional. Default value true. 445 445 * @return bool Is forum-wide searching allowed? 446 446 */ … … 452 452 453 453 /** 454 * Are threaded replies allowed 454 * Are threaded replies allowed. 455 455 * 456 456 * @since 2.4.0 bbPress (r4964) 457 457 * 458 * @param bool $default Optional. Default value false 458 * @param bool $default Optional. Default value false. 459 459 * @return bool Are threaded replies allowed? 460 460 */ … … 466 466 467 467 /** 468 * Maximum reply thread depth 468 * Maximum reply thread depth. 469 469 * 470 470 * @since 2.4.0 bbPress (r4944) 471 471 * 472 * @param int $default Thread replies depth 473 * @return int Thread replies depth 472 * @param int $default Thread replies depth. 473 * @return int Thread replies depth. 474 474 */ 475 475 function bbp_thread_replies_depth( $default = 2 ) { … … 480 480 481 481 /** 482 * Are topic and reply revisions allowed 482 * Are topic and reply revisions allowed. 483 483 * 484 484 * @since 2.0.0 bbPress (r3412) 485 485 * 486 * @param bool $default Optional. Default value true 486 * @param bool $default Optional. Default value true. 487 487 * @return bool Are revisions allowed? 488 488 */ … … 498 498 * @since 2.0.0 bbPress (r2659) 499 499 * 500 * @param bool $default Optional. Default value 500 * @param bool $default Optional. Default value. 501 501 * @return bool Is anonymous posting allowed? 502 502 */ … … 512 512 * @since 2.0.0 bbPress (r3378) 513 513 * 514 * @param bool $default Optional. Default value false 514 * @param bool $default Optional. Default value false. 515 515 * @return bool Is global access allowed? 516 516 */ … … 523 523 /** 524 524 * Get the default forums role (issued to users on their first visit to the 525 * forums) by bbp_set_current_user_default_role() and repair tools 525 * forums) by bbp_set_current_user_default_role() and repair tools. 526 526 * 527 527 * @since 2.2.0 bbPress (r4294) 528 528 * 529 * @param string $default Optional. Default value empty 530 * @return string The default forums user role 529 * @param string $default Optional. Default value empty. 530 * @return string The default forums user role. 531 531 */ 532 532 function bbp_get_default_role( $default = 'bbp_participant' ) { … … 537 537 538 538 /** 539 * Use the WordPress editor if available 539 * Use the WordPress editor if available. 540 540 * 541 541 * @since 2.0.0 bbPress (r3386) 542 542 * 543 * @param bool $default Optional. Default value true 543 * @param bool $default Optional. Default value true. 544 544 * @return bool Use WP editor? 545 545 */ … … 551 551 552 552 /** 553 * Use WordPress's oEmbed API 553 * Use WordPress's oEmbed API. 554 554 * 555 555 * @since 2.1.0 bbPress (r3752) 556 556 * 557 * @param bool $default Optional. Default value true 557 * @param bool $default Optional. Default value true. 558 558 * @return bool Use oEmbed? 559 559 */ … … 565 565 566 566 /** 567 * Get the current theme package ID 567 * Get the current theme package ID. 568 568 * 569 569 * @since 2.1.0 bbPress (r3829) 570 570 * 571 * @param string $default Optional. Default value 'default' 572 * @return string ID of the theme-package 571 * @param string $default Optional. Default value 'default'. 572 * @return string ID of the theme-package. 573 573 */ 574 574 function bbp_get_theme_package_id( $default = 'default' ) { … … 579 579 580 580 /** 581 * Output the maximum length of a title 581 * Output the maximum length of a title. 582 582 * 583 583 * @since 2.0.0 bbPress (r3246) 584 584 * 585 * @param bool $default Optional. Default value 80 585 * @param bool $default Optional. Default value 80. 586 586 */ 587 587 function bbp_title_max_length( $default = 80 ) { 588 588 echo bbp_get_title_max_length( $default ); 589 589 } 590 /** 591 * Return the maximum length of a title 592 * 593 * @since 2.0.0 bbPress (r3246) 594 * 595 * @param bool $default Optional. Default value 80 596 * @return int Is anonymous posting allowed? 597 */ 598 function bbp_get_title_max_length( $default = 80 ) { 599 600 // Filter & return 601 return (int) apply_filters( 'bbp_get_title_max_length', (int) get_option( '_bbp_title_max_length', $default ) ); 602 } 590 591 /** 592 * Return the maximum length of a title. 593 * 594 * @since 2.0.0 bbPress (r3246) 595 * 596 * @param bool $default Optional. Default value 80. 597 * @return int Is anonymous posting allowed? 598 */ 599 function bbp_get_title_max_length( $default = 80 ) { 600 601 // Filter & return 602 return (int) apply_filters( 'bbp_get_title_max_length', (int) get_option( '_bbp_title_max_length', $default ) ); 603 } 603 604 604 605 /** … … 608 609 * @since 2.6.0 bbPress (r6868) 609 610 * 610 * @param bool $default Optional. Default value 5 611 * @param bool $default Optional. Default value 5. 611 612 */ 612 613 function bbp_edit_lock( $default = 5 ) { 613 614 echo bbp_get_edit_lock( $default ); 614 615 } 615 /** 616 * Return the number of minutes a topic or reply can be edited after it's 617 * published. Used by `bbp_past_edit_lock()`. 618 * 619 * @since 2.6.0 bbPress (r6868) 620 * 621 * @param bool $default Optional. Default value 5 622 * @return int Is anonymous posting allowed? 623 */ 624 function bbp_get_edit_lock( $default = 5 ) { 625 626 // Filter & return 627 return (int) apply_filters( 'bbp_get_edit_lock', (int) get_option( '_bbp_edit_lock', $default ) ); 628 } 629 630 /** 631 * Output the group forums root parent forum id 616 617 /** 618 * Return the number of minutes a topic or reply can be edited after it's 619 * published. Used by `bbp_past_edit_lock()`. 620 * 621 * @since 2.6.0 bbPress (r6868) 622 * 623 * @param bool $default Optional. Default value 5. 624 * @return int Is anonymous posting allowed? 625 */ 626 function bbp_get_edit_lock( $default = 5 ) { 627 628 // Filter & return 629 return (int) apply_filters( 'bbp_get_edit_lock', (int) get_option( '_bbp_edit_lock', $default ) ); 630 } 631 632 /** 633 * Output the group forums root parent forum id. 632 634 * 633 635 * @since 2.1.0 bbPress (r3575) 634 636 * 635 * @param int $default Optional. Default value 637 * @param int $default Optional. Default value. 636 638 */ 637 639 function bbp_group_forums_root_id( $default = 0 ) { 638 640 echo bbp_get_group_forums_root_id( $default ); 639 641 } 640 /** 641 * Return the group forums root parent forum id 642 * 643 * @since 2.1.0 bbPress (r3575) 644 * 645 * @param bool $default Optional. Default value 0 646 * @return int The post ID for the root forum 647 */ 648 function bbp_get_group_forums_root_id( $default = 0 ) { 649 650 // Filter & return 651 return (int) apply_filters( 'bbp_get_group_forums_root_id', (int) get_option( '_bbp_group_forums_root_id', $default ) ); 652 } 653 654 /** 655 * Checks if BuddyPress Group Forums are enabled 642 643 /** 644 * Return the group forums root parent forum id. 656 645 * 657 646 * @since 2.1.0 bbPress (r3575) 658 647 * 659 * @param bool $default Optional. Default value true 660 * @return bool Is group forums enabled or not 648 * @param bool $default Optional. Default value 0. 649 * @return int The post ID for the root forum. 650 */ 651 function bbp_get_group_forums_root_id( $default = 0 ) { 652 653 // Filter & return 654 return (int) apply_filters( 'bbp_get_group_forums_root_id', (int) get_option( '_bbp_group_forums_root_id', $default ) ); 655 } 656 657 /** 658 * Checks if BuddyPress Group Forums are enabled. 659 * 660 * @since 2.1.0 bbPress (r3575) 661 * 662 * @param bool $default Optional. Default value true. 663 * @return bool Is group forums enabled or not. 661 664 */ 662 665 function bbp_is_group_forums_active( $default = 1 ) { … … 667 670 668 671 /** 669 * Checks if Akismet is enabled 672 * Checks if Akismet is enabled. 670 673 * 671 674 * @since 2.1.0 bbPress (r3575) 672 675 * 673 * @param bool $default Optional. Default value true 674 * @return bool Is Akismet enabled or not 676 * @param bool $default Optional. Default value true. 677 * @return bool Is Akismet enabled or not. 675 678 */ 676 679 function bbp_is_akismet_active( $default = 1 ) { … … 681 684 682 685 /** 683 * Integrate settings into existing WordPress pages 686 * Integrate settings into existing WordPress pages. 684 687 * 685 688 * There are 3 possible modes: … … 690 693 * @since 2.4.0 bbPress (r4932) 691 694 * 692 * @param bool $default Optional. Default value false 693 * @return string How to integrate settings 695 * @param bool $default Optional. Default value false. 696 * @return string How to integrate settings. 694 697 */ 695 698 function bbp_settings_integration( $default = 'basic' ) { … … 715 718 716 719 /** 717 * How to interact with engagements 720 * How to interact with engagements. 718 721 * 719 722 * There are 3 possible strategies: … … 724 727 * @since 2.6.0 bbPress (r6875) 725 728 * 726 * @param bool $default Optional. Default value false 727 * @return string How to interact with engagements 729 * @param bool $default Optional. Default value false. 730 * @return string How to interact with engagements. 728 731 */ 729 732 function bbp_engagements_strategy( $default = 'meta' ) { … … 747 750 748 751 /** 749 * Return the root slug 752 * Return the root slug. 750 753 * 751 754 * @since 2.1.0 bbPress (r3759) 752 755 * 753 * @param string $default Optional. Default value 'forums' 756 * @param string $default Optional. Default value 'forums'. 754 757 * @return string 755 758 */ … … 765 768 * @since 2.1.0 bbPress (r3759) 766 769 * 767 * @param bool $default Optional. Default value true 770 * @param bool $default Optional. Default value true. 768 771 * @return bool 769 772 */ … … 779 782 * @since 2.4.0 bbPress (r4932) 780 783 * 781 * @param string $default Optional. Default value 'forums' 784 * @param string $default Optional. Default value 'forums'. 782 785 * @return string 783 786 */ … … 789 792 790 793 /** 791 * Maybe return the root slug, based on whether or not it's included in the url 794 * Maybe return the root slug, based on whether or not it's included in the url. 792 795 * 793 796 * @since 2.1.0 bbPress (r3759) 794 797 * 795 * @param string $default Optional. Default value 'forums' 798 * @param string $default Optional. Default value 'forums'. 796 799 * @return string 797 800 */ … … 807 810 808 811 /** 809 * Return the single forum slug 812 * Return the single forum slug. 810 813 * 811 814 * @since 2.1.0 bbPress (r3759) 812 815 * 813 * @param string $default Optional. Default value 'forum' 816 * @param string $default Optional. Default value 'forum'. 814 817 * @return string 815 818 */ … … 821 824 822 825 /** 823 * Return the topic archive slug 826 * Return the topic archive slug. 824 827 * 825 828 * @since 2.1.0 bbPress (r3759) 826 829 * 827 * @param string $default Optional. Default value 'topics' 830 * @param string $default Optional. Default value 'topics'. 828 831 * @return string 829 832 */ … … 835 838 836 839 /** 837 * Return the reply archive slug 840 * Return the reply archive slug. 838 841 * 839 842 * @since 2.4.0 bbPress (r4925) 840 843 * 841 * @param string $default Optional. Default value 'replies' 844 * @param string $default Optional. Default value 'replies'. 842 845 * @return string 843 846 */ … … 849 852 850 853 /** 851 * Return the single topic slug 854 * Return the single topic slug. 852 855 * 853 856 * @since 2.1.0 bbPress (r3759) 854 857 * 855 * @param string $default Optional. Default value 'topic' 858 * @param string $default Optional. Default value 'topic'. 856 859 * @return string 857 860 */ … … 863 866 864 867 /** 865 * Return the topic-tag taxonomy slug 868 * Return the topic-tag taxonomy slug. 866 869 * 867 870 * @since 2.1.0 bbPress (r3759) 868 871 * 869 * @param string $default Optional. Default value 'topic-tag' 872 * @param string $default Optional. Default value 'topic-tag'. 870 873 * @return string 871 874 */ … … 877 880 878 881 /** 879 * Return the single reply slug (used mostly for editing) 882 * Return the single reply slug (used mostly for editing). 880 883 * 881 884 * @since 2.1.0 bbPress (r3759) 882 885 * 883 * @param string $default Optional. Default value 'reply' 886 * @param string $default Optional. Default value 'reply'. 884 887 * @return string 885 888 */ … … 891 894 892 895 /** 893 * Return the single user slug 896 * Return the single user slug. 894 897 * 895 898 * @since 2.1.0 bbPress (r3759) 896 899 * 897 * @param string $default Optional. Default value 'users' 900 * @param string $default Optional. Default value 'users'. 898 901 * @return string 899 902 */ … … 905 908 906 909 /** 907 * Return the single user favorites slug 910 * Return the single user favorites slug. 908 911 * 909 912 * @since 2.2.0 bbPress (r4187) 910 913 * 911 * @param string $default Optional. Default value 'favorites' 914 * @param string $default Optional. Default value 'favorites'. 912 915 * @return string 913 916 */ … … 919 922 920 923 /** 921 * Return the single user subscriptions slug 924 * Return the single user subscriptions slug. 922 925 * 923 926 * @since 2.2.0 bbPress (r4187) 924 927 * 925 * @param string $default Optional. Default value 'subscriptions' 928 * @param string $default Optional. Default value 'subscriptions'. 926 929 * @return string 927 930 */ … … 933 936 934 937 /** 935 * Return the single user engagements slug 938 * Return the single user engagements slug. 936 939 * 937 940 * @since 2.6.0 bbPress (r6320) 938 941 * 939 * @param string $default Optional. Default value 'engagements' 942 * @param string $default Optional. Default value 'engagements'. 940 943 * @return string 941 944 */ … … 947 950 948 951 /** 949 * Return the topic view slug 952 * Return the topic view slug. 950 953 * 951 954 * @since 2.1.0 bbPress (r3759) 952 955 * 953 * @param string $default Optional. Default value 'view' 956 * @param string $default Optional. Default value 'view'. 954 957 * @return string 955 958 */ … … 961 964 962 965 /** 963 * Return the search slug 966 * Return the search slug. 964 967 * 965 968 * @since 2.3.0 bbPress (r4579) 966 969 * 967 * @param string $default Optional. Default value 'search' 970 * @param string $default Optional. Default value 'search'. 968 971 * @return string 969 972 */ … … 975 978 976 979 /** 977 * Return the edit slug 980 * Return the edit slug. 978 981 * 979 982 * @since 2.6.2 bbPress (r6965) 980 983 * 981 * @param string $default Optional. Default value 'edit' 984 * @param string $default Optional. Default value 'edit'. 982 985 * @return string 983 986 */ … … 991 994 992 995 /** 993 * Checks if there is a previous BuddyPress Forum configuration 996 * Checks if there is a previous BuddyPress Forum configuration. 994 997 * 995 998 * @since 2.1.0 bbPress (r3790) 996 999 * 997 * @param string $default Optional. Default empty string 998 * @return string The location of the bb-config.php file, if any 1000 * @param string $default Optional. Default empty string. 1001 * @return string The location of the bb-config.php file, if any. 999 1002 */ 1000 1003 function bbp_get_config_location( $default = '' ) { -
trunk/src/includes/core/sub-actions.php
r7348 r7380 2 2 3 3 /** 4 * Plugin Dependency 4 * Plugin Dependency. 5 5 * 6 6 * The purpose of the following hooks is to mimic the behavior of something … … 24 24 25 25 /** 26 * Runs on bbPress activation 26 * Runs on bbPress activation. 27 27 * 28 28 * @since 2.0.0 bbPress (r2509) … … 33 33 34 34 /** 35 * Runs on bbPress deactivation 35 * Runs on bbPress deactivation. 36 36 * 37 37 * @since 2.0.0 bbPress (r2509) … … 42 42 43 43 /** 44 * Runs when uninstalling bbPress 44 * Runs when uninstalling bbPress. 45 45 * 46 46 * @since 2.0.0 bbPress (r2509) … … 53 53 54 54 /** 55 * Main action responsible for constants, globals, and includes 55 * Main action responsible for constants, globals, and includes. 56 56 * 57 57 * @since 2.0.0 bbPress (r2599) … … 62 62 63 63 /** 64 * Setup constants 64 * Setup constants. 65 65 * 66 66 * @since 2.0.0 bbPress (r2599) … … 71 71 72 72 /** 73 * Setup globals BEFORE includes 73 * Setup globals BEFORE includes. 74 74 * 75 75 * @since 2.0.0 bbPress (r2599) … … 80 80 81 81 /** 82 * Include files 82 * Include files. 83 83 * 84 84 * @since 2.0.0 bbPress (r2599) … … 89 89 90 90 /** 91 * Setup globals AFTER includes 91 * Setup globals AFTER includes. 92 92 * 93 93 * @since 2.0.0 bbPress (r2599) … … 98 98 99 99 /** 100 * Register any objects before anything is initialized 100 * Register any objects before anything is initialized. 101 101 * 102 102 * @since 2.2.0 bbPress (r4180) … … 107 107 108 108 /** 109 * Initialize any code after everything has been loaded 109 * Initialize any code after everything has been loaded. 110 110 * 111 111 * @since 2.0.0 bbPress (r2599) … … 116 116 117 117 /** 118 * Initialize roles 118 * Initialize roles. 119 119 * 120 120 * @since 2.6.0 bbPress (r6106) 121 121 * 122 * @param WP_Roles $wp_roles The array of WP_Role objects that was initialized 122 * @param WP_Roles $wp_roles The array of WP_Role objects that was initialized. 123 123 */ 124 124 function bbp_roles_init( $wp_roles ) { … … 127 127 128 128 /** 129 * Initialize widgets 129 * Initialize widgets. 130 130 * 131 131 * @since 2.0.0 bbPress (r3389) … … 136 136 137 137 /** 138 * Setup the currently logged-in user 138 * Setup the currently logged-in user. 139 139 * 140 140 * @link https://bbpress.trac.wordpress.org/ticket/2309 … … 148 148 149 149 /** 150 * Setup the user engagements strategy 150 * Setup the user engagements strategy. 151 151 * 152 152 * @since 2.6.0 bbPress (r6875) … … 159 159 160 160 /** 161 * Load translations for current language 161 * Load translations for current language. 162 162 * 163 163 * @since 2.0.0 bbPress (r2599) … … 168 168 169 169 /** 170 * Setup the post types 170 * Setup the post types. 171 171 * 172 172 * @since 2.0.0 bbPress (r2464) … … 177 177 178 178 /** 179 * Setup the post statuses 179 * Setup the post statuses. 180 180 * 181 181 * @since 2.0.0 bbPress (r2727) … … 186 186 187 187 /** 188 * Register the built in bbPress taxonomies 188 * Register the built in bbPress taxonomies. 189 189 * 190 190 * @since 2.0.0 bbPress (r2464) … … 195 195 196 196 /** 197 * Register the default bbPress views 197 * Register the default bbPress views. 198 198 * 199 199 * @since 2.0.0 bbPress (r2789) … … 204 204 205 205 /** 206 * Register the default bbPress shortcodes 206 * Register the default bbPress shortcodes. 207 207 * 208 208 * @since 2.2.0 bbPress (r4211) … … 213 213 214 214 /** 215 * Register the default bbPress meta-data 215 * Register the default bbPress meta-data. 216 216 * 217 217 * @since 2.6.0 bbPress (r46300) … … 222 222 223 223 /** 224 * Enqueue bbPress specific CSS and JS 224 * Enqueue bbPress specific CSS and JS. 225 225 * 226 226 * @since 2.0.0 bbPress (r3373) … … 231 231 232 232 /** 233 * Add the bbPress-specific rewrite tags 233 * Add the bbPress-specific rewrite tags. 234 234 * 235 235 * @since 2.0.0 bbPress (r2753) … … 240 240 241 241 /** 242 * Add the bbPress-specific rewrite rules 242 * Add the bbPress-specific rewrite rules. 243 243 * 244 244 * @since 2.4.0 bbPress (r4918) … … 249 249 250 250 /** 251 * Add the bbPress-specific permalink structures 251 * Add the bbPress-specific permalink structures. 252 252 * 253 253 * @since 2.4.0 bbPress (r4918) … … 267 267 268 268 /** 269 * Add the bbPress-specific post status transition action 269 * Add the bbPress-specific post status transition action. 270 270 * 271 271 * @since 2.6.0 bbPress (r6792) 272 272 * 273 * @param string $new_status New post status 274 * @param string $old_status Old post status 275 * @param WP_Post $post Post object 273 * @param string $new_status New post status. 274 * @param string $old_status Old post status. 275 * @param WP_Post $post Post object. 276 276 */ 277 277 function bbp_transition_post_status( $new_status = '', $old_status = '', $post = false ) { … … 293 293 294 294 /** 295 * The main action for hooking into when a user account is updated 295 * The main action for hooking into when a user account is updated. 296 296 * 297 297 * @since 2.2.0 bbPress (r4304) 298 298 * 299 * @param int $user_id ID of user being edited 299 * @param int $user_id ID of user being edited. 300 300 * @param array $old_user_data The old, unmodified user data 301 301 */ … … 305 305 306 306 /** 307 * The main action for hooking into a user being registered 307 * The main action for hooking into a user being registered. 308 308 * 309 309 * @since 2.2.0 bbPress (r4304) 310 310 * 311 * @param int $user_id ID of user being edited 311 * @param int $user_id ID of user being edited. 312 312 */ 313 313 function bbp_user_register( $user_id = 0 ) { … … 318 318 319 319 /** 320 * bbPress has loaded and initialized everything, and is okay to go 320 * bbPress has loaded and initialized everything, and is okay to go. 321 321 * 322 322 * @since 2.0.0 bbPress (r2618) … … 330 330 /** 331 331 * The main action used for redirecting bbPress theme actions that are not 332 * permitted by the current_user 332 * permitted by the current_user. 333 333 * 334 334 * @since 2.1.0 bbPress (r3605) … … 341 341 342 342 /** 343 * The main action used for executing code before the theme has been setup 343 * The main action used for executing code before the theme has been setup. 344 344 * 345 345 * @since 2.1.0 bbPress (r3829) … … 350 350 351 351 /** 352 * The main action used for executing code before the theme has been setup 352 * The main action used for executing code before the theme has been setup. 353 353 * 354 354 * @since 2.1.0 bbPress (r3732) … … 359 359 360 360 /** 361 * The main action used for executing code after the theme has been setup 361 * The main action used for executing code after the theme has been setup. 362 362 * 363 363 * @since 2.1.0 bbPress (r3732) … … 368 368 369 369 /** 370 * The main action used for handling theme-side POST requests 370 * The main action used for handling theme-side POST requests. 371 371 * 372 372 * @since 2.3.0 bbPress (r4550) … … 401 401 402 402 /** 403 * The main action used for handling theme-side GET requests 403 * The main action used for handling theme-side GET requests. 404 404 * 405 405 * @since 2.3.0 bbPress (r4550) … … 450 450 451 451 /** 452 * Piggy back filter for WordPress's 'request' filter 452 * Piggy back filter for WordPress's 'request' filter. 453 453 * 454 454 * @since 2.1.0 bbPress (r3758) … … 470 470 * 471 471 * @param string $template 472 * @return string Template file to use 472 * @return string Template file to use. 473 473 */ 474 474 function bbp_template_include( $template = '' ) { … … 479 479 480 480 /** 481 * Generate bbPress-specific rewrite rules 481 * Generate bbPress-specific rewrite rules. 482 482 * 483 483 * @since 2.0.0 bbPress (r2688) … … 492 492 493 493 /** 494 * Filter the allowed themes list for bbPress specific themes 494 * Filter the allowed themes list for bbPress specific themes. 495 495 * 496 496 * @since 2.0.0 bbPress (r2944) … … 498 498 * @param array $themes 499 499 * 500 * @return array Array of allowed themes 500 * @return array Array of allowed themes. 501 501 */ 502 502 function bbp_allowed_themes( $themes ) { … … 507 507 508 508 /** 509 * Maps forum/topic/reply caps to built in WordPress caps 509 * Maps forum/topic/reply caps to built in WordPress caps. 510 510 * 511 511 * @since 2.0.0 bbPress (r2593) 512 512 * 513 * @param array $caps Capabilities for meta capability 514 * @param string $cap Capability name 515 * @param int $user_id User id 516 * @param array $args Arguments 517 * 518 * @return array Array of capabilities 513 * @param array $caps Capabilities for meta capability. 514 * @param string $cap Capability name. 515 * @param int $user_id User id. 516 * @param array $args Arguments. 517 * 518 * @return array Array of capabilities. 519 519 */ 520 520 function bbp_map_meta_caps( $caps = array(), $cap = '', $user_id = 0, $args = array() ) { … … 525 525 526 526 /** 527 * Filter the arguments used by wp_mail for bbPress specific emails 527 * Filter the arguments used by wp_mail for bbPress specific emails. 528 528 * 529 529 * @since 2.6.0 bbPress (r6918) … … 532 532 * subject, message, headers, and attachments values. 533 533 * 534 * @return array Array of capabilities 534 * @return array Array of capabilities. 535 535 */ 536 536 function bbp_mail( $args = array() ) { -
trunk/src/includes/core/template-functions.php
r7378 r7380 2 2 3 3 /** 4 * bbPress Template Functions 4 * bbPress Template Functions. 5 5 * 6 6 * This file contains functions necessary to mirror the WordPress core template … … 16 16 17 17 /** 18 * Adds bbPress theme support to any active WordPress theme 18 * Adds bbPress theme support to any active WordPress theme. 19 19 * 20 20 * @since 2.0.0 bbPress (r3032) 21 21 * 22 22 * @param string $slug 23 * @param string $name Optional. Default null 23 * @param string $name Optional. Default null. 24 24 * @return string The template filename if one is located. 25 25 */ … … 166 166 167 167 /** 168 * Convert an enqueueable file path to a URL 168 * Convert an enqueueable file path to a URL. 169 169 * 170 170 * @since 2.6.0 … … 308 308 * @since 2.3.0 bbPress (r4652) 309 309 * 310 * @param string $location_callback Callback function that returns the 310 * @param string $location_callback Callback function that returns the. 311 311 * @param int $priority 312 * @return bool Whether stack was removed 312 * @return bool Whether stack was removed. 313 313 */ 314 314 function bbp_deregister_template_stack( $location_callback = '', $priority = 10 ) { … … 330 330 * @since 2.6.0 bbPress (r5944) Added support for `WP_Hook` 331 331 * 332 * @global array $wp_filter Stores all of the filters 332 * @global array $wp_filter Stores all of the filters. 333 333 * @global array $merged_filters Merges the filter hooks using this function. 334 * @global array $wp_current_filter stores the list of current filters with the current one last 334 * @global array $wp_current_filter stores the list of current filters with the current one last. 335 335 * 336 336 * @return array The filtered value after all hooked functions are applied to it. … … 391 391 392 392 /** 393 * Get a template part in an output buffer, and return it 393 * Get a template part in an output buffer, and return it. 394 394 * 395 395 * @since 2.4.0 bbPress (r5043) … … 419 419 420 420 /** 421 * Retrieve path to a template 421 * Retrieve path to a template. 422 422 * 423 423 * Used to quickly retrieve the path of a template without including the file … … 429 429 * 430 430 * @param string $type Filename without extension. 431 * @param array $templates An optional list of template candidates 431 * @param array $templates An optional list of template candidates. 432 432 * @return string Full path to file. 433 433 */ … … 457 457 458 458 /** 459 * Get the possible subdirectories to check for templates in 459 * Get the possible subdirectories to check for templates in. 460 460 * 461 461 * @since 2.1.0 bbPress (r3738) 462 462 * 463 * @param array $templates Templates we are looking for 464 * @return array Possible subdirectories to look in 463 * @param array $templates Templates we are looking for. 464 * @return array Possible subdirectories to look in. 465 465 */ 466 466 function bbp_get_template_locations( $templates = array() ) { … … 476 476 477 477 /** 478 * Add template locations to template files being searched for 478 * Add template locations to template files being searched for. 479 479 * 480 480 * @since 2.1.0 bbPress (r3738) … … 501 501 502 502 /** 503 * Add checks for bbPress conditions to parse_query action 503 * Add checks for bbPress conditions to parse_query action. 504 504 * 505 505 * If it's a user page, WP_Query::bbp_is_single_user is set to true. … … 519 519 * If it's a reply edit, WP_Query::bbp_is_reply_edit is set to true. 520 520 * 521 * If it's a view page, WP_Query::bbp_is_view is set to true 522 * If it's a search page, WP_Query::bbp_is_search is set to true 521 * If it's a view page, WP_Query::bbp_is_view is set to true. 522 * If it's a search page, WP_Query::bbp_is_search is set to true. 523 523 * 524 524 * @since 2.0.0 bbPress (r2688) -
trunk/src/includes/core/template-loader.php
r7379 r7380 2 2 3 3 /** 4 * bbPress Template Loader 4 * bbPress Template Loader. 5 5 * 6 6 * @package bbPress … … 12 12 13 13 /** 14 * Possibly intercept the template being loaded 14 * Possibly intercept the template being loaded. 15 15 * 16 16 * Listens to the 'template_include' filter and waits for any bbPress specific 17 17 * template condition to be met. If one is met and the template file exists, 18 * it will be used; otherwise 18 * it will be used; otherwise. 19 19 * 20 20 * Note that the _edit() checks are ahead of their counterparts, to prevent them … … 25 25 * @param string $template 26 26 * 27 * @return string The path to the template file that is being used 27 * @return string The path to the template file that is being used. 28 28 */ 29 29 function bbp_template_include_theme_supports( $template = '' ) { … … 108 108 109 109 /** 110 * Set the included template 110 * Set the included template. 111 111 * 112 112 * @since 2.4.0 bbPress (r4975) 113 113 * 114 * @param mixed $template Default false 115 * @return mixed False if empty. Template name if template included 114 * @param mixed $template Default false. 115 * @return mixed False if empty. Template name if template included. 116 116 */ 117 117 function bbp_set_template_included( $template = false ) { … … 126 126 * @since 2.4.0 bbPress (r4975) 127 127 * 128 * @return bool True if yes, false if no 128 * @return bool True if yes, false if no. 129 129 */ 130 130 function bbp_is_template_included() { … … 158 158 159 159 /** 160 * Get the user profile template 161 * 162 * @since 2.0.0 bbPress (r3311) 163 * 164 * @return string Path to template file 160 * Get the user profile template. 161 * 162 * @since 2.0.0 bbPress (r3311) 163 * 164 * @return string Path to template file. 165 165 */ 166 166 function bbp_get_single_user_template() { … … 177 177 178 178 /** 179 * Get the user profile edit template 180 * 181 * @since 2.0.0 bbPress (r3311) 182 * 183 * @return string Path to template file 179 * Get the user profile edit template. 180 * 181 * @since 2.0.0 bbPress (r3311) 182 * 183 * @return string Path to template file. 184 184 */ 185 185 function bbp_get_single_user_edit_template() { … … 197 197 198 198 /** 199 * Get the user favorites template 199 * Get the user favorites template. 200 200 * 201 201 * @since 2.2.0 bbPress (r4225) 202 202 * 203 * @return string Path to template file 203 * @return string Path to template file. 204 204 */ 205 205 function bbp_get_favorites_template() { … … 218 218 219 219 /** 220 * Get the user subscriptions template 220 * Get the user subscriptions template. 221 221 * 222 222 * @since 2.2.0 bbPress (r4225) 223 223 * 224 * @return string Path to template file 224 * @return string Path to template file. 225 225 */ 226 226 function bbp_get_subscriptions_template() { … … 239 239 240 240 /** 241 * Get the view template 242 * 243 * @since 2.0.0 bbPress (r3311) 244 * 245 * @return string Path to template file 241 * Get the view template. 242 * 243 * @since 2.0.0 bbPress (r3311) 244 * 245 * @return string Path to template file. 246 246 */ 247 247 function bbp_get_single_view_template() { … … 257 257 258 258 /** 259 * Get the search template 259 * Get the search template. 260 260 * 261 261 * @since 2.3.0 bbPress (r4579) 262 262 * 263 * @return string Path to template file 263 * @return string Path to template file. 264 264 */ 265 265 function bbp_get_search_template() { … … 272 272 273 273 /** 274 * Get the single forum template 274 * Get the single forum template. 275 275 * 276 276 * @since 2.1.0 bbPress (r3922) 277 277 * 278 * @return string Path to template file 278 * @return string Path to template file. 279 279 */ 280 280 function bbp_get_single_forum_template() { … … 286 286 287 287 /** 288 * Get the forum archive template 288 * Get the forum archive template. 289 289 * 290 290 * @since 2.1.0 bbPress (r3922) 291 291 * 292 * @return string Path to template file 292 * @return string Path to template file. 293 293 */ 294 294 function bbp_get_forum_archive_template() { … … 300 300 301 301 /** 302 * Get the forum edit template 302 * Get the forum edit template. 303 303 * 304 304 * @since 2.1.0 bbPress (r3566) 305 305 * 306 * @return string Path to template file 306 * @return string Path to template file. 307 307 */ 308 308 function bbp_get_forum_edit_template() { … … 314 314 315 315 /** 316 * Get the single topic template 316 * Get the single topic template. 317 317 * 318 318 * @since 2.1.0 bbPress (r3922) 319 319 * 320 * @return string Path to template file 320 * @return string Path to template file. 321 321 */ 322 322 function bbp_get_single_topic_template() { … … 328 328 329 329 /** 330 * Get the topic archive template 330 * Get the topic archive template. 331 331 * 332 332 * @since 2.1.0 bbPress (r3922) 333 333 * 334 * @return string Path to template file 334 * @return string Path to template file. 335 335 */ 336 336 function bbp_get_topic_archive_template() { … … 342 342 343 343 /** 344 * Get the topic edit template 345 * 346 * @since 2.0.0 bbPress (r3311) 347 * 348 * @return string Path to template file 344 * Get the topic edit template. 345 * 346 * @since 2.0.0 bbPress (r3311) 347 * 348 * @return string Path to template file. 349 349 */ 350 350 function bbp_get_topic_edit_template() { … … 356 356 357 357 /** 358 * Get the topic split template 359 * 360 * @since 2.0.0 bbPress (r3311) 361 * 362 * @return string Path to template file 358 * Get the topic split template. 359 * 360 * @since 2.0.0 bbPress (r3311) 361 * 362 * @return string Path to template file. 363 363 */ 364 364 function bbp_get_topic_split_template() { … … 370 370 371 371 /** 372 * Get the topic merge template 373 * 374 * @since 2.0.0 bbPress (r3311) 375 * 376 * @return string Path to template file 372 * Get the topic merge template. 373 * 374 * @since 2.0.0 bbPress (r3311) 375 * 376 * @return string Path to template file. 377 377 */ 378 378 function bbp_get_topic_merge_template() { … … 384 384 385 385 /** 386 * Get the single reply template 386 * Get the single reply template. 387 387 * 388 388 * @since 2.1.0 bbPress (r3922) 389 389 * 390 * @return string Path to template file 390 * @return string Path to template file. 391 391 */ 392 392 function bbp_get_single_reply_template() { … … 398 398 399 399 /** 400 * Get the reply edit template 401 * 402 * @since 2.0.0 bbPress (r3311) 403 * 404 * @return string Path to template file 400 * Get the reply edit template. 401 * 402 * @since 2.0.0 bbPress (r3311) 403 * 404 * @return string Path to template file. 405 405 */ 406 406 function bbp_get_reply_edit_template() { … … 412 412 413 413 /** 414 * Get the reply move template 414 * Get the reply move template. 415 415 * 416 416 * @since 2.3.0 bbPress (r4521) 417 417 * 418 * @return string Path to template file 418 * @return string Path to template file. 419 419 */ 420 420 function bbp_get_reply_move_template() { … … 426 426 427 427 /** 428 * Get the topic template 429 * 430 * @since 2.0.0 bbPress (r3311) 431 * 432 * @return string Path to template file 428 * Get the topic template. 429 * 430 * @since 2.0.0 bbPress (r3311) 431 * 432 * @return string Path to template file. 433 433 */ 434 434 function bbp_get_topic_tag_template() { … … 443 443 444 444 /** 445 * Get the topic edit template 446 * 447 * @since 2.0.0 bbPress (r3311) 448 * 449 * @return string Path to template file 445 * Get the topic edit template. 446 * 447 * @since 2.0.0 bbPress (r3311) 448 * 449 * @return string Path to template file. 450 450 */ 451 451 function bbp_get_topic_tag_edit_template() { … … 460 460 461 461 /** 462 * Get the templates to use as the endpoint for bbPress template parts 462 * Get the templates to use as the endpoint for bbPress template parts. 463 463 * 464 464 * @since 2.0.0 bbPress (r3311) 465 465 * @since 2.6.0 bbPress (r5950) Added `singular.php` to template stack 466 466 * 467 * @return string Path to template file 467 * @return string Path to template file. 468 468 */ 469 469 function bbp_get_theme_compat_templates() { -
trunk/src/includes/core/theme-compat.php
r7378 r7380 2 2 3 3 /** 4 * bbPress Theme Compatibility 4 * bbPress Theme Compatibility. 5 5 * 6 6 * @package bbPress … … 26 26 27 27 /** 28 * Theme Compatibility base class 28 * Theme Compatibility base class. 29 29 * 30 30 * This is only intended to be extended, and is included here as a basic guide 31 * for future Template Packs to use. @link bbp_setup_theme_compat() 31 * for future Template Packs to use. @link bbp_setup_theme_compat(). 32 32 * 33 33 * @since 2.0.0 bbPress (r3506) … … 231 231 232 232 /** 233 * Gets true/false if page is currently inside theme compatibility 233 * Gets true/false if page is currently inside theme compatibility. 234 234 * 235 235 * @since 2.0.0 bbPress (r3265) … … 248 248 249 249 /** 250 * Sets true/false if page is currently inside theme compatibility 250 * Sets true/false if page is currently inside theme compatibility. 251 251 * 252 252 * @since 2.0.0 bbPress (r3265) … … 262 262 263 263 /** 264 * Set the theme compat templates global 264 * Set the theme compat templates global. 265 265 * 266 266 * Stash possible template files for the current query. Useful if plugins want … … 276 276 277 277 /** 278 * Set the theme compat template global 278 * Set the theme compat template global. 279 279 * 280 280 * Stash the template file for the current query. Useful if plugins want … … 290 290 291 291 /** 292 * Set the theme compat original_template global 292 * Set the theme compat original_template global. 293 293 * 294 294 * Stash the original template file for the current query. Useful for checking … … 304 304 305 305 /** 306 * Is a template the original_template global 306 * Is a template the original_template global. 307 307 * 308 308 * Stash the original template file for the current query. Useful for checking … … 323 323 324 324 /** 325 * Register a new bbPress theme package to the active theme packages array 325 * Register a new bbPress theme package to the active theme packages array. 326 326 * 327 327 * @since 2.1.0 bbPress (r3829) … … 517 517 } 518 518 519 /** Users ************************************************************* /519 /** Users *****************************************************************/ 520 520 521 521 if ( bbp_is_single_user_edit() || bbp_is_single_user() ) { … … 536 536 ); 537 537 538 /** Forums ************************************************************ /538 /** Forums ****************************************************************/ 539 539 540 540 // Forum archive … … 631 631 ); 632 632 633 /** Topics ************************************************************ /633 /** Topics ****************************************************************/ 634 634 635 635 // Topic archive … … 710 710 ); 711 711 712 /** Replies *********************************************************** /712 /** Replies ***************************************************************/ 713 713 714 714 // Reply archive … … 764 764 ); 765 765 766 /** Views ************************************************************* /766 /** Views *****************************************************************/ 767 767 768 768 } elseif ( bbp_is_single_view() ) { … … 783 783 ); 784 784 785 /** Search ************************************************************ /785 /** Search ****************************************************************/ 786 786 787 787 } elseif ( bbp_is_search() ) { … … 802 802 ); 803 803 804 /** Topic Tags ******************************************************** /804 /** Topic Tags ************************************************************/ 805 805 806 806 // Topic Tag Edit … … 1013 1013 /** 1014 1014 * Restores filters from the $bbp global that were removed using 1015 * bbp_remove_all_filters() 1015 * bbp_remove_all_filters(). 1016 1016 * 1017 1017 * @since 2.0.0 bbPress (r3251) … … 1069 1069 1070 1070 /** 1071 * Force comments_status to 'closed' for bbPress post types 1071 * Force comments_status to 'closed' for bbPress post types. 1072 1072 * 1073 1073 * @since 2.1.0 bbPress (r3589) -
trunk/src/includes/core/update.php
r7378 r7380 2 2 3 3 /** 4 * bbPress Updater 4 * bbPress Updater. 5 5 * 6 6 * @package bbPress … … 12 12 13 13 /** 14 * If there is no raw DB version, this is the first installation 14 * If there is no raw DB version, this is the first installation. 15 15 * 16 16 * @since 2.1.0 bbPress (r3764) 17 17 * 18 * @return bool True if update, False if not 18 * @return bool True if update, False if not. 19 19 */ 20 20 function bbp_is_install() { … … 23 23 24 24 /** 25 * Compare the bbPress version to the DB version to determine if updating 25 * Compare the bbPress version to the DB version to determine if updating. 26 26 * 27 27 * @since 2.0.0 bbPress (r3421) 28 28 * 29 * @return bool True if update, False if not 29 * @return bool True if update, False if not. 30 30 */ 31 31 function bbp_is_update() { … … 37 37 38 38 /** 39 * Determine if bbPress is being activated 39 * Determine if bbPress is being activated. 40 40 * 41 41 * Note that this function currently is not used in bbPress core and is here … … 46 46 * @global string $pagenow The filename of the current screen. 47 47 * 48 * @return bool True if activating bbPress, false if not 48 * @param string $basename Plugin base name. 49 * 50 * @return bool True if activating bbPress, false if not. 49 51 */ 50 52 function bbp_is_activation( $basename = '' ) { … … 92 94 93 95 /** 94 * Determine if bbPress is being deactivated 96 * Determine if bbPress is being deactivated. 95 97 * 96 98 * @since 2.0.0 bbPress (r3421) … … 98 100 * @global string $pagenow The filename of the current screen. 99 101 * 100 * @return bool True if deactivating bbPress, false if not 102 * @param string $basename Plugin base name. 103 * 104 * @return bool True if deactivating bbPress, false if not. 101 105 */ 102 106 function bbp_is_deactivation( $basename = '' ) { … … 144 148 145 149 /** 146 * Update the DB to the latest version 150 * Update the DB to the latest version. 147 151 * 148 152 * @since 2.0.0 bbPress (r3421) … … 153 157 154 158 /** 155 * Setup the bbPress updater 159 * Setup the bbPress updater. 156 160 * 157 161 * @since 2.0.0 bbPress (r3419) … … 170 174 /** 171 175 * Runs when a new site is created in a multisite network, and bbPress is active 172 * on that site (hooked to `bbp_new_site`) 176 * on that site (hooked to `bbp_new_site`). 173 177 * 174 178 * @since 2.6.0 bbPress (r6779) 179 * 180 * @param int $site_id Side id. 175 181 */ 176 182 function bbp_setup_new_site( $site_id = 0 ) { … … 193 199 194 200 /** 195 * Create a default forum, topic, and reply 201 * Create a default forum, topic, and reply. 196 202 * 197 203 * @since 2.1.0 bbPress (r3767) 198 204 * 199 * @param array $args Array of arguments to override default values 205 * @param array $args Array of arguments to override default values. 200 206 */ 201 207 function bbp_create_initial_content( $args = array() ) { … … 425 431 426 432 /** 427 * Redirect user to the "What's New" page on activation 433 * Redirect user to the "What's New" page on activation. 428 434 * 429 435 * @since 2.2.0 bbPress (r4389) 430 436 * 431 * @internal Used internally to redirect bbPress to the about page on activation 432 * 433 * @return If network admin or bulk activation 437 * @internal Used internally to redirect bbPress to the about page on activation. 438 * 439 * @return If network admin or bulk activation. 434 440 */ 435 441 function bbp_add_activation_redirect() { … … 445 451 446 452 /** 447 * Redirect user to "What's New" page on activation 453 * Redirect user to "What's New" page on activation. 448 454 * 449 455 * @since 2.2.0 bbPress (r4389) 450 456 * 451 * @internal Used internally to redirect bbPress to the about page on activation 452 * 453 * @return If no transient, or in network admin, or is bulk activation 457 * @internal Used internally to redirect bbPress to the about page on activation. 458 * 459 * @return If no transient, or in network admin, or is bulk activation. 454 460 */ 455 461 function bbp_do_activation_redirect() { … … 484 490 * @since 2.4.0 bbPress (r4910) 485 491 * 486 * @internal Used to internally make the current user a keymaster on activation 487 * 488 * @return If user can't activate plugins or is already a keymaster 492 * @internal Used to internally make the current user a keymaster on activation. 493 * 494 * @return If user can't activate plugins or is already a keymaster. 489 495 */ 490 496 function bbp_make_current_user_keymaster() { … … 532 538 533 539 /** 534 * Return the number of pending upgrades 540 * Return the number of pending upgrades. 535 541 * 536 542 * @since 2.6.0 bbPress (r6895) 537 543 * 538 * @param string $type Type of pending upgrades (upgrade|repair|empty) 544 * @param string $type Type of pending upgrades (upgrade|repair|empty). 539 545 * 540 546 * @return int … … 545 551 546 552 /** 547 * Return an array of pending upgrades 553 * Return an array of pending upgrades. 548 554 * 549 555 * @since 2.6.0 bbPress (r6895) 550 556 * 551 * @param string $type Type of pending upgrades (upgrade|repair|empty) 557 * @param string $type Type of pending upgrades (upgrade|repair|empty). 552 558 * 553 559 * @return array … … 569 575 570 576 /** 571 * Add an upgrade ID to pending upgrades array 577 * Add an upgrade ID to pending upgrades array. 572 578 * 573 579 * @since 2.6.0 bbPress (r6895) … … 590 596 591 597 /** 592 * Add an upgrade ID to pending upgrades array 598 * Add an upgrade ID to pending upgrades array. 593 599 * 594 600 * @since 2.6.0 bbPress (r6895) … … 614 620 615 621 /** 616 * Delete all pending upgrades 622 * Delete all pending upgrades. 617 623 * 618 624 * @since 2.6.0 bbPress (r6895) … … 623 629 624 630 /** 625 * Maybe append an upgrade count to a string 631 * Maybe append an upgrade count to a string. 626 632 * 627 633 * @since 2.6.0 bbPress (r6896) 628 634 * 629 * @param string $text Text to append count to 630 * @param string $type Type of pending upgrades (upgrade|repair|empty) 635 * @param string $text Text to append count to. 636 * @param string $type Type of pending upgrades (upgrade|repair|empty). 631 637 * 632 638 * @return string -
trunk/src/includes/extend/akismet.php
r7379 r7380 2 2 3 3 /** 4 * Main bbPress Akismet Class 4 * Main bbPress Akismet Class. 5 5 * 6 6 * @package bbPress … … 13 13 if ( ! class_exists( 'BBP_Akismet' ) ) : 14 14 /** 15 * Loads Akismet extension 15 * Loads Akismet extension. 16 16 * 17 17 * @since 2.0.0 bbPress (r3277) … … 32 32 33 33 /** 34 * The main bbPress Akismet loader 34 * The main bbPress Akismet loader. 35 35 * 36 36 * @since 2.0.0 bbPress (r3277) … … 41 41 42 42 /** 43 * Setup the admin hooks 43 * Setup the admin hooks. 44 44 * 45 45 * @since 2.0.0 bbPress (r3277) … … 90 90 91 91 /** 92 * Converts topic/reply data into Akismet comment checking format 92 * Converts topic/reply data into Akismet comment checking format. 93 93 * 94 94 * @since 2.0.0 bbPress (r3277) … … 96 96 * @param array $post_data 97 97 * 98 * @return array Array of post data 98 * @return array Array of post data. 99 99 */ 100 100 public function check_post( $post_data = array() ) { … … 272 272 273 273 /** 274 * Submit a post for spamming or hamming 274 * Submit a post for spamming or hamming. 275 275 * 276 276 * @since 2.0.0 bbPress (r3277) 277 277 * 278 * @param int $post_id 278 * @param int $post_id Post id. 279 279 * 280 280 * @global string $akismet_api_host … … 283 283 * @global object $current_site 284 284 * 285 * @return array Array of existing topic terms 285 * @return array Array of existing topic terms. 286 286 */ 287 287 public function submit_post( $post_id = 0 ) { … … 438 438 439 439 /** 440 * Ping Akismet service and check for spam/ham response 440 * Ping Akismet service and check for spam/ham response. 441 441 * 442 442 * @since 2.0.0 bbPress (r3277) 443 443 * 444 444 * @param array $post_data 445 * @param string $check Accepts check|submit 446 * @param string $spam Accepts spam|ham 445 * @param string $check Accepts check|submit. 446 * @param string $spam Accepts spam|ham. 447 447 * 448 448 * @global string $akismet_api_host 449 449 * @global string $akismet_api_port 450 450 * 451 * @return array Array of post data 451 * @return array Array of post data. 452 452 */ 453 453 private function maybe_spam( $post_data = array(), $check = 'check', $spam = 'spam' ) { … … 537 537 538 538 /** 539 * Update post meta after a spam check 539 * Update post meta after a spam check. 540 540 * 541 541 * @since 2.0.0 bbPress (r3308) 542 542 * 543 * @param int $post_id 543 * @param int $post_id Post id. 544 544 * @param object $_post 545 545 * … … 702 702 703 703 /** 704 * Update Akismet history of a Post 704 * Update Akismet history of a Post. 705 705 * 706 706 * @since 2.0.0 bbPress (r3308) … … 741 741 742 742 /** 743 * Get the Akismet history of a Post 743 * Get the Akismet history of a Post. 744 744 * 745 745 * @since 2.0.0 bbPress (r3308) … … 747 747 * @param int $post_id 748 748 * 749 * @return array Array of Akismet history 749 * @return array Array of Akismet history. 750 750 */ 751 751 public function get_post_history( $post_id = 0 ) { … … 761 761 762 762 /** 763 * Handle any terms submitted with a post flagged as spam 763 * Handle any terms submitted with a post flagged as spam. 764 764 * 765 765 * @since 2.0.0 bbPress (r3308) 766 766 * 767 * @param string $terms Comma-separated list of terms 767 * @param string $terms Comma-separated list of terms. 768 768 * @param int $topic_id 769 769 * @param int $reply_id 770 770 * 771 * @return array Array of existing topic terms 771 * @return array Array of existing topic terms. 772 772 */ 773 773 public function filter_post_terms( $terms = '', $topic_id = 0, $reply_id = 0 ) { … … 790 790 791 791 /** 792 * Submit data to Akismet service with unique bbPress User Agent 792 * Submit data to Akismet service with unique bbPress User Agent. 793 793 * 794 794 * This code is directly taken from the akismet_http_post() function and … … 797 797 * @since 2.0.0 bbPress (r3466) 798 798 * 799 * @param string $request The request we are sending 800 * @param string $host The host to send our request to 801 * @param string $path The path from the host 802 * @param string $port The port to use 803 * @param string $ip Optional Override $host with an IP address 804 * @return mixed WP_Error on error, array on success, empty on failure 799 * @param string $request The request we are sending. 800 * @param string $host The host to send our request to. 801 * @param string $path The path from the host. 802 * @param string $port The port to use. 803 * @param string $ip Optional Override $host with an IP address. 804 * @return mixed WP_Error on error, array on success, empty on failure. 805 805 */ 806 806 private function http_post( $request, $host, $path, $port = 80, $ip = '' ) { … … 842 842 * @since 2.6.7 (bbPress r7194) 843 843 * 844 * @param string $host_and_path Scheme-less URL 845 * @param array $http_args Array of arguments for wp_remote_post() 844 * @param string $host_and_path Scheme-less URL. 845 * @param array $http_args Array of arguments for wp_remote_post(). 846 846 * @return array 847 847 */ … … 908 908 909 909 /** 910 * Return a user's roles on this site (including super_admin) 910 * Return a user's roles on this site (including super_admin). 911 911 * 912 912 * @since 2.3.0 bbPress (r4812) 913 913 * 914 * @param int $user_id 914 * @param int $user_id User id. 915 915 * 916 916 * @return boolean … … 943 943 944 944 /** 945 * Add Aksimet History meta-boxes to topics and replies 945 * Add Aksimet History meta-boxes to topics and replies. 946 946 * 947 947 * @since 2.4.0 bbPress (r5049) … … 971 971 972 972 /** 973 * Output for Akismet History meta-box 973 * Output for Akismet History meta-box. 974 974 * 975 975 * @since 2.4.0 bbPress (r5049) -
trunk/src/includes/extend/buddypress/activity.php
r7378 r7380 2 2 3 3 /** 4 * bbPress BuddyPress Activity Class 4 * bbPress BuddyPress Activity Class. 5 5 * 6 6 * @package bbPress … … 13 13 if ( ! class_exists( 'BBP_BuddyPress_Activity' ) ) : 14 14 /** 15 * Loads BuddyPress Activity extension 15 * Loads BuddyPress Activity extension. 16 16 * 17 17 * @since 2.0.0 bbPress (r3395) … … 25 25 26 26 /** 27 * The name of the BuddyPress component, used in activity streams 27 * The name of the BuddyPress component, used in activity streams. 28 28 * 29 29 * @var string … … 32 32 33 33 /** 34 * Forum Create Activity Action 34 * Forum Create Activity Action. 35 35 * 36 36 * @var string … … 39 39 40 40 /** 41 * Topic Create Activity Action 41 * Topic Create Activity Action. 42 42 * 43 43 * @var string … … 46 46 47 47 /** 48 * Topic Close Activity Action 48 * Topic Close Activity Action. 49 49 * 50 50 * @var string … … 53 53 54 54 /** 55 * Topic Edit Activity Action 55 * Topic Edit Activity Action. 56 56 * 57 57 * @var string … … 60 60 61 61 /** 62 * Topic Open Activity Action 62 * Topic Open Activity Action. 63 63 * 64 64 * @var string … … 67 67 68 68 /** 69 * Reply Create Activity Action 69 * Reply Create Activity Action. 70 70 * 71 71 * @var string … … 74 74 75 75 /** 76 * Reply Edit Activity Action 76 * Reply Edit Activity Action. 77 77 * 78 78 * @var string … … 83 83 84 84 /** 85 * The bbPress BuddyPress Activity loader 85 * The bbPress BuddyPress Activity loader. 86 86 * 87 87 * @since 2.0.0 bbPress (r3395) … … 95 95 96 96 /** 97 * Extension variables 97 * Extension variables. 98 98 * 99 99 * @since 2.0.0 bbPress (r3395) … … 121 121 122 122 /** 123 * Setup the actions 123 * Setup the actions. 124 124 * 125 125 * @since 2.0.0 bbPress (r3395) … … 146 146 147 147 /** 148 * Setup the filters 148 * Setup the filters. 149 149 * 150 150 * @since 2.0.0 bbPress (r3395) … … 174 174 175 175 /** 176 * Register our activity actions with BuddyPress 176 * Register our activity actions with BuddyPress. 177 177 * 178 178 * @since 2.0.0 bbPress (r3395) … … 202 202 203 203 /** 204 * Wrapper for recoding bbPress actions to the BuddyPress activity stream 205 * 206 * @since 2.0.0 bbPress (r3395) 207 * 208 * @param array $args Array of arguments for bp_activity_add() 209 * 210 * @return int Activity ID if successful, false if not 204 * Wrapper for recoding bbPress actions to the BuddyPress activity stream. 205 * 206 * @since 2.0.0 bbPress (r3395) 207 * 208 * @param array $args Array of arguments for bp_activity_add(). 209 * 210 * @return int Activity ID if successful, false if not. 211 211 */ 212 212 private function record_activity( $args = array() ) { … … 236 236 237 237 /** 238 * Wrapper for deleting bbPress actions from BuddyPress activity stream 239 * 240 * @since 2.0.0 bbPress (r3395) 241 * 242 * @param array $args Array of arguments for bp_activity_add() 243 * 244 * @return int Activity ID if successful, false if not 238 * Wrapper for deleting bbPress actions from BuddyPress activity stream. 239 * 240 * @since 2.0.0 bbPress (r3395) 241 * 242 * @param array $args Array of arguments for bp_activity_add(). 243 * 244 * @return int Activity ID if successful, false if not. 245 245 */ 246 246 public function delete_activity( $args = array() ) { … … 264 264 265 265 /** 266 * Check for an existing activity stream entry for a given post_id 267 * 268 * @param int $post_id ID of the topic or reply 269 * @return int if an activity id is verified, false if not 266 * Check for an existing activity stream entry for a given post_id. 267 * 268 * @param int $post_id ID of the topic or reply. 269 * @return int if an activity id is verified, false if not. 270 270 */ 271 271 private static function get_activity_id( $post_id = 0 ) { … … 290 290 291 291 /** 292 * Maybe disable activity stream comments on select actions 292 * Maybe disable activity stream comments on select actions. 293 293 * 294 294 * @since 2.0.0 bbPress (r3399) … … 328 328 329 329 /** 330 * Maybe link directly to topics and replies in activity stream entries 330 * Maybe link directly to topics and replies in activity stream entries. 331 331 * 332 332 * @since 2.0.0 bbPress (r3399) … … 334 334 * @param string $link 335 335 * @param mixed $activity_object 336 * @return string The link to the activity stream item 336 * @return string The link to the activity stream item. 337 337 */ 338 338 public function activity_get_permalink( $link = '', $activity_object = false ) { … … 355 355 356 356 /** 357 * Record an activity stream entry when a topic is created or updated 357 * Record an activity stream entry when a topic is created or updated. 358 358 * 359 359 * @since 2.0.0 bbPress (r3395) … … 363 363 * @param array $anonymous_data 364 364 * @param int $topic_author_id 365 * @return Bail early if topic is by anonymous user 365 * @return Bail early if topic is by anonymous user. 366 366 */ 367 367 public function topic_create( $topic_id = 0, $forum_id = 0, $anonymous_data = array(), $topic_author_id = 0 ) { … … 440 440 441 441 /** 442 * Delete the activity stream entry when a topic is spammed, trashed, or deleted 442 * Delete the activity stream entry when a topic is spammed, trashed, or deleted. 443 443 * 444 444 * @param int $topic_id … … 456 456 457 457 /** 458 * Update the activity stream entry when a topic status changes 458 * Update the activity stream entry when a topic status changes. 459 459 * 460 460 * @param int $topic_id 461 461 * @param obj $post 462 * @return Bail early if not a topic, or topic is by anonymous user 462 * @return Bail early if not a topic, or topic is by anonymous user. 463 463 */ 464 464 public function topic_update( $topic_id = 0, $post = null ) { … … 497 497 498 498 /** 499 * Record an activity stream entry when a reply is created 499 * Record an activity stream entry when a reply is created. 500 500 * 501 501 * @since 2.0.0 bbPress (r3395) … … 505 505 * @param array $anonymous_data 506 506 * @param int $topic_author_id 507 * @return Bail early if topic is by anonymous user 507 * @return Bail early if topic is by anonymous user. 508 508 */ 509 509 public function reply_create( $reply_id = 0, $topic_id = 0, $forum_id = 0, $anonymous_data = array(), $reply_author_id = 0 ) { … … 586 586 587 587 /** 588 * Delete the activity stream entry when a reply is spammed, trashed, or deleted 588 * Delete the activity stream entry when a reply is spammed, trashed, or deleted. 589 589 * 590 590 * @param int $reply_id … … 602 602 603 603 /** 604 * Update the activity stream entry when a reply status changes 604 * Update the activity stream entry when a reply status changes. 605 605 * 606 606 * @param int $reply_id 607 607 * @param obj $post 608 * @return Bail early if not a reply, or reply is by anonymous user 608 * @return Bail early if not a reply, or reply is by anonymous user. 609 609 */ 610 610 public function reply_update( $reply_id, $post ) { -
trunk/src/includes/extend/buddypress/functions.php
r7379 r7380 2 2 3 3 /** 4 * Main bbPress BuddyPress Class 4 * Main bbPress BuddyPress Class. 5 5 * 6 6 * @package bbPress … … 24 24 25 25 /** 26 * Return component name/ID ('forums' by default) 26 * Return component name/ID ('forums' by default). 27 27 * 28 28 * This is used primarily for Notifications integration. … … 44 44 45 45 /** 46 * Filter the current bbPress user ID with the current BuddyPress user ID 46 * Filter the current bbPress user ID with the current BuddyPress user ID. 47 47 * 48 48 * @since 2.1.0 bbPress (r3552) … … 80 80 81 81 /** 82 * Filter the bbPress is_single_user function with BuddyPress equivalent 83 * 84 * @since 2.1.0 bbPress (r3552) 85 * 86 * @param bool $is Optional. Default false 87 * @return bool True if viewing single user, false if not 82 * Filter the bbPress is_single_user function with BuddyPress equivalent. 83 * 84 * @since 2.1.0 bbPress (r3552) 85 * 86 * @param bool $is Optional. Default false. 87 * @return bool True if viewing single user, false if not. 88 88 */ 89 89 function bbp_filter_is_single_user( $is = false ) { … … 96 96 97 97 /** 98 * Filter the bbPress is_user_home function with BuddyPress equivalent 99 * 100 * @since 2.1.0 bbPress (r3552) 101 * 102 * @param bool $is Optional. Default false 103 * @return bool True if viewing single user, false if not 98 * Filter the bbPress is_user_home function with BuddyPress equivalent. 99 * 100 * @since 2.1.0 bbPress (r3552) 101 * 102 * @param bool $is Optional. Default false. 103 * @return bool True if viewing single user, false if not. 104 104 */ 105 105 function bbp_filter_is_user_home( $is = false ) { … … 112 112 113 113 /** 114 * Add the topic title to the <title> if viewing a single group forum topic 114 * Add the topic title to the <title> if viewing a single group forum topic. 115 115 * 116 116 * @since 2.5.0 bbPress (r5161) 117 117 * 118 * @param string $new_title The title to filter 119 * @param string $old_title (Not used) 120 * @param string $sep The separator to u se121 * @return string The possibly modified title 118 * @param string $new_title The title to filter. 119 * @param string $old_title (Not used). 120 * @param string $sep The separator to u.se 121 * @return string The possibly modified title. 122 122 */ 123 123 function bbp_filter_modify_page_title( $new_title = '', $old_title = '', $sep = '' ) { … … 151 151 152 152 /** 153 * Hook bbPress topics template into plugins template 153 * Hook bbPress topics template into plugins template. 154 154 * 155 155 * @since 2.1.0 bbPress (r3552) … … 161 161 162 162 /** 163 * Hook bbPress replies template into plugins template 163 * Hook bbPress replies template into plugins template. 164 164 * 165 165 * @since 2.1.0 bbPress (r3552) … … 171 171 172 172 /** 173 * Hook bbPress engagements template into plugins template 173 * Hook bbPress engagements template into plugins template. 174 174 * 175 175 * @since 2.6.0 bbPress (r6320) … … 181 181 182 182 /** 183 * Hook bbPress favorites template into plugins template 183 * Hook bbPress favorites template into plugins template. 184 184 * 185 185 * @since 2.1.0 bbPress (r3552) … … 191 191 192 192 /** 193 * Hook bbPress subscriptions template into plugins template 193 * Hook bbPress subscriptions template into plugins template. 194 194 * 195 195 * @since 2.1.0 bbPress (r3552) … … 203 203 204 204 /** 205 * Get the topics created template part 205 * Get the topics created template part. 206 206 * 207 207 * @since 2.1.0 bbPress (r3552) … … 220 220 221 221 /** 222 * Get the topics replied to template part 222 * Get the topics replied to template part. 223 223 * 224 224 * @since 2.1.0 bbPress (r3552) … … 237 237 238 238 /** 239 * Get the topic engagements template part 239 * Get the topic engagements template part. 240 240 * 241 241 * @since 2.6.0 bbPress (r6320) … … 254 254 255 255 /** 256 * Get the topics favorited template part 256 * Get the topics favorited template part. 257 257 * 258 258 * @since 2.1.0 bbPress (r3552) … … 271 271 272 272 /** 273 * Get the topics subscribed template part 273 * Get the topics subscribed template part. 274 274 * 275 275 * @since 2.1.0 bbPress (r3552) … … 290 290 291 291 /** 292 * Clean up the group root setting if the forum is being deleted 292 * Clean up the group root setting if the forum is being deleted. 293 293 * 294 294 * @since 2.6.0 bbPress (r6479) 295 295 * 296 * @param int $forum_id The forum ID being deleted 296 * @param int $forum_id The forum ID being deleted. 297 297 */ 298 298 function bbp_maybe_delete_group_forum_root( $forum_id = 0 ) { … … 314 314 315 315 /** 316 * Handle the new group forum root creation 316 * Handle the new group forum root creation. 317 317 * 318 318 * @since 2.6.0 bbPress (r6479) … … 372 372 373 373 /** 374 * Get forum ID's for a group 374 * Get forum ID's for a group. 375 375 * 376 376 * @since 2.1.0 bbPress (r3653) 377 377 * 378 * @param int $group_id 378 * @param int $group_id Group id. 379 379 */ 380 380 function bbp_get_group_forum_ids( $group_id = 0 ) { … … 401 401 402 402 /** 403 * Get group ID's for a forum 403 * Get group ID's for a forum. 404 404 * 405 405 * @since 2.1.0 bbPress (r3653) 406 406 * 407 * @param int $forum_id 407 * @param int $forum_id Forum id. 408 408 */ 409 409 function bbp_get_forum_group_ids( $forum_id = 0 ) { … … 430 430 431 431 /** 432 * Get forum ID's for a group 432 * Get forum ID's for a group. 433 433 * 434 434 * @since 2.1.0 bbPress (r3653) 435 435 * 436 * @param int $group_id 436 * @param int $group_id Group id. 437 437 */ 438 438 function bbp_update_group_forum_ids( $group_id = 0, $forum_ids = array() ) { … … 451 451 452 452 /** 453 * Update group ID's for a forum 453 * Update group ID's for a forum. 454 454 * 455 455 * @since 2.1.0 bbPress (r3653) 456 456 * 457 * @param int $forum_id 457 * @param int $forum_id Forum id. 458 458 */ 459 459 function bbp_update_forum_group_ids( $forum_id = 0, $group_ids = array() ) { … … 468 468 469 469 /** 470 * Add a group to a forum 470 * Add a group to a forum. 471 471 * 472 472 * @since 2.1.0 bbPress (r3653) 473 473 * 474 * @param int $group_id 474 * @param int $group_id Group id. 475 475 */ 476 476 function bbp_add_group_id_to_forum( $forum_id = 0, $group_id = 0 ) { … … 495 495 496 496 /** 497 * Remove a forum from a group 497 * Remove a forum from a group. 498 498 * 499 499 * @since 2.1.0 bbPress (r3653) 500 500 * 501 * @param int $group_id 501 * @param int $group_id Group id. 502 502 */ 503 503 function bbp_add_forum_id_to_group( $group_id = 0, $forum_id = 0 ) { … … 522 522 523 523 /** 524 * Remove a group from a forum 524 * Remove a group from a forum. 525 525 * 526 526 * @since 2.1.0 bbPress (r3653) 527 527 * 528 * @param int $group_id 528 * @param int $group_id Group id. 529 529 */ 530 530 function bbp_remove_group_id_from_forum( $forum_id = 0, $group_id = 0 ) { … … 549 549 550 550 /** 551 * Remove a forum from a group 551 * Remove a forum from a group. 552 552 * 553 553 * @since 2.1.0 bbPress (r3653) 554 554 * 555 * @param int $group_id 555 * @param int $group_id Group id. 556 556 */ 557 557 function bbp_remove_forum_id_from_group( $group_id = 0, $forum_id = 0 ) { … … 576 576 577 577 /** 578 * Remove a group from all forums 578 * Remove a group from all forums. 579 579 * 580 580 * @since 2.1.0 bbPress (r3653) 581 581 * 582 * @param int $group_id 582 * @param int $group_id Group id. 583 583 */ 584 584 function bbp_remove_group_id_from_all_forums( $group_id = 0 ) { … … 599 599 600 600 /** 601 * Remove a forum from all groups 601 * Remove a forum from all groups. 602 602 * 603 603 * @since 2.1.0 bbPress (r3653) 604 604 * 605 * @param int $forum_id 605 * @param int $forum_id Forum id. 606 606 */ 607 607 function bbp_remove_forum_id_from_all_groups( $forum_id = 0 ) { … … 618 618 619 619 /** 620 * Return true if a forum is a group forum 620 * Return true if a forum is a group forum. 621 621 * 622 622 * @since 2.3.0 bbPress (r4571) 623 623 * 624 * @param int $forum_id 625 * @return bool True if it is a group forum, false if not 624 * @param int $forum_id Forum id. 625 * @return bool True if it is a group forum, false if not. 626 626 */ 627 627 function bbp_is_forum_group_forum( $forum_id = 0 ) { … … 643 643 644 644 /** 645 * Is the current user an admin of the current group 645 * Is the current user an admin of the current group. 646 646 * 647 647 * @since 2.3.0 bbPress (r4632) 648 648 * 649 * @return bool If current user is an admin of the current group 649 * @return bool If current user is an admin of the current group. 650 650 */ 651 651 function bbp_group_is_admin() { … … 668 668 669 669 /** 670 * Is the current user a moderator of the current group 670 * Is the current user a moderator of the current group. 671 671 * 672 672 * @since 2.3.0 bbPress (r4632) 673 673 * 674 * @return bool If current user is a moderator of the current group 674 * @return bool If current user is a moderator of the current group. 675 675 */ 676 676 function bbp_group_is_mod() { … … 693 693 694 694 /** 695 * Is the current user a member of the current group 695 * Is the current user a member of the current group. 696 696 * 697 697 * @since 2.3.0 bbPress (r4632) 698 698 * 699 * @return bool If current user is a member of the current group 699 * @return bool If current user is a member of the current group. 700 700 */ 701 701 function bbp_group_is_member() { … … 718 718 719 719 /** 720 * Is the current user banned from the current group 720 * Is the current user banned from the current group. 721 721 * 722 722 * @since 2.3.0 bbPress (r4632) 723 723 * 724 * @return bool If current user is banned from the current group 724 * @return bool If current user is banned from the current group. 725 725 */ 726 726 function bbp_group_is_banned() { … … 743 743 744 744 /** 745 * Is the current user the creator of the current group 745 * Is the current user the creator of the current group. 746 746 * 747 747 * @since 2.3.0 bbPress (r4632) 748 748 * 749 * @return bool If current user the creator of the current group 749 * @return bool If current user the creator of the current group. 750 750 */ 751 751 function bbp_group_is_creator() { … … 770 770 771 771 /** 772 * Return an array of allowed activity actions 772 * Return an array of allowed activity actions. 773 773 * 774 774 * @since 2.6.0 bbPress (r6370) … … 866 866 * @since 2.6.0 bbPress (r6370) 867 867 * 868 * @param string $activity_action Activity action string value 868 * @param string $activity_action Activity action string value. 869 869 * @param string $type The type of post. Expects `topic` or `reply`. 870 870 * @param string $action The current action string. … … 879 879 * @since 2.6.0 bbPress (r6370) 880 880 * 881 * @param string $action The current action string 882 * @param object $activity The BuddyPress activity object 881 * @param string $action The current action string. 882 * @param object $activity The BuddyPress activity object. 883 883 * 884 884 * @return string The formatted activity action. … … 903 903 * @since 2.6.0 bbPress (r6370) 904 904 * 905 * @param string $action The current action string 906 * @param object $activity The BuddyPress activity object 905 * @param string $action The current action string. 906 * @param object $activity The BuddyPress activity object. 907 907 * 908 908 * @return string The formatted activity action -
trunk/src/includes/extend/buddypress/groups.php
r7379 r7380 2 2 3 3 /** 4 * bbPress BuddyPress Group Extension Class 4 * bbPress BuddyPress Group Extension Class. 5 5 * 6 6 * This file is responsible for connecting bbPress to the BuddyPress Groups … … 17 17 if ( ! class_exists( 'BBP_Forums_Group_Extension' ) && class_exists( 'BP_Group_Extension' ) ) : 18 18 /** 19 * Loads Group Extension for Forums Component 19 * Loads Group Extension for Forums Component. 20 20 * 21 21 * @since 2.1.0 bbPress (r3552) … … 29 29 30 30 /** 31 * Setup bbPress group extension variables 31 * Setup bbPress group extension variables. 32 32 * 33 33 * @since 2.1.0 bbPress (r3552) … … 42 42 43 43 /** 44 * Setup the group forums class variables 44 * Setup the group forums class variables. 45 45 * 46 46 * @since 2.1.0 bbPress (r3552) … … 75 75 76 76 /** 77 * Setup the group forums class actions 77 * Setup the group forums class actions. 78 78 * 79 79 * @since 2.3.0 bbPress (r4552) … … 108 108 109 109 /** 110 * Setup the group forums class filters 110 * Setup the group forums class filters. 111 111 * 112 112 * @since 2.3.0 bbPress (r4552) … … 210 210 211 211 /** 212 * The primary display function for group forums 212 * The primary display function for group forums. 213 213 * 214 214 * @since 2.1.0 bbPress (r3746) … … 235 235 236 236 /** 237 * Maybe unset the group forum nav item if group does not have a forum 237 * Maybe unset the group forum nav item if group does not have a forum. 238 238 * 239 239 * @since 2.3.0 bbPress (r4552) 240 240 * 241 * @return If not viewing a single group 241 * @return If not viewing a single group. 242 242 */ 243 243 public function maybe_unset_forum_menu() { … … 339 339 * @since 2.6.14 340 340 * 341 * @param int $topic_id 341 * @param int $topic_id Topic id. 342 342 */ 343 343 public function validate_topic_forum_id( $topic_id = 0 ) { … … 400 400 * @since 2.6.14 401 401 * 402 * @param int $reply_id 402 * @param int $reply_id Reply id. 403 403 */ 404 404 public function validate_reply_to_id( $reply_id = 0 ) { … … 456 456 457 457 /** 458 * Show forums and new forum form when editing a group 458 * Show forums and new forum form when editing a group. 459 459 * 460 460 * @since 2.1.0 bbPress (r3563) … … 522 522 523 523 /** 524 * Save the Group Forum data on edit 524 * Save the Group Forum data on edit. 525 525 * 526 526 * @since 2.0.0 bbPress (r3465) 527 527 * 528 * @param int $group_id (to handle Group Admin UI hook bp_group_admin_edit_after )528 * @param int $group_id (to handle Group Admin UI hook bp_group_admin_edit_after). 529 529 */ 530 530 public function edit_screen_save( $group_id = 0 ) { … … 633 633 634 634 /** 635 * Adds a meta-box to BuddyPress Group Admin UI 635 * Adds a meta-box to BuddyPress Group Admin UI. 636 636 * 637 637 * @since 2.3.0 bbPress (r4814) … … 649 649 650 650 /** 651 * Displays the bbPress meta-box in BuddyPress Group Admin UI 651 * Displays the bbPress meta-box in BuddyPress Group Admin UI. 652 652 * 653 653 * @since 2.3.0 bbPress (r4814) 654 654 * 655 * @param object $item (group object) 655 * @param object $item (group object). 656 656 */ 657 657 public function group_admin_ui_display_metabox( $item ) { … … 662 662 663 663 /** 664 * Show forums and new forum form when creating a group 664 * Show forums and new forum form when creating a group. 665 665 * 666 666 * @since 2.0.0 bbPress (r3465) … … 692 692 693 693 /** 694 * Save the Group Forum data on create 694 * Save the Group Forum data on create. 695 695 * 696 696 * @since 2.0.0 bbPress (r3465) … … 781 781 782 782 /** 783 * Used to start an output buffer 783 * Used to start an output buffer. 784 784 * 785 785 * @since 2.1.0 bbPress (r3746) … … 790 790 791 791 /** 792 * Used to end an output buffer 792 * Used to end an output buffer. 793 793 * 794 794 * @since 2.1.0 bbPress (r3746) … … 799 799 800 800 /** 801 * Creating a group forum or category (including root for group) 801 * Creating a group forum or category (including root for group). 802 802 * 803 803 * @since 2.1.0 bbPress (r3653) … … 805 805 * @param array $forum_args 806 806 * 807 * @return void if no forum_id is available 807 * @return void if no forum_id is available. 808 808 */ 809 809 public function new_forum( $forum_args = array() ) { … … 825 825 826 826 /** 827 * Removing a group forum or category (including root for group) 827 * Removing a group forum or category (including root for group). 828 828 * 829 829 * @since 2.1.0 bbPress (r3653) … … 831 831 * @param array $forum_args 832 832 * 833 * @return void if no forum_id is available 833 * @return void if no forum_id is available. 834 834 */ 835 835 public function remove_forum( $forum_args = array() ) { … … 851 851 852 852 /** 853 * Listening to BuddyPress Group deletion to remove the forum 853 * Listening to BuddyPress Group deletion to remove the forum. 854 854 * 855 855 * @since 2.3.0 bbPress (r4815) 856 856 * 857 * @param int $group_id The group ID 857 * @param int $group_id The group ID. 858 858 */ 859 859 public function disconnect_forum_from_group( $group_id = 0 ) { … … 888 888 * Update forum attributes to match those of the associated group. 889 889 * 890 * Fired whenever a group is saved 890 * Fired whenever a group is saved. 891 891 * 892 892 * @since 2.6.7 bbPress (r7208) … … 968 968 969 969 /** 970 * Toggle the enable_forum group setting on or off 970 * Toggle the enable_forum group setting on or off. 971 971 * 972 972 * @since 2.3.0 bbPress (r4612) 973 973 * 974 * @param int $group_id The group to toggle 975 * @param bool $enabled True for on, false for off 976 * @return False if group is not found, otherwise return the group 974 * @param int $group_id The group to toggle. 975 * @param bool $enabled True for on, false for off. 976 * @return False if group is not found, otherwise return the group. 977 977 */ 978 978 public function toggle_group_forum( $group_id = 0, $enabled = false ) { … … 1007 1007 1008 1008 /** 1009 * Output the forums for a group in the edit screens 1009 * Output the forums for a group in the edit screens. 1010 1010 * 1011 1011 * As of right now, bbPress only supports 1-to-1 group forum relationships. … … 1241 1241 1242 1242 /** 1243 * Strip super stickies from the topic query 1243 * Strip super stickies from the topic query. 1244 1244 * 1245 1245 * @since 2.3.0 bbPress (r4810) 1246 1246 * 1247 1247 * @access private 1248 * @param array $super the super sticky post ID's 1248 * @param array $super the super sticky post ID's. 1249 1249 * @return array (empty) 1250 1250 */ … … 1255 1255 1256 1256 /** 1257 * Unset the type super sticky from topic type 1257 * Unset the type super sticky from topic type. 1258 1258 * 1259 1259 * @since 2.3.0 bbPress (r4810) … … 1261 1261 * @access private 1262 1262 * @param array $args 1263 * @return array $args without the to-front link 1263 * @return array $args without the to-front link. 1264 1264 */ 1265 1265 public function unset_super_sticky( $args = array() ) { … … 1271 1271 1272 1272 /** 1273 * Ugly preg_replace to hide the to front admin link 1273 * Ugly preg_replace to hide the to front admin link. 1274 1274 * 1275 1275 * @since 2.3.0 bbPress (r4810) … … 1278 1278 * @param string $retval 1279 1279 * @param array $args 1280 * @return string $retval without the to-front link 1280 * @return string $retval without the to-front link. 1281 1281 */ 1282 1282 public function hide_super_sticky_admin_link( $retval = '', $args = array() ) { … … 1291 1291 1292 1292 /** 1293 * Redirect to the group forum screen 1293 * Redirect to the group forum screen. 1294 1294 * 1295 1295 * @since 2.1.0 bbPress (r3653) … … 1309 1309 1310 1310 /** 1311 * Redirect to the group forum screen 1311 * Redirect to the group forum screen. 1312 1312 * 1313 1313 * @since 2.1.0 bbPress (r3653) … … 1342 1342 1343 1343 /** 1344 * Redirect to the group admin forum edit screen 1344 * Redirect to the group admin forum edit screen. 1345 1345 * 1346 1346 * @since 2.1.0 bbPress (r3653) … … 1529 1529 1530 1530 /** 1531 * Maybe map a bbPress forum/topic/reply permalink to the corresponding group 1531 * Maybe map a bbPress forum/topic/reply permalink to the corresponding group. 1532 1532 * 1533 1533 * @since 2.2.0 bbPress (r4266) 1534 1534 * 1535 1535 * @param int $post_id 1536 * @return Bail early if not a group forum post 1536 * @return Bail early if not a group forum post. 1537 1537 * @return string 1538 1538 */ … … 1585 1585 1586 1586 /** 1587 * Map a forum permalink to its corresponding group 1587 * Map a forum permalink to its corresponding group. 1588 1588 * 1589 1589 * @since 2.1.0 bbPress (r3802) … … 1598 1598 1599 1599 /** 1600 * Map a topic permalink to its group forum 1600 * Map a topic permalink to its group forum. 1601 1601 * 1602 1602 * @since 2.1.0 bbPress (r3802) … … 1611 1611 1612 1612 /** 1613 * Map a reply permalink to its group forum 1613 * Map a reply permalink to its group forum. 1614 1614 * 1615 1615 * @since 2.1.0 bbPress (r3802) … … 1624 1624 1625 1625 /** 1626 * Map a reply edit link to its group forum 1626 * Map a reply edit link to its group forum. 1627 1627 * 1628 1628 * @since 2.2.0 bbPress (r4266) … … 1643 1643 1644 1644 /** 1645 * Map a post link to its group forum 1645 * Map a post link to its group forum. 1646 1646 * 1647 1647 * @since 2.2.0 bbPress (r4266) … … 1657 1657 1658 1658 /** 1659 * Map a page link to its group forum 1659 * Map a page link to its group forum. 1660 1660 * 1661 1661 * @since 2.2.0 bbPress (r4266) … … 1671 1671 1672 1672 /** 1673 * Map a custom post type link to its group forum 1673 * Map a custom post type link to its group forum. 1674 1674 * 1675 1675 * @since 2.2.0 bbPress (r4266) … … 1686 1686 1687 1687 /** 1688 * Fix pagination of topics on forum view 1688 * Fix pagination of topics on forum view. 1689 1689 * 1690 1690 * @since 2.2.0 bbPress (r4266) … … 1706 1706 1707 1707 /** 1708 * Fix pagination of replies on topic view 1708 * Fix pagination of replies on topic view. 1709 1709 * 1710 1710 * @since 2.2.0 bbPress (r4266) … … 1732 1732 * @since 2.6.14 1733 1733 * 1734 * @param object $query Verified query object 1735 * @param string $type Type of variable to compare to 1736 * @return mixed Verified object if valid, Default or null if invalid 1734 * @param object $query Verified query object. 1735 * @param string $type Type of variable to compare to. 1736 * @return mixed Verified object if valid, Default or null if invalid. 1737 1737 */ 1738 1738 public function rewrite_pagination( $query, $type = '' ) { -
trunk/src/includes/extend/buddypress/loader.php
r7379 r7380 2 2 3 3 /** 4 * bbPress BuddyPress Component Class 4 * bbPress BuddyPress Component Class. 5 5 * 6 6 * bbPress and BuddyPress are designed to connect together seamlessly and … … 23 23 if ( ! class_exists( 'BBP_Forums_Component' ) ) : 24 24 /** 25 * Loads Forums Component 25 * Loads Forums Component. 26 26 * 27 27 * @since 2.1.0 bbPress (r3552) … … 33 33 34 34 /** 35 * BuddyPress Members component shim 35 * BuddyPress Members component shim. 36 36 * 37 37 * @since 2.0.0 … … 42 42 43 43 /** 44 * BuddyPress Activity component shim 44 * BuddyPress Activity component shim. 45 45 * 46 46 * @since 2.0.0 … … 51 51 52 52 /** 53 * Start the forums component creation process 53 * Start the forums component creation process. 54 54 * 55 55 * @since 2.1.0 bbPress (r3552) … … 68 68 69 69 /** 70 * Include BuddyPress classes and functions 70 * Include BuddyPress classes and functions. 71 71 */ 72 72 public function includes( $includes = array() ) { … … 111 111 112 112 /** 113 * Setup globals 113 * Setup globals. 114 114 * 115 115 * The BP_FORUMS_SLUG constant is deprecated, and only used here for … … 144 144 145 145 /** 146 * Setup the actions 146 * Setup the actions. 147 147 * 148 148 * @since 2.0.0 bbPress (r3395) … … 160 160 161 161 /** 162 * Instantiate classes for BuddyPress integration 162 * Instantiate classes for BuddyPress integration. 163 163 * 164 164 * @since 2.0.0 bbPress (r3395) … … 191 191 192 192 /** 193 * Setup BuddyBar navigation 193 * Setup BuddyBar navigation. 194 194 * 195 195 * @since 2.1.0 bbPress (r3552) … … 292 292 293 293 /** 294 * Set up the admin bar 294 * Set up the admin bar. 295 295 * 296 296 * @since 2.1.0 bbPress (r3552) … … 384 384 385 385 /** 386 * Sets up the title for pages and <title> 386 * Sets up the title for pages and <title>. 387 387 * 388 388 * @since 2.1.0 bbPress (r3552) -
trunk/src/includes/extend/buddypress/members.php
r7311 r7380 2 2 3 3 /** 4 * bbPress BuddyPress Members Class 4 * bbPress BuddyPress Members Class. 5 5 * 6 6 * @package bbPress … … 13 13 if ( ! class_exists( 'BBP_Forums_Members' ) ) : 14 14 /** 15 * Member profile modifications 15 * Member profile modifications. 16 16 * 17 17 * @since 2.2.0 bbPress (r4395) … … 24 24 25 25 /** 26 * Main constructor for modifying bbPress profile links 26 * Main constructor for modifying bbPress profile links. 27 27 * 28 28 * @since 2.2.0 bbPress (r4395) … … 35 35 36 36 /** 37 * Setup the actions 37 * Setup the actions. 38 38 * 39 39 * @since 2.2.0 bbPress (r4395) … … 60 60 61 61 /** 62 * Setup the filters 62 * Setup the filters. 63 63 * 64 64 * @since 2.2.0 bbPress (r4395) … … 89 89 90 90 /** 91 * Override bbPress profile URL with BuddyPress profile URL 91 * Override bbPress profile URL with BuddyPress profile URL. 92 92 * 93 93 * @since 2.0.0 bbPress (r3401) … … 102 102 103 103 /** 104 * Override bbPress topics created URL with BuddyPress profile URL 104 * Override bbPress topics created URL with BuddyPress profile URL. 105 105 * 106 106 * @since 2.6.0 bbPress (r3721) … … 115 115 116 116 /** 117 * Override bbPress replies created URL with BuddyPress profile URL 117 * Override bbPress replies created URL with BuddyPress profile URL. 118 118 * 119 119 * @since 2.6.0 bbPress (r3721) … … 128 128 129 129 /** 130 * Override bbPress favorites URL with BuddyPress profile URL 130 * Override bbPress favorites URL with BuddyPress profile URL. 131 131 * 132 132 * @since 2.1.0 bbPress (r3721) … … 141 141 142 142 /** 143 * Override bbPress subscriptions URL with BuddyPress profile URL 143 * Override bbPress subscriptions URL with BuddyPress profile URL. 144 144 * 145 145 * @since 2.1.0 bbPress (r3721) … … 154 154 155 155 /** 156 * Override bbPress engagements URL with BuddyPress profile URL 156 * Override bbPress engagements URL with BuddyPress profile URL. 157 157 * 158 158 * @since 2.6.0 bbPress (r6320) … … 173 173 * 174 174 * @global WP_Query $wp_query 175 * @return If not viewing your own profile 175 * @return If not viewing your own profile. 176 176 */ 177 177 public function set_member_forum_query_vars() { … … 210 210 211 211 /** 212 * Private method used to concatenate user IDs and slugs into URLs 212 * Private method used to concatenate user IDs and slugs into URLs. 213 213 * 214 214 * @since 2.6.0 bbPress (r6803) -
trunk/src/includes/extend/buddypress/notifications.php
r7378 r7380 2 2 3 3 /** 4 * bbPress BuddyPress Notifications 4 * bbPress BuddyPress Notifications. 5 5 * 6 6 * @package bbPress … … 44 44 45 45 /** 46 * Format the BuddyBar/Toolbar notifications 46 * Format the BuddyBar/Toolbar notifications. 47 47 * 48 48 * @since 2.5.0 bbPress (r5155) … … 193 193 194 194 /** 195 * Mark notifications as read when reading a topic 195 * Mark notifications as read when reading a topic. 196 196 * 197 197 * @since 2.5.0 bbPress (r5155) 198 198 * 199 * @return If not trying to mark a notification as read 199 * @return If not trying to mark a notification as read. 200 200 */ 201 201 function bbp_buddypress_mark_notifications( $action = '' ) { -
trunk/src/includes/forums/capabilities.php
r7378 r7380 2 2 3 3 /** 4 * bbPress Forum Capabilit es4 * bbPress Forum Capabilities. 5 5 * 6 6 * Used to map forum capabilities to WordPress's existing capabilities. … … 11 11 12 12 /** 13 * Return forum capabilities 13 * Return forum capabilities. 14 14 * 15 15 * @since 2.0.0 bbPress (r2593) 16 16 * 17 * @return array Forum capabilities 17 * @return array Forum capabilities. 18 18 */ 19 19 function bbp_get_forum_caps() { … … 35 35 36 36 /** 37 * Maps forum capabilities 37 * Maps forum capabilities. 38 38 * 39 39 * @since 2.2.0 bbPress (r4242) 40 40 * 41 * @param array $caps Capabilities for meta capability 42 * @param string $cap Capability name 43 * @param int $user_id User id 44 * @param array $args Arguments 45 * @return array Actual capabilities for meta capability 41 * @param array $caps Capabilities for meta capability. 42 * @param string $cap Capability name. 43 * @param int $user_id User id. 44 * @param array $args Arguments. 45 * @return array Actual capabilities for meta capability. 46 46 */ 47 47 function bbp_map_forum_meta_caps( $caps = array(), $cap = '', $user_id = 0, $args = array() ) { … … 236 236 * @param int $forum_id Forum id. 237 237 * 238 * @return bool Return true if user is moderator of forum 238 * @return bool Return true if user is moderator of forum. 239 239 */ 240 240 function bbp_is_user_forum_moderator( $user_id = 0, $forum_id = 0 ) { … … 260 260 * @since 2.6.0 bbPress (r6426) 261 261 * 262 * @param array $forum_ids Forum IDs to check if the user ID is a moderator of 263 * @param int $user_id User ID to check if is a moderator of forums 262 * @param array $forum_ids Forum IDs to check if the user ID is a moderator of. 263 * @param int $user_id User ID to check if is a moderator of forums. 264 264 * 265 265 * @return array -
trunk/src/includes/forums/functions.php
r7379 r7380 19 19 * @since 2.0.0 bbPress (r3349) 20 20 * 21 * @param array $forum_data Forum post data 22 * @param array $forum_meta Forum meta data 21 * @param array $forum_data Forum post data. 22 * @param array $forum_meta Forum meta data. 23 * 24 * @return int|false Forum ID on success, false on failure. 23 25 */ 24 26 function bbp_insert_forum( $forum_data = array(), $forum_meta = array() ) { … … 121 123 122 124 /** 123 * Handles the front end forum submission 124 * 125 * @param string $action The requested action to compare this function to 125 * Handles the front end forum submission. 126 * 127 * @param string $action The requested action to compare this function to. 126 128 */ 127 129 function bbp_new_forum_handler( $action = '' ) { … … 387 389 388 390 /** 389 * Handles the front end edit forum submission 390 * 391 * @param string $action The requested action to compare this function to 391 * Handles the front end edit forum submission. 392 * 393 * @param string $action The requested action to compare this function to. 392 394 */ 393 395 function bbp_edit_forum_handler( $action = '' ) { … … 642 644 643 645 /** 644 * Handle the saving of core forum metadata (Status, Visibility, and Type) 646 * Handle the saving of core forum metadata (Status, Visibility, and Type). 645 647 * 646 648 * @since 2.1.0 bbPress (r3678) 647 649 * 648 * @param int $forum_id 649 * @return If forum ID is empty 650 * @param int $forum_id. 651 * @return If forum ID is empty. 650 652 */ 651 653 function bbp_save_forum_extras( $forum_id = 0 ) { … … 714 716 715 717 /** 716 * Allow custom forum visibility save actions 718 * Allow custom forum visibility save actions. 717 719 * 718 720 * @since 2.6.0 bbPress (r5855) 719 721 * 720 * @param int $forum_id The forum ID 721 * @param string $old_visibility The current forum visibility 722 * @param string $new_visibility The new forum visibility 722 * @param int $forum_id The forum ID. 723 * @param string $old_visibility The current forum visibility. 724 * @param string $new_visibility The new forum visibility. 723 725 */ 724 726 do_action( 'bbp_update_forum_visibility', $forum_id, $old_visibility, $new_visibility ); … … 757 759 758 760 /** 759 * Closes a forum 761 * Closes a forum. 760 762 * 761 763 * @since 2.0.0 bbPress (r2746) 762 764 * 763 * @param int $forum_id forum id 764 * @return mixed False or {@link WP_Error} on failure, forum id on success 765 * @param int $forum_id forum id. 766 * @return mixed False or {@link WP_Error} on failure, forum id on success. 765 767 */ 766 768 function bbp_close_forum( $forum_id = 0 ) { … … 778 780 779 781 /** 780 * Opens a forum 782 * Opens a forum. 781 783 * 782 784 * @since 2.0.0 bbPress (r2746) 783 785 * 784 * @param int $forum_id forum id 785 * @return mixed False or {@link WP_Error} on failure, forum id on success 786 * @param int $forum_id forum id. 787 * @return mixed False or {@link WP_Error} on failure, forum id on success. 786 788 */ 787 789 function bbp_open_forum( $forum_id = 0 ) { … … 801 803 802 804 /** 803 * Make the forum a category 805 * Make the forum a category. 804 806 * 805 807 * @since 2.0.0 bbPress (r2746) 806 808 * 807 * @param int $forum_id Optional. Forum id 808 * @return bool False on failure, true on success 809 * @param int $forum_id Optional. Forum id. 810 * @return bool False on failure, true on success. 809 811 */ 810 812 function bbp_categorize_forum( $forum_id = 0 ) { … … 822 824 823 825 /** 824 * Remove the category status from a forum 826 * Remove the category status from a forum. 825 827 * 826 828 * @since 2.0.0 bbPress (r2746) 827 829 * 828 * @param int $forum_id Optional. Forum id 829 * @return bool False on failure, true on success 830 * @param int $forum_id Optional. Forum id. 831 * @return bool False on failure, true on success. 830 832 */ 831 833 function bbp_normalize_forum( $forum_id = 0 ) { … … 845 847 846 848 /** 847 * Mark the forum as public 849 * Mark the forum as public. 848 850 * 849 851 * @since 2.0.0 bbPress (r2746) 850 852 * 851 * @param int $forum_id Optional. Forum id 852 * @return bool False on failure, true on success 853 * @param int $forum_id Optional. Forum id. 854 * @return bool False on failure, true on success. 853 855 */ 854 856 function bbp_publicize_forum( $forum_id = 0, $current_visibility = '' ) { … … 902 904 903 905 /** 904 * Mark the forum as private 906 * Mark the forum as private. 905 907 * 906 908 * @since 2.0.0 bbPress (r2746) 907 909 * 908 * @param int $forum_id Optional. Forum id 909 * @return bool False on failure, true on success 910 * @param int $forum_id Optional. Forum id. 911 * @return bool False on failure, true on success. 910 912 */ 911 913 function bbp_privatize_forum( $forum_id = 0, $current_visibility = '' ) { … … 951 953 952 954 /** 953 * Mark the forum as hidden 955 * Mark the forum as hidden. 954 956 * 955 957 * @since 2.0.0 bbPress (r2996) 956 958 * 957 * @param int $forum_id Optional. Forum id 958 * @return bool False on failure, true on success 959 * @param int $forum_id Optional. Forum id. 960 * @return bool False on failure, true on success. 959 961 */ 960 962 function bbp_hide_forum( $forum_id = 0, $current_visibility = '' ) { … … 1000 1002 1001 1003 /** 1002 * Re caches the private and hidden forums1004 * Re-caches the private and hidden forums. 1003 1005 * 1004 1006 * @since 2.4.0 bbPress (r5017) 1005 1007 * 1006 * @return array An array of the status code and the message 1008 * @return array An array of the status code and the message. 1007 1009 */ 1008 1010 function bbp_repair_forum_visibility() { … … 1080 1082 1081 1083 /** 1082 * Remove a deleted forum from all user subscriptions 1084 * Remove a deleted forum from all user subscriptions. 1083 1085 * 1084 1086 * @since 2.5.0 bbPress (r5156) 1085 1087 * 1086 * @param int $forum_id Get the forum ID to remove 1088 * @param int $forum_id Get the forum ID to remove. 1087 1089 */ 1088 1090 function bbp_remove_forum_from_all_subscriptions( $forum_id = 0 ) { … … 1106 1108 1107 1109 /** 1108 * Bump the total topic count of a forum 1110 * Bump the total topic count of a forum. 1109 1111 * 1110 1112 * @since 2.1.0 bbPress (r3825) … … 1170 1172 * 1171 1173 * @param int $forum_id The forum id. 1172 * @return void1173 1174 */ 1174 1175 function bbp_increase_forum_topic_count( $forum_id = 0 ) { … … 1201 1202 * 1202 1203 * @param int $forum_id The forum id. 1203 *1204 * @return void1205 1204 */ 1206 1205 function bbp_decrease_forum_topic_count( $forum_id = 0 ) { … … 1228 1227 1229 1228 /** 1230 * Bump the total topic count of a forum 1229 * Bump the total topic count of a forum. 1231 1230 * 1232 1231 * @since 2.1.0 bbPress (r3825) … … 1292 1291 * 1293 1292 * @param int $forum_id The forum id. 1294 *1295 * @return void1296 1293 */ 1297 1294 function bbp_increase_forum_topic_count_hidden( $forum_id = 0 ) { … … 1324 1321 * 1325 1322 * @param int $forum_id The forum id. 1326 *1327 * @return void1328 1323 */ 1329 1324 function bbp_decrease_forum_topic_count_hidden( $forum_id = 0 ) { … … 1351 1346 1352 1347 /** 1353 * Bump the total topic count of a forum 1348 * Bump the total topic count of a forum. 1354 1349 * 1355 1350 * @since 2.1.0 bbPress (r3825) 1356 1351 * 1357 1352 * @param int $forum_id Optional. Forum id. 1358 * @param int $difference Optional. Default 1 1359 * @param bool $update_ancestors Optional. Default true 1353 * @param int $difference Optional. Default 1. 1354 * @param bool $update_ancestors Optional. Default true. 1360 1355 * 1361 1356 * @return int Forum topic count … … 1410 1405 1411 1406 /** 1412 * Bump the total topic count of a forum 1407 * Bump the total topic count of a forum. 1413 1408 * 1414 1409 * @since 2.6.0 bbPress (r6922) 1415 1410 * 1416 1411 * @param int $forum_id Optional. Forum id. 1417 * @param int $difference Optional. Default 1 1418 * @param bool $update_ancestors Optional. Default true 1412 * @param int $difference Optional. Default 1. 1413 * @param bool $update_ancestors Optional. Default true. 1419 1414 * 1420 1415 * @return int Forum topic count … … 1474 1469 * 1475 1470 * @param int $forum_id The forum id. 1476 *1477 * @return void1478 1471 */ 1479 1472 function bbp_increase_forum_reply_count( $forum_id = 0 ) { … … 1506 1499 * 1507 1500 * @param int $forum_id The forum id. 1508 *1509 * @return void1510 1501 */ 1511 1502 function bbp_decrease_forum_reply_count( $forum_id = 0 ) { … … 1538 1529 * 1539 1530 * @param int $forum_id The forum id. 1540 *1541 * @return void1542 1531 */ 1543 1532 function bbp_increase_forum_reply_count_hidden( $forum_id = 0 ) { … … 1570 1559 * 1571 1560 * @param int $forum_id The forum id. 1572 *1573 * @return void1574 1561 */ 1575 1562 function bbp_decrease_forum_reply_count_hidden( $forum_id = 0 ) { … … 1602 1589 * 1603 1590 * @param int $topic_id The topic id. 1604 *1605 * @return void1606 1591 */ 1607 1592 function bbp_approved_unapproved_topic_update_forum_reply_count( $topic_id = 0 ) { … … 1627 1612 1628 1613 /** 1629 * Update the forum last topic id 1614 * Update the forum last topic id. 1630 1615 * 1631 1616 * @since 2.0.0 bbPress (r2625) … … 1633 1618 * @param int $forum_id Optional. Forum id. 1634 1619 * @param int $topic_id Optional. Topic id. 1635 * @return int Id of the forums most recent topic 1620 * @return int Id of the forums most recent topic. 1636 1621 */ 1637 1622 function bbp_update_forum_last_topic_id( $forum_id = 0, $topic_id = 0 ) { … … 1686 1671 1687 1672 /** 1688 * Update the forum last reply id 1673 * Update the forum last reply id. 1689 1674 * 1690 1675 * @since 2.0.0 bbPress (r2625) … … 1692 1677 * @param int $forum_id Optional. Forum id. 1693 1678 * @param int $reply_id Optional. Reply id. 1694 * @return int Id of the forums most recent reply 1679 * @return int Id of the forums most recent reply. 1695 1680 */ 1696 1681 function bbp_update_forum_last_reply_id( $forum_id = 0, $reply_id = 0 ) { … … 1742 1727 1743 1728 /** 1744 * Update the forum last active post id 1729 * Update the forum last active post id. 1745 1730 * 1746 1731 * @since 2.0.0 bbPress (r2860) … … 1748 1733 * @param int $forum_id Optional. Forum id. 1749 1734 * @param int $active_id Optional. Active post id. 1750 * @return int Id of the forums last active post 1735 * @return int Id of the forums last active post. 1751 1736 */ 1752 1737 function bbp_update_forum_last_active_id( $forum_id = 0, $active_id = 0 ) { … … 1800 1785 1801 1786 /** 1802 * Update the forums last active date/time (aka freshness) 1787 * Update the forums last active date/time (aka freshness). 1803 1788 * 1804 1789 * @since 2.0.0 bbPress (r2680) … … 1807 1792 * @param string $new_time Optional. New time in mysql format. 1808 1793 * 1809 * @return string MySQL timestamp of last active topic or reply 1794 * @return string MySQL timestamp of last active topic or reply. 1810 1795 */ 1811 1796 function bbp_update_forum_last_active_time( $forum_id = 0, $new_time = '' ) { … … 1827 1812 1828 1813 /** 1829 * Update the forum sub-forum count 1814 * Update the forum sub-forum count. 1830 1815 * 1831 1816 * @since 2.0.0 bbPress (r2625) 1832 1817 * 1833 * @param int $forum_id Optional. Forum id 1834 * @param int $subforums Optional. Number of subforums 1835 * @return bool True on success, false on failure 1818 * @param int $forum_id Optional. Forum id. 1819 * @param int $subforums Optional. Number of subforums. 1820 * @return bool True on success, false on failure. 1836 1821 */ 1837 1822 function bbp_update_forum_subforum_count( $forum_id = 0, $subforums = false ) { … … 1850 1835 1851 1836 /** 1852 * Adjust the total topic count of a forum 1837 * Adjust the total topic count of a forum. 1853 1838 * 1854 1839 * @since 2.0.0 bbPress (r2464) … … 1857 1842 * is a topic or a forum. If it's a topic, its parent, 1858 1843 * i.e. the forum is automatically retrieved. 1859 * @param bool $total_count Optional. To return the total count or normal count ?1860 * @return int Forum topic count 1844 * @param bool $total_count Optional. To return the total count or normal count. 1845 * @return int Forum topic count. 1861 1846 */ 1862 1847 function bbp_update_forum_topic_count( $forum_id = 0 ) { … … 1888 1873 /** 1889 1874 * Adjust the total hidden topic count of a forum (hidden includes trashed, 1890 * spammed and pending topics) 1875 * spammed and pending topics). 1891 1876 * 1892 1877 * @since 2.0.0 bbPress (r2888) … … 1896 1881 * @param int $topic_count Optional. Set the topic count manually. 1897 1882 * 1898 * @return int Topic hidden topic count 1883 * @return int Topic hidden topic count. 1899 1884 */ 1900 1885 function bbp_update_forum_topic_count_hidden( $forum_id = 0, $topic_count = false ) { … … 1949 1934 1950 1935 /** 1951 * Adjust the total reply count of a forum 1936 * Adjust the total reply count of a forum. 1952 1937 * 1953 1938 * @since 2.0.0 bbPress (r2464) 1954 * @since 2.6.0 bbPress (r5954) Replace direct queries with WP_Query() objects 1939 * @since 2.6.0 bbPress (r5954) Replace direct queries with WP_Query() objects. 1955 1940 * 1956 1941 * @param int $forum_id Optional. Forum id or topic id. It is checked whether it … … 1958 1943 * i.e. the forum is automatically retrieved. 1959 1944 * 1960 * @return int Forum reply count 1945 * @return int Forum reply count. 1961 1946 */ 1962 1947 function bbp_update_forum_reply_count( $forum_id = 0 ) { … … 1990 1975 1991 1976 /** 1992 * Adjust the total hidden reply count of a forum 1977 * Adjust the total hidden reply count of a forum. 1993 1978 * 1994 1979 * @since 2.6.0 bbPress (r6922) … … 1998 1983 * i.e. the forum is automatically retrieved. 1999 1984 * 2000 * @return int Forum reply count 1985 * @return int Forum reply count. 2001 1986 */ 2002 1987 function bbp_update_forum_reply_count_hidden( $forum_id = 0 ) { … … 2109 2094 2110 2095 /** 2111 * Return an associative array of available topic statuses 2096 * Return an associative array of available topic statuses. 2112 2097 * 2113 2098 * Developers note: these statuses are actually stored as meta data, and … … 2116 2101 * @since 2.4.0 bbPress (r5059) 2117 2102 * 2118 * @param int $forum_id Optional. Forum id.2103 * @param int $forum_id Optional. Forum id. 2119 2104 * 2120 2105 * @return array … … 2134 2119 2135 2120 /** 2136 * Return an associative array of forum type s2121 * Return an associative array of forum type. 2137 2122 * 2138 2123 * @since 2.4.0 bbPress (r5059) 2139 2124 * 2140 * @param int $forum_id Optional. Forum id.2125 * @param int $forum_id Optional. Forum id. 2141 2126 * 2142 2127 * @return array … … 2163 2148 * @since 2.4.0 bbPress (r5059) 2164 2149 * 2165 * @param int $forum_id Optional. Forum id.2150 * @param int $forum_id Optional. Forum id. 2166 2151 * 2167 2152 * @return array … … 2217 2202 2218 2203 /** 2219 * Returns the hidden forum ids 2204 * Returns the hidden forum ids. 2220 2205 * 2221 2206 * Only hidden forum ids are returned. Public and private ids are not. … … 2234 2219 2235 2220 /** 2236 * Returns the private forum ids 2221 * Returns the private forum ids. 2237 2222 * 2238 2223 * Only private forum ids are returned. Public and hidden ids are not. … … 2256 2241 * @since 2.6.0 bbPress (r6425) 2257 2242 * 2258 * @return array Forum IDs to exclude, or an empty array 2243 * @return array Forum IDs to exclude, or an empty array. 2259 2244 */ 2260 2245 function bbp_get_excluded_forum_ids() { … … 2285 2270 * @since 2.0.0 bbPress (r3291) 2286 2271 * 2287 * @param string Optional. The type of value to return . (string|array|meta_query)2272 * @param string Optional. The type of value to return (string|array|meta_query). 2288 2273 */ 2289 2274 function bbp_exclude_forum_ids( $type = 'string' ) { … … 2421 2406 2422 2407 /** 2423 * Returns the forum's topic ids 2424 * 2425 * Only topics with published and closed statuses are returned 2408 * Returns the forum's topic ids. 2409 * 2410 * Only topics with published and closed statuses are returned. 2426 2411 * 2427 2412 * @since 2.0.0 bbPress (r2908) 2428 2413 * 2429 * @param int $forum_id Forum id 2414 * @param int $forum_id Forum id. 2430 2415 */ 2431 2416 function bbp_forum_query_topic_ids( $forum_id ) { … … 2437 2422 2438 2423 /** 2439 * Returns the forum's subforum ids 2440 * 2441 * Only forums with published status are returned 2424 * Returns the forum's subforum ids. 2425 * 2426 * Only forums with published status are returned. 2442 2427 * 2443 2428 * @since 2.0.0 bbPress (r2908) 2444 2429 * 2445 * @param int $forum_id Forum id 2430 * @param int $forum_id Forum id. 2446 2431 */ 2447 2432 function bbp_forum_query_subforum_ids( $forum_id ) { … … 2453 2438 2454 2439 /** 2455 * Returns the forum's last reply id 2440 * Returns the forum's last reply id. 2456 2441 * 2457 2442 * @since 2.0.0 bbPress (r2908) 2458 * @since 2.6.0 bbPress (r5954) Replace direct queries with WP_Query() objects 2443 * @since 2.6.0 bbPress (r5954) Replace direct queries with WP_Query() objects. 2459 2444 * 2460 2445 * @param int $forum_id Forum id. … … 2504 2489 /** 2505 2490 * Check if it's a hidden forum or a topic or reply of a hidden forum and if 2506 * the user can't view it, then sets a 404 2491 * the user can't view it, then sets a 404. 2507 2492 * 2508 2493 * @since 2.0.0 bbPress (r2996) … … 2551 2536 /** 2552 2537 * Check if it's a private forum or a topic or reply of a private forum and if 2553 * the user can't view it, then sets a 404 2538 * the user can't view it, then sets a 404. 2554 2539 * 2555 2540 * @since 2.0.0 bbPress (r2996) … … 2599 2584 2600 2585 /** 2601 * Redirect if unauthorized user is attempting to edit a forum 2586 * Redirect if unauthorized user is attempting to edit a forum. 2602 2587 * 2603 2588 * @since 2.1.0 bbPress (r3607) … … 2617 2602 2618 2603 /** 2619 * Delete all topics (and their replies) for a specific forum ID 2604 * Delete all topics (and their replies) for a specific forum ID. 2620 2605 * 2621 2606 * @since 2.1.0 bbPress (r3668) 2622 2607 * 2623 2608 * @param int $forum_id 2624 * @return If forum is not valid2625 2609 */ 2626 2610 function bbp_delete_forum_topics( $forum_id = 0 ) { … … 2668 2652 2669 2653 /** 2670 * Trash all topics inside a forum 2654 * Trash all topics inside a forum. 2671 2655 * 2672 2656 * @since 2.1.0 bbPress (r3668) 2673 2657 * 2674 2658 * @param int $forum_id 2675 * @return If forum is not valid2676 2659 */ 2677 2660 function bbp_trash_forum_topics( $forum_id = 0 ) { … … 2736 2719 2737 2720 /** 2738 * Untrash all topics inside a forum 2721 * Untrash all topics inside a forum. 2739 2722 * 2740 2723 * @since 2.1.0 bbPress (r3668) 2741 2724 * 2742 2725 * @param int $forum_id 2743 * @return If forum is not valid2744 2726 */ 2745 2727 function bbp_untrash_forum_topics( $forum_id = 0 ) { … … 2792 2774 2793 2775 /** 2794 * Called before trashing a forum 2776 * Called before trashing a forum. 2795 2777 * 2796 2778 * This function is supplemental to the actual forum being trashed which is … … 2811 2793 2812 2794 /** 2813 * Called before untrashing a forum 2795 * Called before untrashing a forum. 2814 2796 * 2815 2797 * @since 2.1.0 bbPress (r3668) … … 2828 2810 2829 2811 /** 2830 * Called after deleting a forum 2812 * Called after deleting a forum. 2831 2813 * 2832 2814 * Try not to use this action. All meta & taxonomy terms have already been … … 2847 2829 2848 2830 /** 2849 * Called after trashing a forum 2831 * Called after trashing a forum. 2850 2832 * 2851 2833 * @since 2.1.0 bbPress (r3668) … … 2862 2844 2863 2845 /** 2864 * Called after untrashing a forum 2846 * Called after untrashing a forum. 2865 2847 * 2866 2848 * @since 2.1.0 bbPress (r3668) -
trunk/src/includes/forums/template.php
r7379 r7380 2 2 3 3 /** 4 * bbPress Forum Template Tags 4 * bbPress Forum Template Tags. 5 5 * 6 6 * @package bbPress … … 14 14 15 15 /** 16 * Output the unique id of the custom post type for forums 16 * Output the unique id of the custom post type for forums. 17 17 * 18 18 * @since 2.0.0 bbPress (r2857) … … 23 23 24 24 /** 25 * Return the unique id of the custom post type for forums 25 * Return the unique id of the custom post type for forums. 26 26 * 27 27 * @since 2.0.0 bbPress (r2857) 28 28 * 29 * @return string The unique forum post type id 29 * @return string The unique forum post type id. 30 30 */ 31 31 function bbp_get_forum_post_type() { … … 36 36 37 37 /** 38 * Return array of labels used by the forum post type 38 * Return array of labels used by the forum post type. 39 39 * 40 40 * @since 2.5.0 bbPress (r5129) … … 85 85 86 86 /** 87 * Return array of forum post type rewrite settings 87 * Return array of forum post type rewrite settings. 88 88 * 89 89 * @since 2.5.0 bbPress (r5129) … … 104 104 105 105 /** 106 * Return array of features the forum post type supports 106 * Return array of features the forum post type supports. 107 107 * 108 108 * @since 2.5.0 bbPress (r5129) … … 134 134 * @param array $args All the arguments supported by {@link WP_Query} 135 135 * 136 * @return object Multidimensional array of forum information 136 * @return object Multidimensional array of forum information. 137 137 */ 138 138 function bbp_has_forums( $args = array() ) { … … 191 191 192 192 /** 193 * Whether there are more forums available in the loop 193 * Whether there are more forums available in the loop. 194 194 * 195 195 * @since 2.0.0 bbPress (r2464) 196 196 * 197 * @return object Forum information 197 * @return object Forum information. 198 198 */ 199 199 function bbp_forums() { … … 211 211 212 212 /** 213 * Loads up the current forum in the loop 213 * Loads up the current forum in the loop. 214 214 * 215 215 * @since 2.0.0 bbPress (r2464) 216 216 * 217 * @return object Forum information 217 * @return object Forum information. 218 218 */ 219 219 function bbp_the_forum() { … … 224 224 225 225 /** 226 * Output forum id 226 * Output forum id. 227 227 * 228 228 * @since 2.0.0 bbPress (r2464) 229 229 * 230 * @param $forum_id Optional. Used to check emptiness 230 * @param $forum_id Optional. Used to check emptiness. 231 231 */ 232 232 function bbp_forum_id( $forum_id = 0 ) { … … 235 235 236 236 /** 237 * Return the forum id 237 * Return the forum id. 238 238 * 239 239 * @since 2.0.0 bbPress (r2464) 240 240 * 241 * @param $forum_id Optional. Used to check emptiness 242 * @return int The forum id 241 * @param $forum_id Optional. Used to check emptiness. 242 * @return int The forum id. 243 243 */ 244 244 function bbp_get_forum_id( $forum_id = 0 ) { … … 280 280 281 281 /** 282 * Gets a forum 282 * Gets a forum. 283 283 * 284 284 * @since 2.0.0 bbPress (r2787) 285 285 * 286 * @param int|object $forum forum id or forum object 287 * @param string $output Optional. OBJECT, ARRAY_A, or ARRAY_N. Default = OBJECT 288 * @param string $filter Optional Sanitation filter. See {@link sanitize_post()} 289 * 290 * @return mixed Null if error or forum (in specified form) if success 286 * @param int|object $forum forum id or forum object. 287 * @param string $output Optional. OBJECT, ARRAY_A, or ARRAY_N. Default = OBJECT. 288 * @param string $filter Optional Sanitation filter. See {@link sanitize_post()}. 289 * 290 * @return mixed Null if error or forum (in specified form) if success. 291 291 */ 292 292 function bbp_get_forum( $forum, $output = OBJECT, $filter = 'raw' ) { … … 325 325 326 326 /** 327 * Output the link to the forum 327 * Output the link to the forum. 328 328 * 329 329 * @since 2.0.0 bbPress (r2464) 330 330 * 331 * @param int $forum_id Optional. Forum id 331 * @param int $forum_id Optional. Forum id. 332 332 * @param string $redirect_to Optional. Pass a redirect value for use with 333 333 * shortcodes and other fun things. … … 338 338 339 339 /** 340 * Return the link to the forum 340 * Return the link to the forum. 341 341 * 342 342 * @since 2.0.0 bbPress (r2464) 343 343 * 344 * @param int $forum_id Optional. Forum id 344 * @param int $forum_id Optional. Forum id. 345 345 * @param string $redirect_to Optional. Pass a redirect value for use with 346 346 * shortcodes and other fun things. 347 347 * 348 * @return string Permanent link to forum 348 * @return string Permanent link to forum. 349 349 */ 350 350 function bbp_get_forum_permalink( $forum_id = 0, $redirect_to = '' ) { … … 398 398 399 399 /** 400 * Output the title of the forum 400 * Output the title of the forum. 401 401 * 402 402 * @since 2.0.0 bbPress (r2464) 403 403 * 404 * @param int $forum_id Optional. Forum id 404 * @param int $forum_id Optional. Forum id. 405 405 */ 406 406 function bbp_forum_title( $forum_id = 0 ) { … … 409 409 410 410 /** 411 * Return the title of the forum 411 * Return the title of the forum. 412 412 * 413 413 * @since 2.0.0 bbPress (r2464) 414 414 * 415 * @param int $forum_id Optional. Forum id 416 * @return string Title of forum 415 * @param int $forum_id Optional. Forum id. 416 * @return string Title of forum. 417 417 */ 418 418 function bbp_get_forum_title( $forum_id = 0 ) { … … 426 426 427 427 /** 428 * Output the forum archive title 428 * Output the forum archive title. 429 429 * 430 430 * @since 2.0.0 bbPress (r3249) 431 431 * 432 * @param string $title Default text to use as title 432 * @param string $title Default text to use as title. 433 433 */ 434 434 function bbp_forum_archive_title( $title = '' ) { … … 437 437 438 438 /** 439 * Return the forum archive title 439 * Return the forum archive title. 440 440 * 441 441 * @since 2.0.0 bbPress (r3249) 442 442 * 443 * @param string $title Default text to use as title 444 * 445 * @return string The forum archive title 443 * @param string $title Default text to use as title. 444 * 445 * @return string The forum archive title. 446 446 */ 447 447 function bbp_get_forum_archive_title( $title = '' ) { … … 467 467 468 468 /** 469 * Output the content of the forum 469 * Output the content of the forum. 470 470 * 471 471 * @since 2.0.0 bbPress (r2780) 472 472 * 473 * @param int $forum_id Optional. Topic id 473 * @param int $forum_id Optional. Topic id. 474 474 */ 475 475 function bbp_forum_content( $forum_id = 0 ) { … … 478 478 479 479 /** 480 * Return the content of the forum 480 * Return the content of the forum. 481 481 * 482 482 * @since 2.0.0 bbPress (r2780) 483 483 * 484 * @param int $forum_id Optional. Topic id 485 * 486 * @return string Content of the forum 484 * @param int $forum_id Optional. Topic id. 485 * 486 * @return string Content of the forum. 487 487 */ 488 488 function bbp_get_forum_content( $forum_id = 0 ) { … … 501 501 502 502 /** 503 * Allow forum rows to have administrative actions 503 * Allow forum rows to have administrative actions. 504 504 * 505 505 * @since 2.1.0 bbPress (r3653) 506 506 * 507 * @todo Links and filter 507 * @todo Links and filter. 508 508 */ 509 509 function bbp_forum_row_actions() { … … 512 512 513 513 /** 514 * Output the forums last active ID 514 * Output the forums last active ID. 515 515 * 516 516 * @since 2.0.0 bbPress (r2860) 517 517 * 518 * @param int $forum_id Optional. Forum id 518 * @param int $forum_id Optional. Forum id. 519 519 */ 520 520 function bbp_forum_last_active_id( $forum_id = 0 ) { … … 523 523 524 524 /** 525 * Return the forums last active ID 525 * Return the forums last active ID. 526 526 * 527 527 * @since 2.0.0 bbPress (r2860) 528 528 * 529 * @param int $forum_id Optional. Forum id 530 * the last active id and forum id 531 * @return int Forum's last active id 529 * @param int $forum_id Optional. Forum id. 530 * the last active id and forum id. 531 * @return int Forum's last active id. 532 532 */ 533 533 function bbp_get_forum_last_active_id( $forum_id = 0 ) { … … 540 540 541 541 /** 542 * Output the forums last update date/time (aka freshness) 542 * Output the forums last update date/time (aka freshness). 543 543 * 544 544 * @since 2.0.0 bbPress (r2464) 545 545 * 546 * @param int $forum_id Optional. Forum id 546 * @param int $forum_id Optional. Forum id. 547 547 */ 548 548 function bbp_forum_last_active_time( $forum_id = 0 ) { … … 551 551 552 552 /** 553 * Return the forums last update date/time (aka freshness) 553 * Return the forums last update date/time (aka freshness). 554 554 * 555 555 * @since 2.0.0 bbPress (r2464) 556 556 * 557 * @param int $forum_id Optional. Forum id 558 * @return string Forum last update date/time (freshness) 557 * @param int $forum_id Optional. Forum id. 558 * @return string Forum last update date/time (freshness). 559 559 */ 560 560 function bbp_get_forum_last_active_time( $forum_id = 0 ) { … … 605 605 * @since 2.0.0 bbPress (r2625) 606 606 * 607 * @param int $forum_id Optional. Forum id 607 * @param int $forum_id Optional. Forum id. 608 608 */ 609 609 function bbp_get_forum_freshness_link( $forum_id = 0 ) { … … 641 641 642 642 /** 643 * Output parent ID of a forum, if exists 643 * Output parent ID of a forum, if exists. 644 644 * 645 645 * @since 2.1.0 bbPress (r3675) 646 646 * 647 * @param int $forum_id Forum ID 647 * @param int $forum_id Forum ID. 648 648 */ 649 649 function bbp_forum_parent_id( $forum_id = 0 ) { … … 652 652 653 653 /** 654 * Return ID of forum parent, if exists 654 * Return ID of forum parent, if exists. 655 655 * 656 656 * @since 2.1.0 bbPress (r3675) 657 657 * 658 * @param int $forum_id Optional. Forum id 659 * @return int Forum parent 658 * @param int $forum_id Optional. Forum id. 659 * @return int Forum parent id. 660 660 */ 661 661 function bbp_get_forum_parent_id( $forum_id = 0 ) { … … 678 678 679 679 /** 680 * Return array of parent forums 680 * Return array of parent forums. 681 681 * 682 682 * @since 2.0.0 bbPress (r2625) 683 683 * 684 * @param int $forum_id Optional. Forum id 685 * @return array Forum ancestors 684 * @param int $forum_id Optional. Forum id. 685 * @return array Forum ancestors. 686 686 */ 687 687 function bbp_get_forum_ancestors( $forum_id = 0 ) { … … 702 702 703 703 /** 704 * Return subforums of given forum 704 * Return subforums of given forum. 705 705 * 706 706 * @since 2.0.0 bbPress (r2747) 707 707 * 708 * @param array $args All the arguments supported by {@link WP_Query} 709 * @return mixed false if none, array of subs if yes 708 * @param array $args All the arguments supported by {@link WP_Query}. 709 * @return mixed false if none, array of subs if yes. 710 710 */ 711 711 function bbp_forum_get_subforums( $args = array() ) { … … 748 748 749 749 /** 750 * Output a list of forums (can be used to list subforums) 750 * Output a list of forums (can be used to list subforums). 751 751 * 752 752 * @since 2.0.0 bbPress (r2708) … … 862 862 863 863 /** 864 * Output the forum subscription link 864 * Output the forum subscription link. 865 865 * 866 866 * @since 2.5.0 bbPress (r5156) … … 872 872 873 873 /** 874 * Get the forum subscription link 875 * 876 * A custom wrapper for bbp_get_user_subscribe_link() 874 * Get the forum subscription link. 875 * 876 * A custom wrapper for bbp_get_user_subscribe_link(). 877 877 * 878 878 * @since 2.5.0 bbPress (r5156) … … 916 916 917 917 /** 918 * Output the forum's last topic id 918 * Output the forum's last topic id. 919 919 * 920 920 * @since 2.0.0 bbPress (r2464) 921 921 * 922 * @param int $forum_id Optional. Forum id 922 * @param int $forum_id Optional. Forum id. 923 923 */ 924 924 function bbp_forum_last_topic_id( $forum_id = 0 ) { … … 927 927 928 928 /** 929 * Return the forum's last topic id 929 * Return the forum's last topic id. 930 930 * 931 931 * @since 2.0.0 bbPress (r2464) 932 932 * 933 * @param int $forum_id Optional. Forum id 934 * @return int Forum's last topic id 933 * @param int $forum_id Optional. Forum id. 934 * @return int Forum's last topic id. 935 935 */ 936 936 function bbp_get_forum_last_topic_id( $forum_id = 0 ) { … … 943 943 944 944 /** 945 * Output the title of the last topic inside a forum 945 * Output the title of the last topic inside a forum. 946 946 * 947 947 * @since 2.0.0 bbPress (r2625) 948 948 * 949 * @param int $forum_id Optional. Forum id 949 * @param int $forum_id Optional. Forum id. 950 950 */ 951 951 function bbp_forum_last_topic_title( $forum_id = 0 ) { … … 954 954 955 955 /** 956 * Return the title of the last topic inside a forum 956 * Return the title of the last topic inside a forum. 957 957 * 958 958 * @since 2.0.0 bbPress (r2625) 959 959 * 960 * @param int $forum_id Optional. Forum id 961 * @return string Forum's last topic's title 960 * @param int $forum_id Optional. Forum id. 961 * @return string Forum's last topic's title. 962 962 */ 963 963 function bbp_get_forum_last_topic_title( $forum_id = 0 ) { … … 973 973 974 974 /** 975 * Output the link to the last topic in a forum 975 * Output the link to the last topic in a forum. 976 976 * 977 977 * @since 2.0.0 bbPress (r2464) 978 978 * 979 * @param int $forum_id Optional. Forum id 979 * @param int $forum_id Optional. Forum id. 980 980 */ 981 981 function bbp_forum_last_topic_permalink( $forum_id = 0 ) { … … 984 984 985 985 /** 986 * Return the link to the last topic in a forum 986 * Return the link to the last topic in a forum. 987 987 * 988 988 * @since 2.0.0 bbPress (r2464) 989 989 * 990 * @param int $forum_id Optional. Forum id 991 * @return string Permanent link to topic 990 * @param int $forum_id Optional. Forum id. 991 * @return string Permanent link to topic. 992 992 */ 993 993 function bbp_get_forum_last_topic_permalink( $forum_id = 0 ) { … … 1001 1001 1002 1002 /** 1003 * Return the author ID of the last topic of a forum 1003 * Return the author ID of the last topic of a forum. 1004 1004 * 1005 1005 * @since 2.0.0 bbPress (r2625) 1006 1006 * 1007 * @param int $forum_id Optional. Forum id 1008 * @return int Forum's last topic's author id 1007 * @param int $forum_id Optional. Forum id. 1008 * @return int Forum's last topic's author id. 1009 1009 */ 1010 1010 function bbp_get_forum_last_topic_author_id( $forum_id = 0 ) { … … 1018 1018 1019 1019 /** 1020 * Output link to author of last topic of forum 1020 * Output link to author of last topic of forum. 1021 1021 * 1022 1022 * @since 2.0.0 bbPress (r2625) 1023 1023 * 1024 * @param int $forum_id Optional. Forum id 1024 * @param int $forum_id Optional. Forum id. 1025 1025 */ 1026 1026 function bbp_forum_last_topic_author_link( $forum_id = 0 ) { … … 1029 1029 1030 1030 /** 1031 * Return link to author of last topic of forum 1031 * Return link to author of last topic of forum. 1032 1032 * 1033 1033 * @since 2.0.0 bbPress (r2625) 1034 1034 * 1035 * @param int $forum_id Optional. Forum id 1036 * @return string Forum's last topic's author link 1035 * @param int $forum_id Optional. Forum id. 1036 * @return string Forum's last topic's author link. 1037 1037 */ 1038 1038 function bbp_get_forum_last_topic_author_link( $forum_id = 0 ) { … … 1048 1048 1049 1049 /** 1050 * Output the forums last reply id 1050 * Output the forums last reply id. 1051 1051 * 1052 1052 * @since 2.0.0 bbPress (r2464) 1053 1053 * 1054 * @param int $forum_id Optional. Forum id 1054 * @param int $forum_id Optional. Forum id. 1055 1055 */ 1056 1056 function bbp_forum_last_reply_id( $forum_id = 0 ) { … … 1059 1059 1060 1060 /** 1061 * Return the forums last reply id 1061 * Return the forums last reply id. 1062 1062 * 1063 1063 * @since 2.0.0 bbPress (r2464) 1064 1064 * 1065 * @param int $forum_id Optional. Forum id 1066 * @return int Forum's last reply id 1065 * @param int $forum_id Optional. Forum id. 1066 * @return int Forum's last reply id. 1067 1067 */ 1068 1068 function bbp_get_forum_last_reply_id( $forum_id = 0 ) { … … 1075 1075 1076 1076 /** 1077 * Output the title of the last reply inside a forum 1078 * 1079 * @param int $forum_id Optional. Forum id 1077 * Output the title of the last reply inside a forum. 1078 * 1079 * @param int $forum_id Optional. Forum id. 1080 1080 */ 1081 1081 function bbp_forum_last_reply_title( $forum_id = 0 ) { … … 1084 1084 1085 1085 /** 1086 * Return the title of the last reply inside a forum 1087 * 1088 * @param int $forum_id Optional. Forum id 1086 * Return the title of the last reply inside a forum. 1087 * 1088 * @param int $forum_id Optional. Forum id. 1089 1089 * @return string 1090 1090 */ … … 1099 1099 1100 1100 /** 1101 * Output the link to the last reply in a forum 1101 * Output the link to the last reply in a forum. 1102 1102 * 1103 1103 * @since 2.0.0 bbPress (r2464) 1104 1104 * 1105 * @param int $forum_id Optional. Forum id 1105 * @param int $forum_id Optional. Forum id. 1106 1106 */ 1107 1107 function bbp_forum_last_reply_permalink( $forum_id = 0 ) { … … 1110 1110 1111 1111 /** 1112 * Return the link to the last reply in a forum 1112 * Return the link to the last reply in a forum. 1113 1113 * 1114 1114 * @since 2.0.0 bbPress (r2464) 1115 1115 * 1116 * @param int $forum_id Optional. Forum id 1117 * 1118 * @return string Permanent link to the forum's last reply 1116 * @param int $forum_id Optional. Forum id. 1117 * 1118 * @return string Permanent link to the forum's last reply. 1119 1119 */ 1120 1120 function bbp_get_forum_last_reply_permalink( $forum_id = 0 ) { … … 1128 1128 1129 1129 /** 1130 * Output the url to the last reply in a forum 1130 * Output the url to the last reply in a forum. 1131 1131 * 1132 1132 * @since 2.0.0 bbPress (r2683) 1133 1133 * 1134 * @param int $forum_id Optional. Forum id 1134 * @param int $forum_id Optional. Forum id. 1135 1135 */ 1136 1136 function bbp_forum_last_reply_url( $forum_id = 0 ) { … … 1139 1139 1140 1140 /** 1141 * Return the url to the last reply in a forum 1141 * Return the url to the last reply in a forum. 1142 1142 * 1143 1143 * @since 2.0.0 bbPress (r2683) 1144 1144 * 1145 * @param int $forum_id Optional. Forum id 1146 * @return string Paginated URL to latest reply 1145 * @param int $forum_id Optional. Forum id. 1146 * @return string Paginated URL to latest reply. 1147 1147 */ 1148 1148 function bbp_get_forum_last_reply_url( $forum_id = 0 ) { … … 1169 1169 1170 1170 /** 1171 * Output author ID of last reply of forum 1171 * Output author ID of last reply of forum. 1172 1172 * 1173 1173 * @since 2.0.0 bbPress (r2625) 1174 1174 * 1175 * @param int $forum_id Optional. Forum id 1175 * @param int $forum_id Optional. Forum id. 1176 1176 */ 1177 1177 function bbp_forum_last_reply_author_id( $forum_id = 0 ) { … … 1180 1180 1181 1181 /** 1182 * Return author ID of last reply of forum 1182 * Return author ID of last reply of forum. 1183 1183 * 1184 1184 * @since 2.0.0 bbPress (r2625) 1185 1185 * 1186 * @param int $forum_id Optional. Forum id 1187 * @return int Forum's last reply author id 1186 * @param int $forum_id Optional. Forum id. 1187 * @return int Forum's last reply author id. 1188 1188 */ 1189 1189 function bbp_get_forum_last_reply_author_id( $forum_id = 0 ) { … … 1197 1197 1198 1198 /** 1199 * Output link to author of last reply of forum 1199 * Output link to author of last reply of forum. 1200 1200 * 1201 1201 * @since 2.0.0 bbPress (r2625) 1202 1202 * 1203 * @param int $forum_id Optional. Forum id 1203 * @param int $forum_id Optional. Forum id. 1204 1204 */ 1205 1205 function bbp_forum_last_reply_author_link( $forum_id = 0 ) { … … 1208 1208 1209 1209 /** 1210 * Return link to author of last reply of forum 1210 * Return link to author of last reply of forum. 1211 1211 * 1212 1212 * @since 2.0.0 bbPress (r2625) 1213 1213 * 1214 * @param int $forum_id Optional. Forum id 1215 * @return string Link to author of last reply of forum 1214 * @param int $forum_id Optional. Forum id. 1215 * @return string Link to author of last reply of forum. 1216 1216 */ 1217 1217 function bbp_get_forum_last_reply_author_link( $forum_id = 0 ) { … … 1227 1227 1228 1228 /** 1229 * Output the topics link of the forum 1229 * Output the topics link of the forum. 1230 1230 * 1231 1231 * @since 2.0.0 bbPress (r2883) 1232 1232 * 1233 * @param int $forum_id Optional. Topic id 1233 * @param int $forum_id Optional. Topic id. 1234 1234 */ 1235 1235 function bbp_forum_topics_link( $forum_id = 0 ) { … … 1238 1238 1239 1239 /** 1240 * Return the topics link of the forum 1240 * Return the topics link of the forum. 1241 1241 * 1242 1242 * @since 2.0.0 bbPress (r2883) 1243 1243 * 1244 * @param int $forum_id Optional. Topic id 1244 * @param int $forum_id Optional. Topic id. 1245 1245 */ 1246 1246 function bbp_get_forum_topics_link( $forum_id = 0 ) { … … 1277 1277 1278 1278 /** 1279 * Output total sub-forum count of a forum 1279 * Output total sub-forum count of a forum. 1280 1280 * 1281 1281 * @since 2.0.0 bbPress (r2464) 1282 1282 * 1283 * @param int $forum_id Optional. Forum id to check 1284 * @param boolean $integer Optional. Whether or not to format the result 1283 * @param int $forum_id Optional. Forum id to check. 1284 * @param boolean $integer Optional. Whether or not to format the result. 1285 1285 */ 1286 1286 function bbp_forum_subforum_count( $forum_id = 0, $integer = false ) { … … 1289 1289 1290 1290 /** 1291 * Return total subforum count of a forum 1291 * Return total subforum count of a forum. 1292 1292 * 1293 1293 * @since 2.0.0 bbPress (r2464) 1294 1294 * 1295 * @param int $forum_id Optional. Forum id 1296 * @param boolean $integer Optional. Whether or not to format the result 1297 * @return int Forum's subforum count 1295 * @param int $forum_id Optional. Forum id. 1296 * @param boolean $integer Optional. Whether or not to format the result. 1297 * @return int Forum's subforum count. 1298 1298 */ 1299 1299 function bbp_get_forum_subforum_count( $forum_id = 0, $integer = false ) { … … 1308 1308 1309 1309 /** 1310 * Output total topic count of a forum 1310 * Output total topic count of a forum. 1311 1311 * 1312 1312 * @since 2.0.0 bbPress (r2464) 1313 1313 * 1314 * @param int $forum_id Optional. Forum id 1314 * @param int $forum_id Optional. Forum id. 1315 1315 * @param bool $total_count Optional. To get the total count or normal count? 1316 * @param boolean $integer Optional. Whether or not to format the result 1316 * @param boolean $integer Optional. Whether or not to format the result. 1317 1317 */ 1318 1318 function bbp_forum_topic_count( $forum_id = 0, $total_count = true, $integer = false ) { … … 1321 1321 1322 1322 /** 1323 * Return total topic count of a forum 1323 * Return total topic count of a forum. 1324 1324 * 1325 1325 * @since 2.0.0 bbPress (r2464) 1326 1326 * 1327 * @param int $forum_id Optional. Forum id 1327 * @param int $forum_id Optional. Forum id. 1328 1328 * @param bool $total_count Optional. To get the total count or normal 1329 1329 * count? Defaults to total. 1330 * @param boolean $integer Optional. Whether or not to format the result 1331 * @return int Forum topic count 1330 * @param boolean $integer Optional. Whether or not to format the result. 1331 * @return int Forum topic count. 1332 1332 */ 1333 1333 function bbp_get_forum_topic_count( $forum_id = 0, $total_count = true, $integer = false ) { … … 1343 1343 1344 1344 /** 1345 * Output total reply count of a forum 1345 * Output total reply count of a forum. 1346 1346 * 1347 1347 * @since 2.0.0 bbPress (r2464) 1348 1348 * 1349 * @param int $forum_id Optional. Forum id 1349 * @param int $forum_id Optional. Forum id. 1350 1350 * @param bool $total_count Optional. To get the total count or normal count? 1351 * @param boolean $integer Optional. Whether or not to format the result 1351 * @param boolean $integer Optional. Whether or not to format the result. 1352 1352 */ 1353 1353 function bbp_forum_reply_count( $forum_id = 0, $total_count = true, $integer = false ) { … … 1356 1356 1357 1357 /** 1358 * Return total post count of a forum 1358 * Return total post count of a forum. 1359 1359 * 1360 1360 * @since 2.0.0 bbPress (r2464) 1361 1361 * 1362 * @param int $forum_id Optional. Forum id 1362 * @param int $forum_id Optional. Forum id. 1363 1363 * @param bool $total_count Optional. To get the total count or normal 1364 1364 * count? 1365 * @param boolean $integer Optional. Whether or not to format the result 1366 * @return int Forum reply count 1365 * @param boolean $integer Optional. Whether or not to format the result. 1366 * @return int Forum reply count. 1367 1367 */ 1368 1368 function bbp_get_forum_reply_count( $forum_id = 0, $total_count = true, $integer = false ) { … … 1378 1378 1379 1379 /** 1380 * Output total post count of a forum 1380 * Output total post count of a forum. 1381 1381 * 1382 1382 * @since 2.0.0 bbPress (r2954) 1383 1383 * 1384 * @param int $forum_id Optional. Forum id 1384 * @param int $forum_id Optional. Forum id. 1385 1385 * @param bool $total_count Optional. To get the total count or normal count? 1386 * @param boolean $integer Optional. Whether or not to format the result 1386 * @param boolean $integer Optional. Whether or not to format the result. 1387 1387 */ 1388 1388 function bbp_forum_post_count( $forum_id = 0, $total_count = true, $integer = false ) { … … 1391 1391 1392 1392 /** 1393 * Return total post count of a forum 1393 * Return total post count of a forum. 1394 1394 * 1395 1395 * @since 2.0.0 bbPress (r2954) 1396 1396 * 1397 * @param int $forum_id Optional. Forum id 1397 * @param int $forum_id Optional. Forum id. 1398 1398 * @param bool $total_count Optional. To get the total count or normal 1399 1399 * count? 1400 * @param boolean $integer Optional. Whether or not to format the result 1401 * @return int Forum post count 1400 * @param boolean $integer Optional. Whether or not to format the result. 1401 * @return int Forum post count. 1402 1402 */ 1403 1403 function bbp_get_forum_post_count( $forum_id = 0, $total_count = true, $integer = false ) { … … 1415 1415 /** 1416 1416 * Output total hidden topic count of a forum (hidden includes trashed, spammed, 1417 * and pending topics) 1417 * and pending topics). 1418 1418 * 1419 1419 * @since 2.0.0 bbPress (r2883) 1420 1420 * @since 2.6.0 bbPress (r6922) Changed function signature to add total counts 1421 1421 * 1422 * @param int $forum_id Optional. Forum id 1422 * @param int $forum_id Optional. Forum id. 1423 1423 * @param bool $total_count Optional. To get the total count or normal count? 1424 * @param boolean $integer Optional. Whether or not to format the result 1424 * @param boolean $integer Optional. Whether or not to format the result. 1425 1425 */ 1426 1426 function bbp_forum_topic_count_hidden( $forum_id = 0, $total_count = true, $integer = null ) { … … 1430 1430 /** 1431 1431 * Return total hidden topic count of a forum (hidden includes trashed, 1432 * spammed and pending topics) 1432 * spammed and pending topics). 1433 1433 * 1434 1434 * @since 2.0.0 bbPress (r2883) 1435 1435 * @since 2.6.0 bbPress (r6922) Changed function signature to add total counts 1436 1436 * 1437 * @param int $forum_id Optional. Forum id 1437 * @param int $forum_id Optional. Forum id. 1438 1438 * @param bool $total_count Optional. To get the total count or normal count? 1439 * @param boolean $integer Optional. Whether or not to format the result 1440 * @return int Topic hidden topic count 1439 * @param boolean $integer Optional. Whether or not to format the result. 1440 * @return int Topic hidden topic count. 1441 1441 */ 1442 1442 function bbp_get_forum_topic_count_hidden( $forum_id = 0, $total_count = true, $integer = null ) { … … 1453 1453 /** 1454 1454 * Output total hidden reply count of a forum (hidden includes trashed, spammed, 1455 * and pending replies) 1455 * and pending replies). 1456 1456 * 1457 1457 * @since 2.6.0 bbPress (r6922) 1458 1458 * 1459 * @param int $forum_id Optional. Forum id 1459 * @param int $forum_id Optional. Forum id. 1460 1460 * @param bool $total_count Optional. To get the total count or normal count? 1461 * @param boolean $integer Optional. Whether or not to format the result 1461 * @param boolean $integer Optional. Whether or not to format the result. 1462 1462 */ 1463 1463 function bbp_forum_reply_count_hidden( $forum_id = 0, $total_count = true, $integer = false ) { … … 1467 1467 /** 1468 1468 * Return total hidden reply count of a forum (hidden includes trashed, 1469 * spammed and pending replies) 1469 * spammed and pending replies). 1470 1470 * 1471 1471 * @since 2.6.0 bbPress (r6922) 1472 1472 * 1473 * @param int $forum_id Optional. Forum id 1473 * @param int $forum_id Optional. Forum id. 1474 1474 * @param bool $total_count Optional. To get the total count or normal 1475 1475 * count? 1476 * @param boolean $integer Optional. Whether or not to format the result 1477 * @return int Forum reply count 1476 * @param boolean $integer Optional. Whether or not to format the result. 1477 * @return int Forum reply count. 1478 1478 */ 1479 1479 function bbp_get_forum_reply_count_hidden( $forum_id = 0, $total_count = true, $integer = false ) { … … 1489 1489 1490 1490 /** 1491 * Output the status of the forum 1491 * Output the status of the forum. 1492 1492 * 1493 1493 * @since 2.0.0 bbPress (r2667) 1494 1494 * 1495 * @param int $forum_id Optional. Forum id 1495 * @param int $forum_id Optional. Forum id. 1496 1496 */ 1497 1497 function bbp_forum_status( $forum_id = 0 ) { … … 1500 1500 1501 1501 /** 1502 * Return the status of the forum 1502 * Return the status of the forum. 1503 1503 * 1504 1504 * @since 2.0.0 bbPress (r2667) 1505 1505 * 1506 * @param int $forum_id Optional. Forum id 1507 * @return string Status of forum 1506 * @param int $forum_id Optional. Forum id. 1507 * @return string Status of forum. 1508 1508 */ 1509 1509 function bbp_get_forum_status( $forum_id = 0 ) { … … 1520 1520 1521 1521 /** 1522 * Output the visibility of the forum 1522 * Output the visibility of the forum. 1523 1523 * 1524 1524 * @since 2.0.0 bbPress (r2997) 1525 1525 * 1526 * @param int $forum_id Optional. Forum id 1526 * @param int $forum_id Optional. Forum id. 1527 1527 */ 1528 1528 function bbp_forum_visibility( $forum_id = 0 ) { … … 1531 1531 1532 1532 /** 1533 * Return the visibility of the forum 1533 * Return the visibility of the forum. 1534 1534 * 1535 1535 * @since 2.0.0 bbPress (r2997) 1536 1536 * 1537 * @param int $forum_id Optional. Forum id 1538 * @return string Status of forum 1537 * @param int $forum_id Optional. Forum id. 1538 * @return string Status of forum. 1539 1539 */ 1540 1540 function bbp_get_forum_visibility( $forum_id = 0 ) { … … 1547 1547 1548 1548 /** 1549 * Output the type of the forum 1549 * Output the type of the forum. 1550 1550 * 1551 1551 * @since 2.1.0 bbPress (r3563) 1552 1552 * 1553 * @param int $forum_id Optional. Forum id 1553 * @param int $forum_id Optional. Forum id. 1554 1554 */ 1555 1555 function bbp_forum_type( $forum_id = 0 ) { … … 1562 1562 * @since 2.1.0 bbPress (r3563) 1563 1563 * 1564 * @param int $forum_id Optional. Forum id 1565 * @return bool Whether the forum is a category or not 1564 * @param int $forum_id Optional. Forum id. 1565 * @return bool Whether the forum is a category or not. 1566 1566 */ 1567 1567 function bbp_get_forum_type( $forum_id = 0 ) { … … 1582 1582 * @since 2.0.0 bbPress (r2746) 1583 1583 * 1584 * @param int $forum_id Optional. Forum id 1585 * @return bool Whether the forum is a category or not 1584 * @param int $forum_id Optional. Forum id. 1585 * @return bool Whether the forum is a category or not. 1586 1586 */ 1587 1587 function bbp_is_forum_category( $forum_id = 0 ) { … … 1599 1599 * @since 2.0.0 bbPress (r2746) 1600 1600 * 1601 * @param int $forum_id Optional. Forum id 1601 * @param int $forum_id Optional. Forum id. 1602 1602 * @param bool $check_ancestors Check if the ancestors are open (only 1603 * if they're a category) 1604 * @return bool Whether the forum is open or not 1603 * if they're a category). 1604 * @return bool Whether the forum is open or not. 1605 1605 */ 1606 1606 function bbp_is_forum_open( $forum_id = 0, $check_ancestors = true ) { … … 1613 1613 * @since 2.0.0 bbPress (r2746) 1614 1614 * 1615 * @param int $forum_id Optional. Forum id 1615 * @param int $forum_id Optional. Forum id. 1616 1616 * @param bool $check_ancestors Check if the ancestors are closed (only 1617 * if they're a category) 1618 * @return bool True if closed, false if not 1617 * if they're a category). 1618 * @return bool True if closed, false if not. 1619 1619 */ 1620 1620 function bbp_is_forum_closed( $forum_id = 0, $check_ancestors = true ) { … … 1631 1631 1632 1632 /** 1633 * Check if the forum status is a specific one, also maybe checking ancestors 1633 * Check if the forum status is a specific one, also maybe checking ancestors. 1634 1634 * 1635 1635 * @since 2.6.0 bbPress (r5499) 1636 1636 * 1637 * @param bool $status_name The forum status name to check 1638 * @param bool $check_ancestors Check the forum ancestors 1637 * @param bool $status_name The forum status name to check. 1638 * @param bool $check_ancestors Check the forum ancestors. 1639 1639 * @param string $operator The logical operation to perform. 1640 1640 * 'OR' means only one forum from the tree needs to match; 1641 1641 * 'AND' means all forums must match. The default is 'AND'. 1642 * @return bool True if match, false if not 1642 * @return bool True if match, false if not. 1643 1643 */ 1644 1644 function bbp_is_forum_status( $forum_id, $status_name, $check_ancestors = true, $operator = 'AND' ) { … … 1705 1705 * @since 2.0.0 bbPress (r2997) 1706 1706 * 1707 * @param int $forum_id Optional. Forum id 1708 * @param bool $check_ancestors Check if the ancestors are public 1709 * @return bool True if closed, false if not 1707 * @param int $forum_id Optional. Forum id. 1708 * @param bool $check_ancestors Check if the ancestors are public. 1709 * @return bool True if closed, false if not. 1710 1710 */ 1711 1711 function bbp_is_forum_public( $forum_id = 0, $check_ancestors = true ) { … … 1726 1726 * @since 2.0.0 bbPress (r2746) 1727 1727 * 1728 * @param int $forum_id Optional. Forum id 1729 * @param bool $check_ancestors Check if the ancestors are private 1730 * @return bool True if private, false if not 1728 * @param int $forum_id Optional. Forum id. 1729 * @param bool $check_ancestors Check if the ancestors are private. 1730 * @return bool True if private, false if not. 1731 1731 */ 1732 1732 function bbp_is_forum_private( $forum_id = 0, $check_ancestors = true ) { … … 1747 1747 * @since 2.0.0 bbPress (r2997) 1748 1748 * 1749 * @param int $forum_id Optional. Forum id 1749 * @param int $forum_id Optional. Forum id. 1750 1750 * @param bool $check_ancestors Check if the ancestors are private (only if 1751 * they're a category) 1752 * @return bool True if hidden, false if not 1751 * they're a category). 1752 * @return bool True if hidden, false if not. 1753 1753 */ 1754 1754 function bbp_is_forum_hidden( $forum_id = 0, $check_ancestors = true ) { … … 1765 1765 1766 1766 /** 1767 * Check the forum visibility ID 1767 * Check the forum visibility ID. 1768 1768 * 1769 1769 * @since 2.6.0 bbPress (r5499) 1770 1770 * 1771 * @param int $forum_id Optional. Forum id 1772 * @param bool $status_name The post status name to check 1773 * @param bool $check_ancestors Check the forum ancestors 1771 * @param int $forum_id Optional. Forum id. 1772 * @param bool $status_name The post status name to check. 1773 * @param bool $check_ancestors Check the forum ancestors. 1774 1774 * @param string $operator The logical operation to perform. 1775 1775 * 'OR' means only one forum from the tree needs to match; 1776 1776 * 'AND' means all forums must match. The default is 'AND'. 1777 * @return bool True if match, false if not 1777 * @return bool True if match, false if not. 1778 1778 */ 1779 1779 function bbp_is_forum_visibility( $forum_id, $status_name, $check_ancestors = true, $operator = 'AND' ) { … … 1838 1838 1839 1839 /** 1840 * Output the author ID of the forum 1840 * Output the author ID of the forum. 1841 1841 * 1842 1842 * @since 2.1.0 bbPress (r3675) 1843 1843 * 1844 * @param int $forum_id Optional. Forum id 1844 * @param int $forum_id Optional. Forum id. 1845 1845 */ 1846 1846 function bbp_forum_author_id( $forum_id = 0 ) { … … 1849 1849 1850 1850 /** 1851 * Return the author ID of the forum 1851 * Return the author ID of the forum. 1852 1852 * 1853 1853 * @since 2.1.0 bbPress (r3675) 1854 1854 * 1855 * @param int $forum_id Optional. Forum id 1856 * 1857 * @return string Author of forum 1855 * @param int $forum_id Optional. Forum id. 1856 * 1857 * @return string Author of forum. 1858 1858 */ 1859 1859 function bbp_get_forum_author_id( $forum_id = 0 ) { … … 1866 1866 1867 1867 /** 1868 * Output the author of the forum 1868 * Output the author of the forum. 1869 1869 * 1870 1870 * @since 2.1.0 bbPress (r3675) 1871 1871 * 1872 * @param int $forum_id Optional. Forum id 1872 * @param int $forum_id Optional. Forum id. 1873 1873 */ 1874 1874 function bbp_forum_author_display_name( $forum_id = 0 ) { … … 1877 1877 1878 1878 /** 1879 * Return the author of the forum 1879 * Return the author of the forum. 1880 1880 * 1881 1881 * @since 2.1.0 bbPress (r3675) 1882 1882 * 1883 * @param int $forum_id Optional. Forum id 1884 * @return string Author of forum 1883 * @param int $forum_id Optional. Forum id. 1884 * @return string Author of forum. 1885 1885 */ 1886 1886 function bbp_get_forum_author_display_name( $forum_id = 0 ) { … … 1960 1960 1961 1961 /** 1962 * Output the row class of a forum 1962 * Output the row class of a forum. 1963 1963 * 1964 1964 * @since 2.0.0 bbPress (r2667) 1965 1965 * 1966 1966 * @param int $forum_id Optional. Forum ID. 1967 * @param array Extra classes you can pass when calling this function 1967 * @param array Extra classes you can pass when calling this function. 1968 1968 */ 1969 1969 function bbp_forum_class( $forum_id = 0, $classes = array() ) { … … 1972 1972 1973 1973 /** 1974 * Return the row class of a forum 1974 * Return the row class of a forum. 1975 1975 * 1976 1976 * @since 2.0.0 bbPress (r2667) 1977 1977 * 1978 * @param int $forum_id Optional. Forum ID 1979 * @param array Extra classes you can pass when calling this function 1980 * @return string Row class of the forum 1978 * @param int $forum_id Optional. Forum ID. 1979 * @param array Extra classes you can pass when calling this function. 1980 * @return string Row class of the forum. 1981 1981 */ 1982 1982 function bbp_get_forum_class( $forum_id = 0, $classes = array() ) { … … 2048 2048 * @since 2.0.0 bbPress (r2860) 2049 2049 * 2050 * @param array $args Arguments passed to alter output 2050 * @param array $args Arguments passed to alter output. 2051 2051 */ 2052 2052 function bbp_single_forum_description( $args = array() ) { … … 2065 2065 * - after: After the text 2066 2066 * - size: Size of the avatar 2067 * @return string Filtered forum description 2067 * @return string Filtered forum description. 2068 2068 */ 2069 2069 function bbp_get_single_forum_description( $args = array() ) { … … 2172 2172 2173 2173 /** 2174 * Output the value of forum title field 2174 * Output the value of forum title field. 2175 2175 * 2176 2176 * @since 2.1.0 bbPress (r3551) … … 2181 2181 2182 2182 /** 2183 * Return the value of forum title field 2183 * Return the value of forum title field. 2184 2184 * 2185 2185 * @since 2.1.0 bbPress (r3551) 2186 2186 * 2187 * @return string Value of forum title field 2187 * @return string Value of forum title field. 2188 2188 */ 2189 2189 function bbp_get_form_forum_title() { … … 2207 2207 2208 2208 /** 2209 * Output the value of forum content field 2209 * Output the value of forum content field. 2210 2210 * 2211 2211 * @since 2.1.0 bbPress (r3551) … … 2216 2216 2217 2217 /** 2218 * Return the value of forum content field 2218 * Return the value of forum content field. 2219 2219 * 2220 2220 * @since 2.1.0 bbPress (r3551) 2221 2221 * 2222 * @return string Value of forum content field 2222 * @return string Value of forum content field. 2223 2223 */ 2224 2224 function bbp_get_form_forum_content() { … … 2242 2242 2243 2243 /** 2244 * Output value of forum moderators field 2244 * Output value of forum moderators field. 2245 2245 * 2246 2246 * @since 2.6.0 bbPress (r5837) … … 2251 2251 2252 2252 /** 2253 * Return value of forum moderators field 2253 * Return value of forum moderators field. 2254 2254 * 2255 2255 * @since 2.6.0 bbPress (r5837) 2256 2256 * 2257 * @return string Value of forum mods field 2257 * @return string Value of forum mods field. 2258 2258 */ 2259 2259 function bbp_get_form_forum_moderators() { … … 2293 2293 2294 2294 /** 2295 * Output value of forum parent 2295 * Output value of forum parent. 2296 2296 * 2297 2297 * @since 2.1.0 bbPress (r3551) … … 2302 2302 2303 2303 /** 2304 * Return value of forum parent 2304 * Return value of forum parent. 2305 2305 * 2306 2306 * @since 2.1.0 bbPress (r3551) 2307 2307 * 2308 * @return string Value of topic content field 2308 * @return string Value of topic content field. 2309 2309 */ 2310 2310 function bbp_get_form_forum_parent() { … … 2328 2328 2329 2329 /** 2330 * Output value of forum type 2330 * Output value of forum type. 2331 2331 * 2332 2332 * @since 2.1.0 bbPress (r3563) … … 2337 2337 2338 2338 /** 2339 * Return value of forum type 2339 * Return value of forum type. 2340 2340 * 2341 2341 * @since 2.1.0 bbPress (r3563) 2342 2342 * 2343 * @return string Value of topic content field 2343 * @return string Value of topic content field. 2344 2344 */ 2345 2345 function bbp_get_form_forum_type() { … … 2363 2363 2364 2364 /** 2365 * Output value of forum visibility 2365 * Output value of forum visibility. 2366 2366 * 2367 2367 * @since 2.1.0 bbPress (r3563) … … 2372 2372 2373 2373 /** 2374 * Return value of forum visibility 2374 * Return value of forum visibility. 2375 2375 * 2376 2376 * @since 2.1.0 bbPress (r3563) 2377 2377 * 2378 * @return string Value of topic content field 2378 * @return string Value of topic content field. 2379 2379 */ 2380 2380 function bbp_get_form_forum_visibility() { … … 2398 2398 2399 2399 /** 2400 * Output checked value of forum subscription 2400 * Output checked value of forum subscription. 2401 2401 * 2402 2402 * @since 2.5.0 bbPress (r5156) … … 2407 2407 2408 2408 /** 2409 * Return checked value of forum subscription 2409 * Return checked value of forum subscription. 2410 2410 * 2411 2411 * @since 2.5.0 bbPress (r5156) 2412 2412 * 2413 * @return string Checked value of forum subscription 2413 * @return string Checked value of forum subscription. 2414 2414 */ 2415 2415 function bbp_get_form_forum_subscribed() { … … 2442 2442 2443 2443 /** 2444 * Output value forum type dropdown 2444 * Output value forum type dropdown. 2445 2445 * 2446 2446 * @since 2.1.0 bbPress (r3563) … … 2457 2457 2458 2458 /** 2459 * Return the forum type dropdown 2459 * Return the forum type dropdown. 2460 2460 * 2461 2461 * @since 2.1.0 bbPress (r3563) … … 2529 2529 2530 2530 /** 2531 * Output value forum status dropdown 2531 * Output value forum status dropdown. 2532 2532 * 2533 2533 * @since 2.1.0 bbPress (r3563) … … 2544 2544 2545 2545 /** 2546 * Return the forum status dropdown 2546 * Return the forum status dropdown. 2547 2547 * 2548 2548 * @since 2.1.0 bbPress (r3563) … … 2553 2553 * - forum_id: Forum id 2554 2554 * - selected: Override the selected option 2555 * @return string HTML select list for selecting forum status 2555 * @return string HTML select list for selecting forum status. 2556 2556 */ 2557 2557 function bbp_get_form_forum_status_dropdown( $args = array() ) { … … 2616 2616 2617 2617 /** 2618 * Output value forum visibility dropdown 2618 * Output value forum visibility dropdown. 2619 2619 * 2620 2620 * @since 2.1.0 bbPress (r3563) … … 2631 2631 2632 2632 /** 2633 * Return the forum visibility dropdown 2633 * Return the forum visibility dropdown. 2634 2634 * 2635 2635 * @since 2.1.0 bbPress (r3563) … … 2640 2640 * - forum_id: Forum id 2641 2641 * - selected: Override the selected option 2642 * @return string HTML select list for selecting forum visibility 2642 * @return string HTML select list for selecting forum visibility. 2643 2643 */ 2644 2644 function bbp_get_form_forum_visibility_dropdown( $args = array() ) { … … 2712 2712 * @since 2.6.0 bbPress (r5558) 2713 2713 * 2714 * @return boolean True if is a post request with valid nonce 2714 * @return boolean True if is a post request with valid nonce. 2715 2715 */ 2716 2716 function bbp_is_forum_form_post_request() { … … 2737 2737 2738 2738 /** 2739 * Output the link for the forum feed 2739 * Output the link for the forum feed. 2740 2740 * 2741 2741 * @since 2.0.0 bbPress (r3172) … … 2748 2748 2749 2749 /** 2750 * Retrieve the link for the forum feed 2750 * Retrieve the link for the forum feed. 2751 2751 * 2752 2752 * @since 2.0.0 bbPress (r3172) … … 2794 2794 2795 2795 /** 2796 * Output the link for the forum replies feed 2796 * Output the link for the forum replies feed. 2797 2797 * 2798 2798 * @since 2.0.0 bbPress (r3172) … … 2805 2805 2806 2806 /** 2807 * Retrieve the link for the forum replies feed 2807 * Retrieve the link for the forum replies feed. 2808 2808 * 2809 2809 * @since 2.0.0 bbPress (r3172) -
trunk/src/includes/replies/capabilities.php
r7378 r7380 2 2 3 3 /** 4 * bbPress Reply Capabilit es4 * bbPress Reply Capabilities. 5 5 * 6 6 * Used to map reply capabilities to WordPress's existing capabilities. … … 11 11 12 12 /** 13 * Return reply capabilities 13 * Return reply capabilities. 14 14 * 15 15 * @since 2.0.0 bbPress (r2593) 16 16 * 17 * @return array Reply capabilities 17 * @return array Reply capabilities. 18 18 */ 19 19 function bbp_get_reply_caps() { … … 40 40 41 41 /** 42 * Maps topic capabilities 42 * Maps topic capabilities. 43 43 * 44 44 * @since 2.2.0 bbPress (r4242) … … 49 49 * @param array $args Arguments. 50 50 * 51 * @return array Actual capabilities for meta capability 51 * @return array Actual capabilities for meta capability. 52 52 */ 53 53 function bbp_map_reply_meta_caps( $caps = array(), $cap = '', $user_id = 0, $args = array() ) { -
trunk/src/includes/replies/functions.php
r7379 r7380 19 19 * @since 2.0.0 bbPress (r3349) 20 20 * 21 * @param array $reply_data Forum post data 22 * @param array $reply_meta Forum meta data 21 * @param array $reply_data Forum post data. 22 * @param array $reply_meta Forum meta data. 23 * 24 * @return int|false Reply ID on success, false on failure. 23 25 */ 24 26 function bbp_insert_reply( $reply_data = array(), $reply_meta = array() ) { … … 103 105 * @param int $topic_id The topic id. 104 106 * @param int $forum_id The forum id. 105 *106 * @return void107 107 */ 108 108 function bbp_insert_reply_update_counts( $reply_id = 0, $topic_id = 0, $forum_id = 0 ) { … … 123 123 124 124 /** 125 * Handles the front end reply submission 125 * Handles the front end reply submission. 126 126 * 127 127 * @since 2.0.0 bbPress (r2574) … … 129 129 * @param string $action The requested action to compare this function to 130 130 * id, anonymous data, reply author, edit (false), and 131 * the reply to id 131 * the reply to id. 132 132 */ 133 133 function bbp_new_reply_handler( $action = '' ) { … … 528 528 529 529 /** 530 * Handles the front end edit reply submission 530 * Handles the front end edit reply submission. 531 531 * 532 532 * @param string $action The requested action to compare this function to 533 * id, anonymous data, reply author, bool true (for edit),534 * and the reply to id533 * id, anonymous data, reply author, bool true (for edit), 534 * and the reply to id. 535 535 */ 536 536 function bbp_edit_reply_handler( $action = '' ) { … … 847 847 848 848 /** 849 * Handle all the extra meta stuff from posting a new reply or editing a reply 850 * 851 * @param int $reply_id Optional. Reply id 852 * @param int $topic_id Optional. Topic id 853 * @param int $forum_id Optional. Forum id 849 * Handle all the extra meta stuff from posting a new reply or editing a reply. 850 * 851 * @param int $reply_id Optional. Reply id. 852 * @param int $topic_id Optional. Topic id. 853 * @param int $forum_id Optional. Forum id. 854 854 * @param array $anonymous_data Optional - if it's an anonymous post. Do not 855 855 * supply if supplying $author_id. Should be 856 * sanitized (see {@link bbp_filter_anonymous_post_data()} 857 * @param int $author_id Author id 856 * sanitized (see {@link bbp_filter_anonymous_post_data()}. 857 * @param int $author_id Author id. 858 858 * @param bool $is_edit Optional. Is the post being edited? Defaults to false. 859 * @param int $reply_to Optional. Reply to id 859 * @param int $reply_to Optional. Reply to id. 860 860 */ 861 861 function bbp_update_reply( $reply_id = 0, $topic_id = 0, $forum_id = 0, $anonymous_data = array(), $author_id = 0, $is_edit = false, $reply_to = 0 ) { … … 953 953 954 954 /** 955 * Walk up the ancestor tree from the current reply, and update all the counts 955 * Walk up the ancestor tree from the current reply, and update all the counts. 956 956 * 957 957 * @since 2.0.0 bbPress (r2884) 958 958 * 959 * @param int $reply_id Optional. Reply id 960 * @param string $last_active_time Optional. Last active time 961 * @param int $forum_id Optional. Forum id 962 * @param int $topic_id Optional. Topic id 959 * @param int $reply_id Optional. Reply id. 960 * @param string $last_active_time Optional. Last active time. 961 * @param int $forum_id Optional. Forum id. 962 * @param int $topic_id Optional. Topic id. 963 963 * @param bool $refresh If set to true, unsets all the previous parameters. 964 * Defaults to true 964 * Defaults to true. 965 965 */ 966 966 function bbp_update_reply_walker( $reply_id, $last_active_time = '', $forum_id = 0, $topic_id = 0, $refresh = true ) { … … 1063 1063 1064 1064 /** 1065 * Update the reply with its forum id it is in 1065 * Update the reply with its forum id it is in. 1066 1066 * 1067 1067 * @since 2.0.0 bbPress (r2855) 1068 1068 * 1069 * @param int $reply_id Optional. Reply id to update 1070 * @param int $forum_id Optional. Forum id 1071 * @return bool The forum id of the reply 1069 * @param int $reply_id Optional. Reply id to update. 1070 * @param int $forum_id Optional. Forum id. 1071 * @return bool The forum id of the reply. 1072 1072 */ 1073 1073 function bbp_update_reply_forum_id( $reply_id = 0, $forum_id = 0 ) { … … 1106 1106 1107 1107 /** 1108 * Update the reply with its topic id it is in 1108 * Update the reply with its topic id it is in. 1109 1109 * 1110 1110 * @since 2.0.0 bbPress (r2855) 1111 1111 * 1112 * @param int $reply_id Optional. Reply id to update 1113 * @param int $topic_id Optional. Topic id 1114 * @return bool The topic id of the reply 1112 * @param int $reply_id Optional. Reply id to update. 1113 * @param int $topic_id Optional. Topic id. 1114 * @return bool The topic id of the reply. 1115 1115 */ 1116 1116 function bbp_update_reply_topic_id( $reply_id = 0, $topic_id = 0 ) { … … 1149 1149 1150 1150 /* 1151 * Update the meta data with its parent reply-to id, of a reply 1151 * Update the meta data with its parent reply-to id, of a reply. 1152 1152 * 1153 1153 * @since 2.4.0 bbPress (r4944) 1154 1154 * 1155 * @param int $reply_id Reply id to update 1156 * @param int $reply_to Optional. Reply to id 1157 * @return bool The parent reply id of the reply 1155 * @param int $reply_id Reply id to update. 1156 * @param int $reply_to Optional. Reply to id. 1157 * @return bool The parent reply id of the reply. 1158 1158 */ 1159 1159 function bbp_update_reply_to( $reply_id = 0, $reply_to = 0 ) { … … 1181 1181 1182 1182 /** 1183 * Get all ancestors to a reply 1183 * Get all ancestors to a reply. 1184 1184 * 1185 1185 * Because settings can be changed, this function does not care if hierarchical … … 1232 1232 1233 1233 /** 1234 * Update the revision log of the reply 1234 * Update the revision log of the reply. 1235 1235 * 1236 1236 * @since 2.0.0 bbPress (r2782) … … 1241 1241 * - reason: Reason for editing 1242 1242 * - revision_id: Revision id 1243 * @return mixed False on failure, true on success 1243 * @return mixed False on failure, true on success. 1244 1244 */ 1245 1245 function bbp_update_reply_revision_log( $args = array() ) { … … 1278 1278 1279 1279 /** 1280 * Move reply handler 1281 * 1282 * Handles the front end move reply submission 1280 * Move reply handler. 1281 * 1282 * Handles the front end move reply submission. 1283 1283 * 1284 1284 * @since 2.3.0 bbPress (r4521) 1285 1285 * 1286 * @param string $action The requested action to compare this function to 1286 * @param string $action The requested action to compare this function to. 1287 1287 */ 1288 1288 function bbp_move_reply_handler( $action = '' ) { … … 1522 1522 1523 1523 /** 1524 * Fix counts on reply move 1524 * Fix counts on reply move. 1525 1525 * 1526 1526 * When a reply is moved, update the counts of source and destination topic … … 1529 1529 * @since 2.3.0 bbPress (r4521) 1530 1530 * 1531 * @param int $move_reply_id Move reply id 1532 * @param int $source_topic_id Source topic id 1533 * @param int $destination_topic_id Destination topic id 1531 * @param int $move_reply_id Move reply id. 1532 * @param int $source_topic_id Source topic id. 1533 * @param int $destination_topic_id Destination topic id. 1534 1534 */ 1535 1535 function bbp_move_reply_count( $move_reply_id, $source_topic_id, $destination_topic_id ) { … … 1560 1560 /** 1561 1561 * Handles the front end spamming/unspamming and trashing/untrashing/deleting of 1562 * replies 1562 * replies. 1563 1563 * 1564 1564 * @since 2.0.0 bbPress (r2740) 1565 1565 * 1566 * @param string $action The requested action to compare this function to 1566 * @param string $action The requested action to compare this function to. 1567 1567 */ 1568 1568 function bbp_toggle_reply_handler( $action = '' ) { … … 1629 1629 1630 1630 /** 1631 * Do the actual reply toggling 1631 * Do the actual reply toggling. 1632 1632 * 1633 1633 * This function is used by `bbp_toggle_reply_handler()` to do the actual heavy … … 1736 1736 1737 1737 /** 1738 * Return an associative array of available reply statuses 1738 * Return an associative array of available reply statuses. 1739 1739 * 1740 1740 * @since 2.6.0 bbPress (r5399) 1741 1741 * 1742 * @param int $reply_id Optional. Reply id.1742 * @param int $reply_id Optional. Reply id. 1743 1743 * 1744 1744 * @return array … … 1760 1760 1761 1761 /** 1762 * Return array of available reply toggle actions 1762 * Return array of available reply toggle actions. 1763 1763 * 1764 1764 * @since 2.6.0 bbPress (r6133) 1765 1765 * 1766 * @param int $reply_id Optional. Reply id.1766 * @param int $reply_id Optional. Reply id. 1767 1767 * 1768 1768 * @return array … … 1819 1819 1820 1820 /** 1821 * Marks a reply as spam 1821 * Marks a reply as spam. 1822 1822 * 1823 1823 * @since 2.0.0 bbPress (r2740) 1824 1824 * 1825 * @param int $reply_id Reply id 1826 * @return mixed False or {@link WP_Error} on failure, reply id on success 1825 * @param int $reply_id Reply id. 1826 * @return mixed False or {@link WP_Error} on failure, reply id on success. 1827 1827 */ 1828 1828 function bbp_spam_reply( $reply_id = 0 ) { … … 1862 1862 1863 1863 /** 1864 * Unspams a reply 1864 * Unspams a reply. 1865 1865 * 1866 1866 * @since 2.0.0 bbPress (r2740) 1867 1867 * 1868 * @param int $reply_id Reply id 1869 * @return mixed False or {@link WP_Error} on failure, reply id on success 1868 * @param int $reply_id Reply id. 1869 * @return mixed False or {@link WP_Error} on failure, reply id on success. 1870 1870 */ 1871 1871 function bbp_unspam_reply( $reply_id = 0 ) { … … 1910 1910 1911 1911 /** 1912 * Approves a reply 1912 * Approves a reply. 1913 1913 * 1914 1914 * @since 2.6.0 bbPress (r5506) 1915 1915 * 1916 * @param int $reply_id Reply id 1917 * @return mixed False or {@link WP_Error} on failure, reply id on success 1916 * @param int $reply_id Reply id. 1917 * @return mixed False or {@link WP_Error} on failure, reply id on success. 1918 1918 */ 1919 1919 function bbp_approve_reply( $reply_id = 0 ) { … … 1956 1956 1957 1957 /** 1958 * Unapproves a reply 1958 * Unapproves a reply. 1959 1959 * 1960 1960 * @since 2.6.0 bbPress (r5506) 1961 1961 * 1962 * @param int $reply_id Reply id 1963 * @return mixed False or {@link WP_Error} on failure, reply id on success 1962 * @param int $reply_id Reply id. 1963 * @return mixed False or {@link WP_Error} on failure, reply id on success. 1964 1964 */ 1965 1965 function bbp_unapprove_reply( $reply_id = 0 ) { … … 2001 2001 2002 2002 /** 2003 * Called before deleting a reply 2003 * Called before deleting a reply. 2004 * 2005 * @since 2.0.0 bbPress (r2895) 2004 2006 */ 2005 2007 function bbp_delete_reply( $reply_id = 0 ) { … … 2014 2016 2015 2017 /** 2016 * Called before trashing a reply 2018 * Called before trashing a reply. 2019 * 2020 * @since 2.0.0 bbPress (r2895) 2017 2021 */ 2018 2022 function bbp_trash_reply( $reply_id = 0 ) { … … 2027 2031 2028 2032 /** 2029 * Called before untrashing (restoring) a reply 2033 * Called before untrashing (restoring) a reply. 2034 * 2035 * @since 2.0.0 bbPress (r2895) 2030 2036 */ 2031 2037 function bbp_untrash_reply( $reply_id = 0 ) { … … 2042 2048 2043 2049 /** 2044 * Called after deleting a reply 2050 * Called after deleting a reply. 2045 2051 * 2046 2052 * @since 2.0.0 bbPress (r2993) … … 2057 2063 2058 2064 /** 2059 * Called after trashing a reply 2065 * Called after trashing a reply. 2060 2066 * 2061 2067 * @since 2.0.0 bbPress (r2993) … … 2072 2078 2073 2079 /** 2074 * Called after untrashing (restoring) a reply 2080 * Called after untrashing (restoring) a reply. 2075 2081 * 2076 2082 * @since 2.0.0 bbPress (r2993) … … 2089 2095 2090 2096 /** 2091 * Return the replies per page setting 2097 * Return the replies per page setting. 2092 2098 * 2093 2099 * @since 2.0.0 bbPress (r3540) 2094 2100 * 2095 * @param int $default Default replies per page (15) 2101 * @param int $default Default replies per page (15). 2096 2102 * @return int 2097 2103 */ … … 2111 2117 2112 2118 /** 2113 * Return the replies per RSS page setting 2119 * Return the replies per RSS page setting. 2114 2120 * 2115 2121 * @since 2.0.0 bbPress (r3540) 2116 2122 * 2117 * @param int $default Default replies per page (25) 2123 * @param int $default Default replies per page (25). 2118 2124 * @return int 2119 2125 */ … … 2135 2141 2136 2142 /** 2137 * Check if auto embeds are enabled and hook them in if so2143 * Check if auto-embeds are enabled and hook them in if so. 2138 2144 * 2139 2145 * @since 2.1.0 bbPress (r3752) … … 2152 2158 2153 2159 /** 2154 * Used by bbp_has_replies() to add the lead topic post to the posts loop 2160 * Used by bbp_has_replies() to add the lead topic post to the posts loop. 2155 2161 * 2156 2162 * This function filters the 'post_where' of the WP_Query, and changes the query … … 2355 2361 2356 2362 /** 2357 * Redirect if unauthorized user is attempting to edit a reply 2363 * Redirect if unauthorized user is attempting to edit a reply. 2358 2364 * 2359 2365 * @since 2.1.0 bbPress (r3605) … … 2481 2487 * 2482 2488 * @since 2.4.0 bbPress (r4944) 2483 * @since 2.6.0 bbPress (r6245) Always false on user profile reply pages 2484 * 2485 * @param bool $default Optional. Default value true 2489 * @since 2.6.0 bbPress (r6245) Always false on user profile reply pages. 2490 * 2491 * @param bool $default Optional. Default value true. 2486 2492 * 2487 2493 * @return bool Are replies threaded? … … 2504 2510 2505 2511 /** 2506 * List threaded replies 2512 * List threaded replies. 2507 2513 * 2508 2514 * @since 2.4.0 bbPress (r4944) … … 2562 2568 2563 2569 /** 2564 * Validate a `reply_to` field for hierarchical replies 2570 * Validate a `reply_to` field for hierarchical replies. 2565 2571 * 2566 2572 * Checks for 2 scenarios: -
trunk/src/includes/replies/template.php
r7379 r7380 2 2 3 3 /** 4 * bbPress Reply Template Tags 4 * bbPress Reply Template Tags. 5 5 * 6 6 * @package bbPress … … 14 14 15 15 /** 16 * Return the unique id of the custom post type for replies 16 * Return the unique id of the custom post type for replies. 17 17 * 18 18 * @since 2.0.0 bbPress (r2857) … … 24 24 25 25 /** 26 * Return the unique id of the custom post type for replies 26 * Return the unique id of the custom post type for replies. 27 27 * 28 28 * @since 2.0.0 bbPress (r2857) 29 29 * 30 * post type id 31 * @return string The unique reply post type id 30 * @return string The unique reply post type id. 32 31 */ 33 32 function bbp_get_reply_post_type() { … … 38 37 39 38 /** 40 * Return array of labels used by the reply post type 39 * Return array of labels used by the reply post type. 41 40 * 42 41 * @since 2.5.0 bbPress (r5129) … … 87 86 88 87 /** 89 * Return array of reply post type rewrite settings 88 * Return array of reply post type rewrite settings. 90 89 * 91 90 * @since 2.5.0 bbPress (r5129) … … 106 105 107 106 /** 108 * Return array of features the reply post type supports 107 * Return array of features the reply post type supports. 109 108 * 110 109 * @since 2.5.0 bbPress (r5129) … … 128 127 129 128 /** 130 * The main reply loop. WordPress makes this easy for us 129 * The main reply loop. WordPress makes this easy for us. 131 130 * 132 131 * @since 2.0.0 bbPress (r2553) 133 132 * 134 * @param array $args All the arguments supported by {@link WP_Query} 135 * @return object Multidimensional array of reply information 133 * @param array $args All the arguments supported by {@link WP_Query}. 134 * @return object Multidimensional array of reply information. 136 135 */ 137 136 function bbp_has_replies( $args = array() ) { … … 275 274 276 275 /** 277 * Whether there are more replies available in the loop 276 * Whether there are more replies available in the loop. 278 277 * 279 278 * @since 2.0.0 bbPress (r2553) 280 279 * 281 * @return object Replies information 280 * @return object Replies information. 282 281 */ 283 282 function bbp_replies() { … … 295 294 296 295 /** 297 * Loads up the current reply in the loop 296 * Loads up the current reply in the loop. 298 297 * 299 298 * @since 2.0.0 bbPress (r2553) 300 299 * 301 * @return object Reply information 300 * @return object Reply information. 302 301 */ 303 302 function bbp_the_reply() { … … 306 305 307 306 /** 308 * Output reply id 307 * Output reply id. 309 308 * 310 309 * @since 2.0.0 bbPress (r2553) 311 310 * 312 * @param $reply_id Optional. Used to check emptiness 311 * @param $reply_id Optional. Used to check emptiness. 313 312 */ 314 313 function bbp_reply_id( $reply_id = 0 ) { … … 317 316 318 317 /** 319 * Return the id of the reply in a replies loop 318 * Return the id of the reply in a replies loop. 320 319 * 321 320 * @since 2.0.0 bbPress (r2553) 322 321 * 323 * @param $reply_id Optional. Used to check emptiness 324 * @return int The reply id 322 * @param $reply_id Optional. Used to check emptiness. 323 * @return int The reply id. 325 324 */ 326 325 function bbp_get_reply_id( $reply_id = 0 ) { … … 358 357 359 358 /** 360 * Gets a reply 359 * Gets a reply. 361 360 * 362 361 * @since 2.0.0 bbPress (r2787) 363 362 * 364 * @param int|object $reply reply id or reply object 365 * @param string $output Optional. OBJECT, ARRAY_A, or ARRAY_N. Default = OBJECT 366 * @param string $filter Optional Sanitation filter. See {@link sanitize_post()} 367 * @return mixed Null if error or reply (in specified form) if success 363 * @param int|object $reply reply id or reply object. 364 * @param string $output Optional. OBJECT, ARRAY_A, or ARRAY_N. Default = OBJECT. 365 * @param string $filter Optional Sanitation filter. See {@link sanitize_post()}. 366 * @return mixed Null if error or reply (in specified form) if success. 368 367 */ 369 368 function bbp_get_reply( $reply, $output = OBJECT, $filter = 'raw' ) { … … 402 401 403 402 /** 404 * Output the link to the reply in the reply loop 403 * Output the link to the reply in the reply loop. 405 404 * 406 405 * @since 2.0.0 bbPress (r2553) 407 406 * 408 * @param int $reply_id Optional. Reply id 407 * @param int $reply_id Optional. Reply id. 409 408 */ 410 409 function bbp_reply_permalink( $reply_id = 0 ) { … … 413 412 414 413 /** 415 * Return the link to the reply 414 * Return the link to the reply. 416 415 * 417 416 * @since 2.0.0 bbPress (r2553) 418 417 * 419 * @param int $reply_id Optional. Reply id 420 * 421 * @return string Permanent link to reply 418 * @param int $reply_id Optional. Reply id. 419 * 420 * @return string Permanent link to reply. 422 421 */ 423 422 function bbp_get_reply_permalink( $reply_id = 0 ) { … … 429 428 430 429 /** 431 * Output the paginated url to the reply in the reply loop 430 * Output the paginated url to the reply in the reply loop. 432 431 * 433 432 * @since 2.0.0 bbPress (r2679) 434 433 * 435 * @param int $reply_id Optional. Reply id 434 * @param int $reply_id Optional. Reply id. 436 435 */ 437 436 function bbp_reply_url( $reply_id = 0 ) { … … 440 439 441 440 /** 442 * Return the paginated url to the reply in the reply loop 441 * Return the paginated url to the reply in the reply loop. 443 442 * 444 443 * @since 2.0.0 bbPress (r2679) 445 444 * 446 * @param int $reply_id Optional. Reply id 445 * @param int $reply_id Optional. Reply id. 447 446 * @param string $redirect_to Optional. Pass a redirect value for use with 448 447 * shortcodes and other fun things. 449 * @return string Link to reply relative to paginated topic 448 * @return string Link to reply relative to paginated topic. 450 449 */ 451 450 function bbp_get_reply_url( $reply_id = 0, $redirect_to = '' ) { … … 521 520 522 521 /** 523 * Output the title of the reply 522 * Output the title of the reply. 524 523 * 525 524 * @since 2.0.0 bbPress (r2553) 526 525 * 527 * @param int $reply_id Optional. Reply id 526 * @param int $reply_id Optional. Reply id. 528 527 */ 529 528 function bbp_reply_title( $reply_id = 0 ) { … … 532 531 533 532 /** 534 * Return the title of the reply 533 * Return the title of the reply. 535 534 * 536 535 * @since 2.0.0 bbPress (r2553) 537 536 * 538 * @param int $reply_id Optional. Reply id 539 * @return string Title of reply 537 * @param int $reply_id Optional. Reply id. 538 * @return string Title of reply. 540 539 */ 541 540 function bbp_get_reply_title( $reply_id = 0 ) { … … 553 552 * @since 2.5.0 bbPress (r5177) 554 553 * 555 * @param string $post_title Required. Reply Title 556 * @param int $post_id Required. Reply ID 557 * @return string Title of reply 554 * @param string $post_title Required. Reply Title. 555 * @param int $post_id Required. Reply ID. 556 * @return string Title of reply. 558 557 */ 559 558 function bbp_get_reply_title_fallback( $post_title = '', $post_id = 0 ) { … … 579 578 580 579 /** 581 * Output the content of the reply 580 * Output the content of the reply. 582 581 * 583 582 * @since 2.0.0 bbPress (r2553) 584 583 * 585 * @param int $reply_id Optional. reply id 584 * @param int $reply_id Optional. reply id. 586 585 */ 587 586 function bbp_reply_content( $reply_id = 0 ) { … … 590 589 591 590 /** 592 * Return the content of the reply 591 * Return the content of the reply. 593 592 * 594 593 * @since 2.0.0 bbPress (r2780) 595 594 * 596 * @param int $reply_id Optional. reply id 597 * @return string Content of the reply 595 * @param int $reply_id Optional. reply id. 596 * @return string Content of the reply. 598 597 */ 599 598 function bbp_get_reply_content( $reply_id = 0 ) { … … 612 611 613 612 /** 614 * Output the excerpt of the reply 613 * Output the excerpt of the reply. 615 614 * 616 615 * @since 2.0.0 bbPress (r2751) 617 616 * 618 * @param int $reply_id Optional. Reply id 619 * @param int $length Optional. Length of the excerpt. Defaults to 100 letters 617 * @param int $reply_id Optional. Reply id. 618 * @param int $length Optional. Length of the excerpt. Defaults to 100 letters. 620 619 */ 621 620 function bbp_reply_excerpt( $reply_id = 0, $length = 100 ) { … … 624 623 625 624 /** 626 * Return the excerpt of the reply 625 * Return the excerpt of the reply. 627 626 * 628 627 * @since 2.0.0 bbPress (r2751) 629 628 * 630 * @param int $reply_id Optional. Reply id 629 * @param int $reply_id Optional. Reply id. 631 630 * @param int $length Optional. Length of the excerpt. Defaults to 100 632 * letters 633 * @return string Reply Excerpt 631 * letters. 632 * @return string Reply Excerpt. 634 633 */ 635 634 function bbp_get_reply_excerpt( $reply_id = 0, $length = 100 ) { … … 661 660 662 661 /** 663 * Output the post date and time of a reply 662 * Output the post date and time of a reply. 664 663 * 665 664 * @since 2.2.0 bbPress (r4155) 666 665 * 667 666 * @param int $reply_id Optional. Reply id. 668 * @param bool $humanize Optional. Humanize output using time_since 669 * @param bool $gmt Optional. Use GMT 667 * @param bool $humanize Optional. Humanize output using time_since. 668 * @param bool $gmt Optional. Use GMT. 670 669 */ 671 670 function bbp_reply_post_date( $reply_id = 0, $humanize = false, $gmt = false ) { … … 674 673 675 674 /** 676 * Return the post date and time of a reply 675 * Return the post date and time of a reply. 677 676 * 678 677 * @since 2.2.0 bbPress (r4155) 679 678 * 680 679 * @param int $reply_id Optional. Reply id. 681 * @param bool $humanize Optional. Humanize output using time_since 682 * @param bool $gmt Optional. Use GMT 680 * @param bool $humanize Optional. Humanize output using time_since. 681 * @param bool $gmt Optional. Use GMT. 683 682 * @return string 684 683 */ … … 706 705 707 706 /** 708 * Append revisions to the reply content 707 * Append revisions to the reply content. 709 708 * 710 709 * @since 2.0.0 bbPress (r2782) 711 710 * 712 * @param string $content Optional. Content to which we need to append the revisions to 713 * @param int $reply_id Optional. Reply id 714 * @return string Content with the revisions appended 711 * @param string $content Optional. Content to which we need to append the revisions to. 712 * @param int $reply_id Optional. Reply id. 713 * @return string Content with the revisions appended. 715 714 */ 716 715 function bbp_reply_content_append_revisions( $content = '', $reply_id = 0 ) { … … 729 728 730 729 /** 731 * Output the revision log of the reply 730 * Output the revision log of the reply. 732 731 * 733 732 * @since 2.0.0 bbPress (r2782) 734 733 * 735 * @param int $reply_id Optional. Reply id 734 * @param int $reply_id Optional. Reply id. 736 735 */ 737 736 function bbp_reply_revision_log( $reply_id = 0 ) { … … 740 739 741 740 /** 742 * Return the formatted revision log of the reply 741 * Return the formatted revision log of the reply. 743 742 * 744 743 * @since 2.0.0 bbPress (r2782) 745 744 * 746 * @param int $reply_id Optional. Reply id 747 * @return string Revision log of the reply 745 * @param int $reply_id Optional. Reply id. 746 * @return string Revision log of the reply. 748 747 */ 749 748 function bbp_get_reply_revision_log( $reply_id = 0 ) { … … 812 811 813 812 /** 814 * Return the raw revision log of the reply 813 * Return the raw revision log of the reply. 815 814 * 816 815 * @since 2.0.0 bbPress (r2782) 817 816 * 818 * @param int $reply_id Optional. Reply id 819 * @return string Raw revision log of the reply 817 * @param int $reply_id Optional. Reply id. 818 * @return string Raw revision log of the reply. 820 819 */ 821 820 function bbp_get_reply_raw_revision_log( $reply_id = 0 ) { … … 831 830 832 831 /** 833 * Return the revisions of the reply 832 * Return the revisions of the reply. 834 833 * 835 834 * @since 2.0.0 bbPress (r2782) 836 835 * 837 * @param int $reply_id Optional. Reply id 838 * @return WP_Post[]|int[] reply revisions 836 * @param int $reply_id Optional. Reply id. 837 * @return WP_Post[]|int[] reply revisions. 839 838 */ 840 839 function bbp_get_reply_revisions( $reply_id = 0 ) { … … 847 846 848 847 /** 849 * Return the revision count of the reply 848 * Return the revision count of the reply. 850 849 * 851 850 * @since 2.0.0 bbPress (r2782) 852 851 * 853 * @param int $reply_id Optional. Reply id 854 * @param boolean $integer Optional. Whether or not to format the result 855 * @return string reply revision count 852 * @param int $reply_id Optional. Reply id. 853 * @param boolean $integer Optional. Whether or not to format the result. 854 * @return string reply revision count. 856 855 */ 857 856 function bbp_get_reply_revision_count( $reply_id = 0, $integer = false ) { … … 866 865 867 866 /** 868 * Output the status of the reply 867 * Output the status of the reply. 869 868 * 870 869 * @since 2.0.0 bbPress (r2667) 871 870 * 872 * @param int $reply_id Optional. Reply id 871 * @param int $reply_id Optional. Reply id. 873 872 */ 874 873 function bbp_reply_status( $reply_id = 0 ) { … … 877 876 878 877 /** 879 * Return the status of the reply 878 * Return the status of the reply. 880 879 * 881 880 * @since 2.0.0 bbPress (r2667) 882 881 * 883 * @param int $reply_id Optional. Reply id 884 * @return string Status of reply 882 * @param int $reply_id Optional. Reply id. 883 * @return string Status of reply. 885 884 */ 886 885 function bbp_get_reply_status( $reply_id = 0 ) { … … 898 897 * @since 2.6.0 bbPress (r6391) 899 898 * 900 * @param int $reply_id Optional. Reply id 899 * @param int $reply_id Optional. Reply id. 901 900 * @return bool True if public, false if not. 902 901 */ … … 917 916 * @since 2.6.0 bbPress (r6922) Returns false if topic is also not published 918 917 * 919 * @param int $reply_id Optional. Topic id 918 * @param int $reply_id Optional. Topic id. 920 919 * @return bool True if published, false if not. 921 920 */ … … 937 936 * @since 2.0.0 bbPress (r2740) 938 937 * 939 * @param int $reply_id Optional. Reply id 938 * @param int $reply_id Optional. Reply id. 940 939 * @return bool True if spam, false if not. 941 940 */ … … 954 953 * @since 2.0.0 bbPress (r2884) 955 954 * 956 * @param int $reply_id Optional. Topic id 955 * @param int $reply_id Optional. Topic id. 957 956 * @return bool True if spam, false if not. 958 957 */ … … 971 970 * @since 2.6.0 bbPress (r5507) 972 971 * 973 * @param int $reply_id Optional. Topic id 972 * @param int $reply_id Optional. Topic id. 974 973 * @return bool True if pending, false if not. 975 974 */ … … 988 987 * @since 2.6.0 bbPress (r5507) 989 988 * 990 * @param int $reply_id Optional. Topic id 989 * @param int $reply_id Optional. Topic id. 991 990 * @return bool True if private, false if not. 992 991 */ … … 1005 1004 * @since 2.0.0 bbPress (r2753) 1006 1005 * 1007 * @param int $reply_id Optional. Reply id 1006 * @param int $reply_id Optional. Reply id. 1008 1007 * @return bool True if the post is by an anonymous user, false if not. 1009 1008 */ … … 1029 1028 * Deprecated. Use bbp_reply_author_display_name() instead. 1030 1029 * 1031 * Output the author of the reply 1030 * Output the author of the reply. 1032 1031 * 1033 1032 * @since 2.0.0 bbPress (r2667) … … 1035 1034 * @deprecated 2.5.0 bbPress (r5119) 1036 1035 * 1037 * @param int $reply_id Optional. Reply id 1036 * @param int $reply_id Optional. Reply id. 1038 1037 */ 1039 1038 function bbp_reply_author( $reply_id = 0 ) { … … 1044 1043 * Deprecated. Use bbp_get_reply_author_display_name() instead. 1045 1044 * 1046 * Return the author of the reply 1045 * Return the author of the reply. 1047 1046 * 1048 1047 * @since 2.0.0 bbPress (r2667) … … 1050 1049 * @deprecated 2.5.0 bbPress (r5119) 1051 1050 * 1052 * @param int $reply_id Optional. Reply id 1053 * @return string Author of reply 1051 * @param int $reply_id Optional. Reply id. 1052 * @return string Author of reply. 1054 1053 */ 1055 1054 function bbp_get_reply_author( $reply_id = 0 ) { … … 1067 1066 1068 1067 /** 1069 * Output the author ID of the reply 1068 * Output the author ID of the reply. 1070 1069 * 1071 1070 * @since 2.0.0 bbPress (r2667) 1072 1071 * 1073 * @param int $reply_id Optional. Reply id 1072 * @param int $reply_id Optional. Reply id. 1074 1073 */ 1075 1074 function bbp_reply_author_id( $reply_id = 0 ) { … … 1078 1077 1079 1078 /** 1080 * Return the author ID of the reply 1079 * Return the author ID of the reply. 1081 1080 * 1082 1081 * @since 2.0.0 bbPress (r2667) 1083 1082 * 1084 * @param int $reply_id Optional. Reply id 1085 * @return string Author id of reply 1083 * @param int $reply_id Optional. Reply id. 1084 * @return string Author id of reply. 1086 1085 */ 1087 1086 function bbp_get_reply_author_id( $reply_id = 0 ) { … … 1094 1093 1095 1094 /** 1096 * Output the author display_name of the reply 1095 * Output the author display_name of the reply. 1097 1096 * 1098 1097 * @since 2.0.0 bbPress (r2667) 1099 1098 * 1100 * @param int $reply_id Optional. Reply id 1099 * @param int $reply_id Optional. Reply id. 1101 1100 */ 1102 1101 function bbp_reply_author_display_name( $reply_id = 0 ) { … … 1105 1104 1106 1105 /** 1107 * Return the author display_name of the reply 1106 * Return the author display_name of the reply. 1108 1107 * 1109 1108 * @since 2.0.0 bbPress (r2667) 1110 1109 * 1111 * @param int $reply_id Optional. Reply id 1112 * @return string The display name of the author of the reply 1110 * @param int $reply_id Optional. Reply id. 1111 * @return string The display name of the author of the reply. 1113 1112 */ 1114 1113 function bbp_get_reply_author_display_name( $reply_id = 0 ) { … … 1144 1143 1145 1144 /** 1146 * Output the author avatar of the reply 1145 * Output the author avatar of the reply. 1147 1146 * 1148 1147 * @since 2.0.0 bbPress (r2667) 1149 1148 * 1150 * @param int $reply_id Optional. Reply id 1151 * @param int $size Optional. Size of the avatar. Defaults to 40 1149 * @param int $reply_id Optional. Reply id. 1150 * @param int $size Optional. Size of the avatar. Defaults to 40. 1152 1151 */ 1153 1152 function bbp_reply_author_avatar( $reply_id = 0, $size = 40 ) { … … 1156 1155 1157 1156 /** 1158 * Return the author avatar of the reply 1157 * Return the author avatar of the reply. 1159 1158 * 1160 1159 * @since 2.0.0 bbPress (r2667) 1161 1160 * 1162 1161 * @param int $reply_id Optional. Reply id 1163 * @param int $size Optional. Size of the avatar. Defaults to 40 1164 * @return string Avatar of author of the reply 1162 * @param int $size Optional. Size of the avatar. Defaults to 40. 1163 * @return string Avatar of author of the reply. 1165 1164 */ 1166 1165 function bbp_get_reply_author_avatar( $reply_id = 0, $size = 40 ) { … … 1184 1183 1185 1184 /** 1186 * Output the author link of the reply 1185 * Output the author link of the reply. 1187 1186 * 1188 1187 * @since 2.0.0 bbPress (r2717) … … 1195 1194 1196 1195 /** 1197 * Return the author link of the reply 1196 * Return the author link of the reply. 1198 1197 * 1199 1198 * @since 2.0.0 bbPress (r2717) 1200 1199 * 1201 1200 * @param array $args Optional. If an integer, it is used as reply id. 1202 * @return string Author link of reply 1201 * @return string Author link of reply. 1203 1202 */ 1204 1203 function bbp_get_reply_author_link( $args = array() ) { … … 1301 1300 1302 1301 /** 1303 * Output the author url of the reply 1302 * Output the author url of the reply. 1304 1303 * 1305 1304 * @since 2.0.0 bbPress (r2667) 1306 1305 * 1307 * @param int $reply_id Optional. Reply id 1306 * @param int $reply_id Optional. Reply id. 1308 1307 */ 1309 1308 function bbp_reply_author_url( $reply_id = 0 ) { … … 1312 1311 1313 1312 /** 1314 * Return the author url of the reply 1313 * Return the author url of the reply. 1315 1314 * 1316 1315 * @since 2.0.0 bbPress (r2667) 1317 1316 * 1318 * @param int $reply_id Optional. Reply id 1319 * @return string Author URL of the reply 1317 * @param int $reply_id Optional. Reply id. 1318 * @return string Author URL of the reply. 1320 1319 */ 1321 1320 function bbp_get_reply_author_url( $reply_id = 0 ) { … … 1338 1337 1339 1338 /** 1340 * Output the reply author email address 1339 * Output the reply author email address. 1341 1340 * 1342 1341 * @since 2.0.0 bbPress (r3445) 1343 1342 * 1344 * @param int $reply_id Optional. Reply id 1343 * @param int $reply_id Optional. Reply id. 1345 1344 */ 1346 1345 function bbp_reply_author_email( $reply_id = 0 ) { … … 1349 1348 1350 1349 /** 1351 * Return the reply author email address 1350 * Return the reply author email address. 1352 1351 * 1353 1352 * @since 2.0.0 bbPress (r3445) 1354 1353 * 1355 * @param int $reply_id Optional. Reply id 1356 * @return string Reply author email address 1354 * @param int $reply_id Optional. Reply id. 1355 * @return string Reply author email address. 1357 1356 */ 1358 1357 function bbp_get_reply_author_email( $reply_id = 0 ) { … … 1384 1383 1385 1384 /** 1386 * Output the reply author role 1385 * Output the reply author role. 1387 1386 * 1388 1387 * @since 2.1.0 bbPress (r3860) … … 1395 1394 1396 1395 /** 1397 * Return the reply author role 1396 * Return the reply author role. 1398 1397 * 1399 1398 * @since 2.1.0 bbPress (r3860) 1400 1399 * 1401 1400 * @param array $args Optional. 1402 * @return string Reply author role 1401 * @return string Reply author role. 1403 1402 */ 1404 1403 function bbp_get_reply_author_role( $args = array() ) { … … 1440 1439 1441 1440 /** 1442 * Output the topic title a reply belongs to 1441 * Output the topic title a reply belongs to. 1443 1442 * 1444 1443 * @since 2.0.0 bbPress (r2553) 1445 1444 * 1446 * @param int $reply_id Optional. Reply id 1445 * @param int $reply_id Optional. Reply id. 1447 1446 */ 1448 1447 function bbp_reply_topic_title( $reply_id = 0 ) { … … 1451 1450 1452 1451 /** 1453 * Return the topic title a reply belongs to 1452 * Return the topic title a reply belongs to. 1454 1453 * 1455 1454 * @since 2.0.0 bbPress (r2553) 1456 1455 * 1457 * @param int $reply_id Optional. Reply id 1458 * @return string The topic title of the reply 1456 * @param int $reply_id Optional. Reply id. 1457 * @return string The topic title of the reply. 1459 1458 */ 1460 1459 function bbp_get_reply_topic_title( $reply_id = 0 ) { … … 1468 1467 1469 1468 /** 1470 * Output the topic id a reply belongs to 1469 * Output the topic id a reply belongs to. 1471 1470 * 1472 1471 * @since 2.0.0 bbPress (r2553) 1473 1472 * 1474 * @param int $reply_id Optional. Reply id 1473 * @param int $reply_id Optional. Reply id. 1475 1474 */ 1476 1475 function bbp_reply_topic_id( $reply_id = 0 ) { … … 1479 1478 1480 1479 /** 1481 * Return the topic id a reply belongs to 1480 * Return the topic id a reply belongs to. 1482 1481 * 1483 1482 * @since 2.0.0 bbPress (r2553) 1484 1483 * 1485 * @param int $reply_id Optional. Reply id 1486 * @return int The topic id of the reply 1484 * @param int $reply_id Optional. Reply id. 1485 * @return int The topic id of the reply. 1487 1486 */ 1488 1487 function bbp_get_reply_topic_id( $reply_id = 0 ) { … … 1505 1504 1506 1505 /** 1507 * Output the forum id a reply belongs to 1506 * Output the forum id a reply belongs to. 1508 1507 * 1509 1508 * @since 2.0.0 bbPress (r2679) 1510 1509 * 1511 * @param int $reply_id Optional. Reply id 1510 * @param int $reply_id Optional. Reply id. 1512 1511 */ 1513 1512 function bbp_reply_forum_id( $reply_id = 0 ) { … … 1516 1515 1517 1516 /** 1518 * Return the forum id a reply belongs to 1517 * Return the forum id a reply belongs to. 1519 1518 * 1520 1519 * @since 2.0.0 bbPress (r2679) 1521 1520 * 1522 * @param int $reply_id Optional. Reply id 1523 * 1524 * @return int The forum id of the reply 1521 * @param int $reply_id Optional. Reply id. 1522 * 1523 * @return int The forum id of the reply. 1525 1524 */ 1526 1525 function bbp_get_reply_forum_id( $reply_id = 0 ) { … … 1544 1543 1545 1544 /** 1546 * Output the ancestor reply id of a reply 1545 * Output the ancestor reply id of a reply. 1547 1546 * 1548 1547 * @since 2.4.0 bbPress (r4944) 1549 1548 * 1550 * @param int $reply_id Optional. Reply id 1549 * @param int $reply_id Optional. Reply id. 1551 1550 */ 1552 1551 function bbp_reply_ancestor_id( $reply_id = 0 ) { … … 1555 1554 1556 1555 /** 1557 * Return the ancestor reply id of a reply 1556 * Return the ancestor reply id of a reply. 1558 1557 * 1559 1558 * @since 2.4.0 bbPress (r4944) 1560 1559 * 1561 * @param in $reply_id Reply id 1560 * @param in $reply_id Reply id. 1562 1561 */ 1563 1562 function bbp_get_reply_ancestor_id( $reply_id = 0 ) { … … 1585 1584 1586 1585 /** 1587 * Output the reply to id of a reply 1586 * Output the reply to id of a reply. 1588 1587 * 1589 1588 * @since 2.4.0 bbPress (r4944) 1590 1589 * 1591 * @param int $reply_id Optional. Reply id 1590 * @param int $reply_id Optional. Reply id. 1592 1591 */ 1593 1592 function bbp_reply_to( $reply_id = 0 ) { … … 1596 1595 1597 1596 /** 1598 * Return the reply to id of a reply 1597 * Return the reply to id of a reply. 1599 1598 * 1600 1599 * @since 2.4.0 bbPress (r4944) 1601 1600 * 1602 * @param int $reply_id Optional. Reply id 1603 * @return int The parent reply id of the reply 1601 * @param int $reply_id Optional. Reply id. 1602 * @return int The parent reply id of the reply. 1604 1603 */ 1605 1604 function bbp_get_reply_to( $reply_id = 0 ) { … … 1621 1620 1622 1621 /** 1623 * Output the link for the reply to 1622 * Output the link for the reply to. 1624 1623 * 1625 1624 * @since 2.4.0 bbPress (r4944) … … 1632 1631 1633 1632 /** 1634 * Return the link for a reply to a reply 1633 * Return the link for a reply to a reply. 1635 1634 * 1636 1635 * @since 2.4.0 bbPress (r4944) 1637 1636 * 1638 * @param array $args Arguments 1639 * @return string Link for a reply to a reply 1637 * @param array $args Arguments. 1638 * @return string Link for a reply to a reply. 1640 1639 */ 1641 1640 function bbp_get_reply_to_link( $args = array() ) { … … 1700 1699 1701 1700 /** 1702 * Output the reply to a reply cancellation link 1701 * Output the reply to a reply cancellation link. 1703 1702 * 1704 1703 * @since 2.4.0 bbPress (r4944) … … 1709 1708 1710 1709 /** 1711 * Return the cancellation link for a reply to a reply 1710 * Return the cancellation link for a reply to a reply. 1712 1711 * 1713 1712 * @since 2.4.0 bbPress (r4944) 1714 1713 * 1715 * @param string $text The cancel text 1716 * @return string The cancellation link 1714 * @param string $text The cancel text. 1715 * @return string The cancellation link. 1717 1716 */ 1718 1717 function bbp_get_cancel_reply_to_link( $text = '' ) { … … 1743 1742 1744 1743 /** 1745 * Output the numeric position of a reply within a topic 1744 * Output the numeric position of a reply within a topic. 1746 1745 * 1747 1746 * @since 2.0.0 bbPress (r2984) 1748 1747 * 1749 * @param int $reply_id Optional. Reply id 1750 * @param int $topic_id Optional. Topic id 1748 * @param int $reply_id Optional. Reply id. 1749 * @param int $topic_id Optional. Topic id. 1751 1750 */ 1752 1751 function bbp_reply_position( $reply_id = 0, $topic_id = 0 ) { … … 1755 1754 1756 1755 /** 1757 * Return the numeric position of a reply within a topic 1756 * Return the numeric position of a reply within a topic. 1758 1757 * 1759 1758 * @since 2.0.0 bbPress (r2984) 1760 1759 * 1761 * @param int $reply_id Optional. Reply id 1762 * @param int $topic_id Optional. Topic id 1763 * @return int Reply position 1760 * @param int $reply_id Optional. Reply id. 1761 * @param int $topic_id Optional. Topic id. 1762 * @return int Reply position. 1764 1763 */ 1765 1764 function bbp_get_reply_position( $reply_id = 0, $topic_id = 0 ) { … … 1805 1804 1806 1805 /** 1807 * Output admin links for reply 1806 * Output admin links for reply. 1808 1807 * 1809 1808 * @since 2.0.0 bbPress (r2667) … … 1816 1815 1817 1816 /** 1818 * Return admin links for reply 1817 * Return admin links for reply. 1819 1818 * 1820 1819 * @since 2.0.0 bbPress (r2667) … … 1828 1827 * - links: Array of the links to display. By default, edit, trash, 1829 1828 * spam, reply move, and topic split links are displayed 1830 * @return string Reply admin links 1829 * @return string Reply admin links. 1831 1830 */ 1832 1831 function bbp_get_reply_admin_links( $args = array() ) { … … 1902 1901 1903 1902 /** 1904 * Output the edit link of the reply 1903 * Output the edit link of the reply. 1905 1904 * 1906 1905 * @since 2.0.0 bbPress (r2740) 1907 1906 * 1908 * @param array $args See {@link bbp_get_reply_edit_link()} 1907 * @param array $args See {@link bbp_get_reply_edit_link()}. 1909 1908 */ 1910 1909 function bbp_reply_edit_link( $args = array() ) { … … 1913 1912 1914 1913 /** 1915 * Return the edit link of the reply 1914 * Return the edit link of the reply. 1916 1915 * 1917 1916 * @since 2.0.0 bbPress (r2740) … … 1922 1921 * - link_after: HTML after the link 1923 1922 * - edit_text: Edit text. Defaults to 'Edit' 1924 * @return string Reply edit link 1923 * @return string Reply edit link. 1925 1924 */ 1926 1925 function bbp_get_reply_edit_link( $args = array() ) { … … 1965 1964 1966 1965 /** 1967 * Output URL to the reply edit page 1966 * Output URL to the reply edit page. 1968 1967 * 1969 1968 * @since 2.0.0 bbPress (r2753) 1970 1969 * 1971 * @param int $reply_id Optional. Reply id 1970 * @param int $reply_id Optional. Reply id. 1972 1971 */ 1973 1972 function bbp_reply_edit_url( $reply_id = 0 ) { … … 1976 1975 1977 1976 /** 1978 * Return URL to the reply edit page 1977 * Return URL to the reply edit page. 1979 1978 * 1980 1979 * @since 2.0.0 bbPress (r2753) 1981 1980 * 1982 * @param int $reply_id Optional. Reply id 1983 * @return string Reply edit url 1981 * @param int $reply_id Optional. Reply id. 1982 * @return string Reply edit url. 1984 1983 */ 1985 1984 function bbp_get_reply_edit_url( $reply_id = 0 ) { … … 2018 2017 2019 2018 /** 2020 * Output the trash link of the reply 2019 * Output the trash link of the reply. 2021 2020 * 2022 2021 * @since 2.0.0 bbPress (r2740) 2023 2022 * 2024 * @param array $args See {@link bbp_get_reply_trash_link()} 2023 * @param array $args See {@link bbp_get_reply_trash_link()}. 2025 2024 */ 2026 2025 function bbp_reply_trash_link( $args = array() ) { … … 2029 2028 2030 2029 /** 2031 * Return the trash link of the reply 2030 * Return the trash link of the reply. 2032 2031 * 2033 2032 * @since 2.0.0 bbPress (r2740) … … 2041 2040 * - restore_text: Restore text 2042 2041 * - delete_text: Delete text 2043 * @return string Reply trash link 2042 * @return string Reply trash link. 2044 2043 */ 2045 2044 function bbp_get_reply_trash_link( $args = array() ) { … … 2108 2107 2109 2108 /** 2110 * Output the spam link of the reply 2109 * Output the spam link of the reply. 2111 2110 * 2112 2111 * @since 2.0.0 bbPress (r2740) 2113 2112 * 2114 * @param array $args See {@link bbp_get_reply_spam_link()} 2113 * @param array $args See {@link bbp_get_reply_spam_link()}. 2115 2114 */ 2116 2115 function bbp_reply_spam_link( $args = array() ) { … … 2119 2118 2120 2119 /** 2121 * Return the spam link of the reply 2120 * Return the spam link of the reply. 2122 2121 * 2123 2122 * @since 2.0.0 bbPress (r2740) … … 2129 2128 * - spam_text: Spam text 2130 2129 * - unspam_text: Unspam text 2131 * @return string Reply spam link 2130 * @return string Reply spam link. 2132 2131 */ 2133 2132 function bbp_get_reply_spam_link( $args = array() ) { … … 2172 2171 2173 2172 /** 2174 * Move reply link 2175 * 2176 * Output the move link of the reply 2173 * Move reply link. 2174 * 2175 * Output the move link of the reply. 2177 2176 * 2178 2177 * @since 2.3.0 bbPress (r4521) 2179 2178 * 2180 * @param array $args See {@link bbp_get_reply_move_link()} 2179 * @param array $args See {@link bbp_get_reply_move_link()}. 2181 2180 */ 2182 2181 function bbp_reply_move_link( $args = array() ) { … … 2185 2184 2186 2185 /** 2187 * Get move reply link 2188 * 2189 * Return the move link of the reply 2186 * Get move reply link. 2187 * 2188 * Return the move link of the reply. 2190 2189 * 2191 2190 * @since 2.3.0 bbPress (r4521) … … 2197 2196 * - move_text: Move text 2198 2197 * - move_title: Move title attribute 2199 * @return string Reply move link 2198 * @return string Reply move link. 2200 2199 */ 2201 2200 function bbp_get_reply_move_link( $args = array() ) { … … 2238 2237 2239 2238 /** 2240 * Split topic link 2241 * 2242 * Output the split link of the topic (but is bundled with each reply) 2239 * Split topic link. 2240 * 2241 * Output the split link of the topic (but is bundled with each reply). 2243 2242 * 2244 2243 * @since 2.0.0 bbPress (r2756) 2245 2244 * 2246 * @param array $args See {@link bbp_get_topic_split_link()} 2245 * @param array $args See {@link bbp_get_topic_split_link()}. 2247 2246 */ 2248 2247 function bbp_topic_split_link( $args = array() ) { … … 2251 2250 2252 2251 /** 2253 * Get split topic link 2254 * 2255 * Return the split link of the topic (but is bundled with each reply) 2252 * Get split topic link. 2253 * 2254 * Return the split link of the topic (but is bundled with each reply). 2256 2255 * 2257 2256 * @since 2.0.0 bbPress (r2756) … … 2263 2262 * - split_text: Split text 2264 2263 * - split_title: Split title attribute 2265 * @return string Topic split link 2264 * @return string Topic split link. 2266 2265 */ 2267 2266 function bbp_get_topic_split_link( $args = array() ) { … … 2304 2303 2305 2304 /** 2306 * Output the approve link of the reply 2305 * Output the approve link of the reply. 2307 2306 * 2308 2307 * @since 2.6.0 bbPress (r5507) 2309 2308 * 2310 * @param array $args See {@link bbp_get_reply_approve_link()} 2309 * @param array $args See {@link bbp_get_reply_approve_link()}. 2311 2310 */ 2312 2311 function bbp_reply_approve_link( $args = array() ) { … … 2315 2314 2316 2315 /** 2317 * Return the approve link of the reply 2316 * Return the approve link of the reply. 2318 2317 * 2319 2318 * @since 2.6.0 bbPress (r5507) … … 2326 2325 * - approve_text: Approve text 2327 2326 * - unapprove_text: Unapprove text 2328 * @return string Reply approve link 2327 * @return string Reply approve link. 2329 2328 */ 2330 2329 function bbp_get_reply_approve_link( $args = array() ) { … … 2370 2369 2371 2370 /** 2372 * Output the row class of a reply 2371 * Output the row class of a reply. 2373 2372 * 2374 2373 * @since 2.0.0 bbPress (r2678) 2375 2374 * 2376 * @param int $reply_id Optional. Reply ID 2377 * @param array Extra classes you can pass when calling this function 2375 * @param int $reply_id Optional. Reply ID. 2376 * @param array Extra classes you can pass when calling this function. 2378 2377 */ 2379 2378 function bbp_reply_class( $reply_id = 0, $classes = array() ) { … … 2382 2381 2383 2382 /** 2384 * Return the row class of a reply 2383 * Return the row class of a reply. 2385 2384 * 2386 2385 * @since 2.0.0 bbPress (r2678) 2387 2386 * 2388 * @param int $reply_id Optional. Reply ID 2389 * @param array Extra classes you can pass when calling this function 2390 * @return string Row class of the reply 2387 * @param int $reply_id Optional. Reply ID. 2388 * @param array Extra classes you can pass when calling this function. 2389 * @return string Row class of the reply. 2391 2390 */ 2392 2391 function bbp_get_reply_class( $reply_id = 0, $classes = array() ) { … … 2443 2442 2444 2443 /** 2445 * Return the base URL used inside of pagination links 2444 * Return the base URL used inside of pagination links. 2446 2445 * 2447 2446 * @since 2.6.0 bbPress (r6679) 2448 2447 * 2449 * @param int $topic_id 2448 * @param int $topic_id Topic id. 2450 2449 * @return string 2451 2450 */ … … 2484 2483 2485 2484 /** 2486 * Output the topic pagination count 2485 * Output the topic pagination count. 2487 2486 * 2488 2487 * The results are unescaped by design, to allow them to be filtered freely via … … 2497 2496 2498 2497 /** 2499 * Return the topic pagination count 2498 * Return the topic pagination count. 2500 2499 * 2501 2500 * @since 2.0.0 bbPress (r2519) 2502 2501 * 2503 * @return string Topic pagination count 2502 * @return string Topic pagination count. 2504 2503 */ 2505 2504 function bbp_get_topic_pagination_count() { … … 2570 2569 2571 2570 /** 2572 * Output topic pagination links 2571 * Output topic pagination links. 2573 2572 * 2574 2573 * @since 2.0.0 bbPress (r2519) … … 2579 2578 2580 2579 /** 2581 * Return topic pagination links 2580 * Return topic pagination links. 2582 2581 * 2583 2582 * @since 2.0.0 bbPress (r2519) 2584 2583 * 2585 * @return string Topic pagination links 2584 * @return string Topic pagination links. 2586 2585 */ 2587 2586 function bbp_get_topic_pagination_links() { … … 2599 2598 2600 2599 /** 2601 * Output the value of reply content field 2600 * Output the value of reply content field. 2602 2601 * 2603 2602 * @since 2.0.0 bbPress (r3130) … … 2608 2607 2609 2608 /** 2610 * Return the value of reply content field 2609 * Return the value of reply content field. 2611 2610 * 2612 2611 * @since 2.0.0 bbPress (r3130) 2613 2612 * 2614 * @return string Value of reply content field 2613 * @return string Value of reply content field. 2615 2614 */ 2616 2615 function bbp_get_form_reply_content() { … … 2634 2633 2635 2634 /** 2636 * Output the value of the reply to field 2635 * Output the value of the reply to field. 2637 2636 * 2638 2637 * @since 2.4.0 bbPress (r4944) … … 2643 2642 2644 2643 /** 2645 * Return the value of reply to field 2644 * Return the value of reply to field. 2646 2645 * 2647 2646 * @since 2.4.0 bbPress (r4944) 2648 2647 * 2649 * @return string Value of reply to field 2648 * @return string Value of reply to field. 2650 2649 */ 2651 2650 function bbp_get_form_reply_to() { … … 2674 2673 * @since 2.6.0 bbPress (r5387) 2675 2674 * 2676 * @param int $reply_id 2675 * @param int $reply_id Reply id. 2677 2676 */ 2678 2677 function bbp_reply_to_dropdown( $reply_id = 0 ) { … … 2685 2684 * @since 2.6.0 bbPress (r5387) 2686 2685 * 2687 * @param int $reply_id 2688 * 2689 * @return string The dropdown 2686 * @param int $reply_id Reply id. 2687 * 2688 * @return string The dropdown. 2690 2689 */ 2691 2690 function bbp_get_reply_to_dropdown( $reply_id = 0 ) { … … 2752 2751 2753 2752 /** 2754 * Output checked value of reply log edit field 2753 * Output checked value of reply log edit field. 2755 2754 * 2756 2755 * @since 2.0.0 bbPress (r3130) … … 2761 2760 2762 2761 /** 2763 * Return checked value of reply log edit field 2762 * Return checked value of reply log edit field. 2764 2763 * 2765 2764 * @since 2.0.0 bbPress (r3130) 2766 2765 * 2767 * @return string Reply log edit checked value 2766 * @return string Reply log edit checked value. 2768 2767 */ 2769 2768 function bbp_get_form_reply_log_edit() { … … 2786 2785 2787 2786 /** 2788 * Output the value of the reply edit reason 2787 * Output the value of the reply edit reason. 2789 2788 * 2790 2789 * @since 2.0.0 bbPress (r3130) … … 2795 2794 2796 2795 /** 2797 * Return the value of the reply edit reason 2796 * Return the value of the reply edit reason. 2798 2797 * 2799 2798 * @since 2.0.0 bbPress (r3130) 2800 2799 * 2801 * @return string Reply edit reason value 2800 * @return string Reply edit reason value. 2802 2801 */ 2803 2802 function bbp_get_form_reply_edit_reason() { … … 2817 2816 2818 2817 /** 2819 * Output value reply status dropdown 2818 * Output value reply status dropdown. 2820 2819 * 2821 2820 * @since 2.6.0 bbPress (r5399) … … 2832 2831 2833 2832 /** 2834 * Returns reply status dropdown 2833 * Returns reply status dropdown. 2835 2834 * 2836 2835 * This dropdown is only intended to be seen by users with the 'moderate' … … 2908 2907 * @since 2.6.0 bbPress (r5558) 2909 2908 * 2910 * @return boolean True if is a post request with valid nonce 2909 * @return boolean True if is a post request with valid nonce. 2911 2910 */ 2912 2911 function bbp_is_reply_form_post_request() { -
trunk/src/includes/search/functions.php
r7333 r7380 2 2 3 3 /** 4 * bbPress Search Functions 4 * bbPress Search Functions. 5 5 * 6 6 * @package bbPress … … 14 14 15 15 /** 16 * Run the search query 16 * Run the search query. 17 17 * 18 18 * @since 2.3.0 bbPress (r4579) 19 19 * 20 * @param mixed $new_args New arguments 21 * @return bool False if no results, otherwise if search results are there 20 * @param mixed $new_args New arguments. 21 * @return bool False if no results, otherwise if search results are there. 22 22 */ 23 23 function bbp_search_query( $new_args = array() ) { … … 36 36 37 37 /** 38 * Return the search query arg s38 * Return the search query arguments. 39 39 * 40 40 * @since 2.3.0 bbPress (r4579) 41 41 * 42 * @return array Query arguments 42 * @return array Query arguments. 43 43 */ 44 44 function bbp_get_search_query_args() { … … 55 55 56 56 /** 57 * Redirect to search results page if needed 57 * Redirect to search results page if needed. 58 58 * 59 59 * @since 2.4.0 bbPress (r4928) 60 60 * 61 * @return If a redirect is not needed 61 * @return If a redirect is not needed. 62 62 */ 63 63 function bbp_search_results_redirect() { … … 84 84 85 85 /** 86 * Return an array of search types 86 * Return an array of search types. 87 87 * 88 88 * @since 2.6.0 bbPress (r6903) … … 101 101 * @since 2.6.0 bbPress (r6903) 102 102 * 103 * @param string $query_arg s|fs|ts|rs 103 * @param string $query_arg s|fs|ts|rs. 104 104 * 105 105 * @return mixed -
trunk/src/includes/search/template.php
r7378 r7380 2 2 3 3 /** 4 * bbPress Search Template Tags 4 * bbPress Search Template Tags. 5 5 * 6 6 * @package bbPress … … 18 18 * @since 2.3.0 bbPress (r4579) 19 19 * 20 * @param array $args All the arguments supported by {@link WP_Query} 21 * @return object Multidimensional array of search information 20 * @param array $args All the arguments supported by {@link WP_Query}. 21 * @return object Multidimensional array of search information. 22 22 */ 23 23 function bbp_has_search_results( $args = array() ) { … … 115 115 116 116 /** 117 * Whether there are more search results available in the loop 118 * 119 * @since 2.3.0 bbPress (r4579) 120 * 121 * @return object Search information 117 * Whether there are more search results available in the loop. 118 * 119 * @since 2.3.0 bbPress (r4579) 120 * 121 * @return object Search information. 122 122 */ 123 123 function bbp_search_results() { … … 135 135 136 136 /** 137 * Loads up the current search result in the loop 138 * 139 * @since 2.3.0 bbPress (r4579) 140 * 141 * @return object Search information 137 * Loads up the current search result in the loop. 138 * 139 * @since 2.3.0 bbPress (r4579) 140 * 141 * @return object Search information. 142 142 */ 143 143 function bbp_the_search_result() { … … 153 153 154 154 /** 155 * Output the search page title 155 * Output the search page title. 156 156 * 157 157 * @since 2.3.0 bbPress (r4579) … … 161 161 } 162 162 163 /**164 * Get the search page title 165 *166 * @since 2.3.0 bbPress (r4579)167 */168 function bbp_get_search_title() {169 170 // Get search terms171 $search_terms = bbp_get_search_terms();172 173 // No search terms specified174 if ( empty( $search_terms ) ) {175 $title = esc_html__( 'Search', 'bbpress' );176 177 // Include search terms in title178 } else {179 /* translators: %s: Search query terms */180 $title = sprintf( esc_html__( "Search Results for '%s'", 'bbpress' ), esc_attr( $search_terms ) );181 }182 183 // Filter & return184 return apply_filters( 'bbp_get_search_title', $title, $search_terms );185 }186 187 /** 188 * Output the search url 163 /** 164 * Get the search page title. 165 * 166 * @since 2.3.0 bbPress (r4579) 167 */ 168 function bbp_get_search_title() { 169 170 // Get search terms 171 $search_terms = bbp_get_search_terms(); 172 173 // No search terms specified 174 if ( empty( $search_terms ) ) { 175 $title = esc_html__( 'Search', 'bbpress' ); 176 177 // Include search terms in title 178 } else { 179 /* translators: %s: Search query terms */ 180 $title = sprintf( esc_html__( "Search Results for '%s'", 'bbpress' ), esc_attr( $search_terms ) ); 181 } 182 183 // Filter & return 184 return apply_filters( 'bbp_get_search_title', $title, $search_terms ); 185 } 186 187 /** 188 * Output the search url. 189 189 * 190 190 * @since 2.3.0 bbPress (r4579) … … 193 193 echo esc_url( bbp_get_search_url() ); 194 194 } 195 /** 196 * Return the search url 197 * 198 * @since 2.3.0 bbPress (r4579) 199 * 200 * @return string Search url 201 */ 202 function bbp_get_search_url() { 203 204 // Pretty permalinks 205 if ( bbp_use_pretty_urls() ) { 206 207 // Run through home_url() 208 $url = bbp_get_root_url() . bbp_get_search_slug(); 209 $url = user_trailingslashit( $url ); 210 $url = home_url( $url ); 211 212 // Unpretty permalinks 213 } else { 214 $url = add_query_arg( 215 array( 216 bbp_get_search_rewrite_id() => '' 217 ), 218 home_url( '/' ) 219 ); 220 } 221 222 // Filter & return 223 return apply_filters( 'bbp_get_search_url', $url ); 224 } 225 226 /** 227 * Output the search results url 195 196 /** 197 * Return the search url. 198 * 199 * @since 2.3.0 bbPress (r4579) 200 * 201 * @return string Search url. 202 */ 203 function bbp_get_search_url() { 204 205 // Pretty permalinks 206 if ( bbp_use_pretty_urls() ) { 207 208 // Run through home_url() 209 $url = bbp_get_root_url() . bbp_get_search_slug(); 210 $url = user_trailingslashit( $url ); 211 $url = home_url( $url ); 212 213 // Unpretty permalinks 214 } else { 215 $url = add_query_arg( 216 array( 217 bbp_get_search_rewrite_id() => '' 218 ), 219 home_url( '/' ) 220 ); 221 } 222 223 // Filter & return 224 return apply_filters( 'bbp_get_search_url', $url ); 225 } 226 227 /** 228 * Output the search results url. 228 229 * 229 230 * @since 2.4.0 bbPress (r4928) … … 232 233 echo esc_url( bbp_get_search_results_url() ); 233 234 } 234 /** 235 * Return the search url 236 * 237 * @since 2.4.0 bbPress (r4928) 238 * 239 * @return string Search url 240 */ 241 function bbp_get_search_results_url() { 242 243 // Get the search terms 244 $search_terms = bbp_get_search_terms(); 245 246 // Pretty permalinks 247 if ( bbp_use_pretty_urls() ) { 248 249 // Root search URL 250 $url = bbp_get_root_url() . bbp_get_search_slug(); 251 252 // Append search terms 253 if ( ! empty( $search_terms ) ) { 254 $url = trailingslashit( $url ) . urlencode( $search_terms ); 255 } 256 257 // Run through home_url() 258 $url = user_trailingslashit( $url ); 259 $url = home_url( $url ); 260 261 // Unpretty permalinks 262 } else { 263 $url = add_query_arg( 264 array( 265 bbp_get_search_rewrite_id() => urlencode( $search_terms ) 266 ), 267 home_url( '/' ) 268 ); 235 236 /** 237 * Return the search url. 238 * 239 * @since 2.4.0 bbPress (r4928) 240 * 241 * @return string Search url. 242 */ 243 function bbp_get_search_results_url() { 244 245 // Get the search terms 246 $search_terms = bbp_get_search_terms(); 247 248 // Pretty permalinks 249 if ( bbp_use_pretty_urls() ) { 250 251 // Root search URL 252 $url = bbp_get_root_url() . bbp_get_search_slug(); 253 254 // Append search terms 255 if ( ! empty( $search_terms ) ) { 256 $url = trailingslashit( $url ) . urlencode( $search_terms ); 269 257 } 270 258 271 // Filter & return 272 return apply_filters( 'bbp_get_search_results_url', $url ); 273 } 274 275 /** 276 * Output the search terms 277 * 278 * @since 2.3.0 bbPress (r4579) 279 * 280 * @param string $search_terms Optional. Search terms 259 // Run through home_url() 260 $url = user_trailingslashit( $url ); 261 $url = home_url( $url ); 262 263 // Unpretty permalinks 264 } else { 265 $url = add_query_arg( 266 array( 267 bbp_get_search_rewrite_id() => urlencode( $search_terms ) 268 ), 269 home_url( '/' ) 270 ); 271 } 272 273 // Filter & return 274 return apply_filters( 'bbp_get_search_results_url', $url ); 275 } 276 277 /** 278 * Output the search terms. 279 * 280 * @since 2.3.0 bbPress (r4579) 281 * 282 * @param string $search_terms Optional. Search terms. 281 283 */ 282 284 function bbp_search_terms( $search_terms = '' ) { … … 284 286 } 285 287 286 /** 287 * Get the search terms 288 * 289 * @since 2.3.0 bbPress (r4579) 290 * 291 * If search terms are supplied, those are used. Otherwise check the 292 * search rewrite id query var. 293 * 294 * @param string $passed_terms Optional. Search terms 295 * @return bool|string Search terms on success, false on failure 296 */ 297 function bbp_get_search_terms( $passed_terms = '' ) { 298 299 // Sanitize terms if they were passed in 300 if ( ! empty( $passed_terms ) ) { 301 $search_terms = sanitize_title( $passed_terms ); 302 303 // Use query variable if not 288 /** 289 * Get the search terms. 290 * 291 * @since 2.3.0 bbPress (r4579) 292 * 293 * If search terms are supplied, those are used. Otherwise check the 294 * search rewrite id query var. 295 * 296 * @param string $passed_terms Optional. Search terms. 297 * @return bool|string Search terms on success, false on failure. 298 */ 299 function bbp_get_search_terms( $passed_terms = '' ) { 300 301 // Sanitize terms if they were passed in 302 if ( ! empty( $passed_terms ) ) { 303 $search_terms = sanitize_title( $passed_terms ); 304 305 // Use query variable if not 306 } else { 307 308 // Global 309 $search_terms = get_query_var( bbp_get_search_rewrite_id(), null ); 310 311 // Searching globally 312 if ( ! is_null( $search_terms ) ) { 313 $search_terms = wp_unslash( $search_terms ); 314 315 // Other searches 304 316 } else { 305 317 306 // Global 307 $search_terms = get_query_var( bbp_get_search_rewrite_id(), null ); 308 309 // Searching globally 310 if ( ! is_null( $search_terms ) ) { 311 $search_terms = wp_unslash( $search_terms ); 312 313 // Other searches 314 } else { 315 316 // Get known search type IDs 317 $types = bbp_get_search_type_ids(); 318 319 // Filterable, so make sure types exist 320 if ( ! empty( $types ) ) { 321 322 // Loop through types 323 foreach ( $types as $type ) { 324 325 // Look for search terms 326 $terms = bbp_sanitize_search_request( $type ); 327 328 // Skip if no terms 329 if ( empty( $terms ) ) { 330 continue; 331 } 332 333 // Set terms if not empty 334 $search_terms = $terms; 318 // Get known search type IDs 319 $types = bbp_get_search_type_ids(); 320 321 // Filterable, so make sure types exist 322 if ( ! empty( $types ) ) { 323 324 // Loop through types 325 foreach ( $types as $type ) { 326 327 // Look for search terms 328 $terms = bbp_sanitize_search_request( $type ); 329 330 // Skip if no terms 331 if ( empty( $terms ) ) { 332 continue; 335 333 } 334 335 // Set terms if not empty 336 $search_terms = $terms; 336 337 } 337 338 } 338 339 } 339 340 // Trim whitespace & decode if non-empty string, or set to false 341 $search_terms = ! empty( $search_terms ) && is_string( $search_terms ) 342 ? urldecode( trim( $search_terms ) ) 343 : false; 344 345 // Filter & return 346 return apply_filters( 'bbp_get_search_terms', $search_terms, $passed_terms ); 347 } 340 } 341 342 // Trim whitespace & decode if non-empty string, or set to false 343 $search_terms = ! empty( $search_terms ) && is_string( $search_terms ) 344 ? urldecode( trim( $search_terms ) ) 345 : false; 346 347 // Filter & return 348 return apply_filters( 'bbp_get_search_terms', $search_terms, $passed_terms ); 349 } 348 350 349 351 /** Pagination ****************************************************************/ 350 352 351 353 /** 352 * Return the base URL used inside of pagination links 354 * Return the base URL used inside of pagination links. 353 355 * 354 356 * @since 2.6.0 bbPress (r6679) … … 383 385 384 386 /** 385 * Output the search result pagination count 387 * Output the search result pagination count. 386 388 * 387 389 * @since 2.3.0 bbPress (r4579) … … 392 394 393 395 /** 394 * Return the search results pagination count 395 * 396 * @since 2.3.0 bbPress (r4579) 397 * 398 * @return string Search pagination count 396 * Return the search results pagination count. 397 * 398 * @since 2.3.0 bbPress (r4579) 399 * 400 * @return string Search pagination count. 399 401 */ 400 402 function bbp_get_search_pagination_count() { … … 448 450 449 451 /** 450 * Output search pagination links 452 * Output search pagination links. 451 453 * 452 454 * @since 2.3.0 bbPress (r4579) … … 456 458 } 457 459 458 /**459 * Return search pagination links 460 *461 * @since 2.3.0 bbPress (r4579)462 *463 * @return string Search pagination links 464 */465 function bbp_get_search_pagination_links() {466 $bbp = bbpress();467 468 if ( ! isset( $bbp->search_query->pagination_links ) || empty( $bbp->search_query->pagination_links ) ) {469 return false;470 }471 472 // Filter & return473 return apply_filters( 'bbp_get_search_pagination_links', $bbp->search_query->pagination_links );474 }460 /** 461 * Return search pagination links. 462 * 463 * @since 2.3.0 bbPress (r4579) 464 * 465 * @return string Search pagination links. 466 */ 467 function bbp_get_search_pagination_links() { 468 $bbp = bbpress(); 469 470 if ( ! isset( $bbp->search_query->pagination_links ) || empty( $bbp->search_query->pagination_links ) ) { 471 return false; 472 } 473 474 // Filter & return 475 return apply_filters( 'bbp_get_search_pagination_links', $bbp->search_query->pagination_links ); 476 } -
trunk/src/includes/topics/capabilities.php
r7378 r7380 2 2 3 3 /** 4 * bbPress Topic Capabilit es4 * bbPress Topic Capabilities. 5 5 * 6 6 * Used to map topic capabilities to WordPress's existing capabilities. … … 11 11 12 12 /** 13 * Return topic capabilities 13 * Return topic capabilities. 14 14 * 15 15 * @since 2.0.0 bbPress (r2593) 16 16 * 17 * @return array Topic capabilities 17 * @return array Topic capabilities. 18 18 */ 19 19 function bbp_get_topic_caps() { … … 35 35 36 36 /** 37 * Return topic tag capabilities 37 * Return topic tag capabilities. 38 38 * 39 39 * @since 2.0.0 bbPress (r2593) 40 40 * 41 * 42 * @return array Topic tag capabilities 41 * @return array Topic tag capabilities. 43 42 */ 44 43 function bbp_get_topic_tag_caps() { … … 57 56 58 57 /** 59 * Maps topic capabilities 58 * Maps topic capabilities. 60 59 * 61 60 * @since 2.2.0 bbPress (r4242) … … 66 65 * @param array $args Arguments. 67 66 * 68 * @return array Actual capabilities for meta capability 67 * @return array Actual capabilities for meta capability. 69 68 */ 70 69 function bbp_map_topic_meta_caps( $caps = array(), $cap = '', $user_id = 0, $args = array() ) { … … 268 267 269 268 /** 270 * Maps topic tag capabilities 269 * Maps topic tag capabilities. 271 270 * 272 271 * @since 2.2.0 bbPress (r4242) 273 272 * 274 * @param array $caps Capabilities for meta capability 275 * @param string $cap Capability name 276 * @param int $user_id User id 277 * @param array $args Arguments 278 * 279 * @return array Actual capabilities for meta capability 273 * @param array $caps Capabilities for meta capability. 274 * @param string $cap Capability name. 275 * @param int $user_id User id. 276 * @param array $args Arguments. 277 * 278 * @return array Actual capabilities for meta capability. 280 279 */ 281 280 function bbp_map_topic_tag_meta_caps( $caps, $cap, $user_id, $args ) { -
trunk/src/includes/topics/functions.php
r7379 r7380 2 2 3 3 /** 4 * bbPress Topic Functions 4 * bbPress Topic Functions. 5 5 * 6 6 * @package bbPress … … 19 19 * @since 2.0.0 bbPress (r3349) 20 20 * 21 * @param array $topic_data Forum post data 22 * @param array $topic_meta Forum meta data 21 * @param array $topic_data Forum post data. 22 * @param array $topic_meta Forum meta data. 23 * 24 * @return int|false Topic ID on success, false on failure. 23 25 */ 24 26 function bbp_insert_topic( $topic_data = array(), $topic_meta = array() ) { … … 98 100 99 101 /** 100 * Handles the front end topic submission 101 * 102 * @param string $action The requested action to compare this function to 102 * Handles the front end topic submission. 103 * 104 * @param string $action The requested action to compare this function to. 103 105 */ 104 106 function bbp_new_topic_handler( $action = '' ) { … … 434 436 435 437 /** 436 * Handles the front end edit topic submission 437 * 438 * @param string $action The requested action to compare this function to 438 * Handles the front end edit topic submission. 439 * 440 * @param string $action The requested action to compare this function to. 439 441 */ 440 442 function bbp_edit_topic_handler( $action = '' ) { … … 779 781 780 782 /** 781 * Handle all the extra meta stuff from posting a new topic 782 * 783 * @param int $topic_id Optional. Topic id 784 * @param int $forum_id Optional. Forum id 783 * Handle all the extra meta stuff from posting a new topic. 784 * 785 * @param int $topic_id Optional. Topic id. 786 * @param int $forum_id Optional. Forum id. 785 787 * @param array $anonymous_data Optional - if it's an anonymous post. Do not 786 788 * supply if supplying $author_id. Should be 787 789 * sanitized (see {@link bbp_filter_anonymous_post_data()} 788 * @param int $author_id Author id 790 * @param int $author_id Author id. 789 791 * @param bool $is_edit Optional. Is the post being edited? Defaults to false. 790 792 */ … … 921 923 * @since 2.0.0 bbPress (r2800) 922 924 * 923 * @param int $topic_id Topic id 924 * @param string $last_active_time Optional. Last active time 925 * @param int $forum_id Optional. Forum id 926 * @param int $reply_id Optional. Reply id 925 * @param int $topic_id Topic id. 926 * @param string $last_active_time Optional. Last active time. 927 * @param int $forum_id Optional. Forum id. 928 * @param int $reply_id Optional. Reply id. 927 929 * @param bool $refresh Reset all the previous parameters? Defaults to true. 928 930 */ … … 1138 1140 1139 1141 /** 1140 * Merge topic handler 1141 * 1142 * Handles the front end merge topic submission 1142 * Merge topic handler. 1143 * 1144 * Handles the front end merge topic submission. 1143 1145 * 1144 1146 * @since 2.0.0 bbPress (r2756) 1145 1147 * 1146 * @param string $action The requested action to compare this function to 1148 * @param string $action The requested action to compare this function to. 1147 1149 */ 1148 1150 function bbp_merge_topic_handler( $action = '' ) { … … 1374 1376 1375 1377 /** 1376 * Fix counts on topic merge 1378 * Fix counts on topic merge. 1377 1379 * 1378 1380 * When a topic is merged, update the counts of source and destination topic … … 1381 1383 * @since 2.0.0 bbPress (r2756) 1382 1384 * 1383 * @param int $destination_topic_id Destination topic id 1384 * @param int $source_topic_id Source topic id 1385 * @param int $source_topic_forum_id Source topic's forum id 1385 * @param int $destination_topic_id Destination topic id. 1386 * @param int $source_topic_id Source topic id. 1387 * @param int $source_topic_forum_id Source topic's forum id. 1386 1388 */ 1387 1389 function bbp_merge_topic_count( $destination_topic_id, $source_topic_id, $source_topic_forum_id ) { … … 1410 1412 1411 1413 /** 1412 * Split topic handler 1413 * 1414 * Handles the front end split topic submission 1414 * Split topic handler. 1415 * 1416 * Handles the front end split topic submission. 1415 1417 * 1416 1418 * @since 2.0.0 bbPress (r2756) 1417 1419 * 1418 * @param string $action The requested action to compare this function to 1420 * @param string $action The requested action to compare this function to. 1419 1421 */ 1420 1422 function bbp_split_topic_handler( $action = '' ) { … … 1724 1726 1725 1727 /** 1726 * Fix counts on topic split 1728 * Fix counts on topic split. 1727 1729 * 1728 1730 * When a topic is split, update the counts of source and destination topic … … 1731 1733 * @since 2.0.0 bbPress (r2756) 1732 1734 * 1733 * @param int $from_reply_id From reply id 1734 * @param int $source_topic_id Source topic id 1735 * @param int $destination_topic_id Destination topic id 1735 * @param int $from_reply_id From reply id. 1736 * @param int $source_topic_id Source topic id. 1737 * @param int $destination_topic_id Destination topic id. 1736 1738 */ 1737 1739 function bbp_split_topic_count( $from_reply_id, $source_topic_id, $destination_topic_id ) { … … 1759 1761 1760 1762 /** 1761 * Handles the front end tag management (renaming, merging, destroying) 1763 * Handles the front end tag management (renaming, merging, destroying). 1762 1764 * 1763 1765 * @since 2.0.0 bbPress (r2768) 1764 1766 * 1765 * @param string $action The requested action to compare this function to 1767 * @param string $action The requested action to compare this function to. 1766 1768 */ 1767 1769 function bbp_edit_topic_tag_handler( $action = '' ) { … … 1966 1968 1967 1969 /** 1968 * Return an associative array of available topic statuses 1970 * Return an associative array of available topic statuses. 1969 1971 * 1970 1972 * @since 2.4.0 bbPress (r5059) 1971 1973 * 1972 * @param int $topic_id Optional. Topic id.1974 * @param int $topic_id Optional. Topic id. 1973 1975 * 1974 1976 * @return array … … 1991 1993 1992 1994 /** 1993 * Return an associative array of topic sticky types 1995 * Return an associative array of topic sticky types. 1994 1996 * 1995 1997 * @since 2.4.0 bbPress (r5059) 1996 1998 * 1997 * @param int $topic_id Optional. Topic id.1999 * @param int $topic_id Optional. Topic id. 1998 2000 * 1999 2001 * @return array … … 2014 2016 2015 2017 /** 2016 * Return array of available topic toggle actions 2018 * Return array of available topic toggle actions. 2017 2019 * 2018 2020 * @since 2.6.0 bbPress (r6133) 2019 2021 * 2020 * @param int $topic_id Optional. Topic id.2022 * @param int $topic_id Optional. Topic id. 2021 2023 * 2022 2024 * @return array … … 2076 2078 2077 2079 /** 2078 * Return sticky topics of a forum 2080 * Return sticky topics of a forum. 2079 2081 * 2080 2082 * @since 2.0.0 bbPress (r2592) 2081 2083 * 2082 2084 * @param int $forum_id Optional. If not passed, super stickies are returned. 2083 * @return array IDs of sticky topics of a forum or super stickies 2085 * 2086 * @return array IDs of sticky topics of a forum or super stickies. 2084 2087 */ 2085 2088 function bbp_get_stickies( $forum_id = 0 ) { … … 2100 2103 2101 2104 /** 2102 * Return topics stuck to front page of the forums 2105 * Return topics stuck to front page of the forums. 2103 2106 * 2104 2107 * @since 2.0.0 bbPress (r2592) 2105 2108 * 2106 * @return array IDs of super sticky topics 2109 * @return array IDs of super sticky topics. 2107 2110 */ 2108 2111 function bbp_get_super_stickies() { … … 2124 2127 /** 2125 2128 * Handles the front end opening/closing, spamming/unspamming, 2126 * sticking/unsticking and trashing/untrashing/deleting of topics 2129 * sticking/unsticking and trashing/untrashing/deleting of topics. 2127 2130 * 2128 2131 * @since 2.0.0 bbPress (r2727) 2129 2132 * 2130 * @param string $action The requested action to compare this function to 2133 * @param string $action The requested action to compare this function to. 2131 2134 */ 2132 2135 function bbp_toggle_topic_handler( $action = '' ) { … … 2193 2196 2194 2197 /** 2195 * Do the actual topic toggling 2198 * Do the actual topic toggling. 2196 2199 * 2197 2200 * This function is used by `bbp_toggle_topic_handler()` to do the actual heavy … … 2357 2360 2358 2361 /** 2359 * Remove a deleted topic from all user favorites 2362 * Remove a deleted topic from all user favorites. 2360 2363 * 2361 2364 * @since 2.0.0 bbPress (r2652) 2362 2365 * 2363 * @param int $topic_id Get the topic id to remove 2366 * @param int $topic_id Get the topic id to remove. 2364 2367 */ 2365 2368 function bbp_remove_topic_from_all_favorites( $topic_id = 0 ) { … … 2387 2390 2388 2391 /** 2389 * Remove a deleted topic from all user subscriptions 2392 * Remove a deleted topic from all user subscriptions. 2390 2393 * 2391 2394 * @since 2.0.0 bbPress (r2652) 2392 2395 * 2393 * @param int $topic_id Get the topic id to remove 2396 * @param int $topic_id Get the topic id to remove. 2394 2397 */ 2395 2398 function bbp_remove_topic_from_all_subscriptions( $topic_id = 0 ) { … … 2413 2416 2414 2417 /** 2415 * Bump the total reply count of a topic 2418 * Bump the total reply count of a topic. 2416 2419 * 2417 2420 * @since 2.1.0 bbPress (r3825) 2418 2421 * 2419 2422 * @param int $topic_id Optional. Topic id. 2420 * @param int $difference Optional. Default 1 2421 * @return int Topic reply count 2423 * @param int $difference Optional. Default 1. 2424 * 2425 * @return int Topic reply count. 2422 2426 */ 2423 2427 function bbp_bump_topic_reply_count( $topic_id = 0, $difference = 1 ) { … … 2447 2451 * 2448 2452 * @param int $topic_id The topic id. 2449 *2450 * @return void2451 2453 */ 2452 2454 function bbp_increase_topic_reply_count( $topic_id = 0 ) { … … 2479 2481 * 2480 2482 * @param int $topic_id The topic id. 2481 *2482 * @return void2483 2483 */ 2484 2484 function bbp_decrease_topic_reply_count( $topic_id = 0 ) { … … 2506 2506 2507 2507 /** 2508 * Bump the total hidden reply count of a topic 2508 * Bump the total hidden reply count of a topic. 2509 2509 * 2510 2510 * @since 2.1.0 bbPress (r3825) 2511 2511 * 2512 2512 * @param int $topic_id Optional. Topic id. 2513 * @param int $difference Optional. Default 1 2514 * @return int Topic hidden reply count 2513 * @param int $difference Optional. Default 1. 2514 * 2515 * @return int Topic hidden reply count. 2515 2516 */ 2516 2517 function bbp_bump_topic_reply_count_hidden( $topic_id = 0, $difference = 1 ) { … … 2540 2541 * 2541 2542 * @param int $topic_id The topic id. 2542 *2543 * @return void2544 2543 */ 2545 2544 function bbp_increase_topic_reply_count_hidden( $topic_id = 0 ) { … … 2572 2571 * 2573 2572 * @param int $topic_id The topic id. 2574 *2575 * @return void2576 2573 */ 2577 2574 function bbp_decrease_topic_reply_count_hidden( $topic_id = 0 ) { … … 2605 2602 * @param int $topic_id The topic id. 2606 2603 * @param int $forum_id The forum id. 2607 *2608 * @return void2609 2604 */ 2610 2605 function bbp_insert_topic_update_counts( $topic_id = 0, $forum_id = 0 ) { … … 2627 2622 * @since 2.0.0 bbPress (r2855) 2628 2623 * 2629 * @param int $topic_id Optional. Topic id to update 2624 * @param int $topic_id Optional. Topic id to update. 2630 2625 * @param int $forum_id Optional. Forum id 2631 * @return int Forum id 2626 * 2627 * @return int Forum id. 2632 2628 */ 2633 2629 function bbp_update_topic_forum_id( $topic_id = 0, $forum_id = 0 ) { … … 2651 2647 2652 2648 /** 2653 * Update the topic's topic id 2649 * Update the topic's topic id. 2654 2650 * 2655 2651 * @since 2.0.0 bbPress (r2954) 2656 2652 * 2657 * @param int $topic_id Optional. Topic id to update 2658 * @return int Topic id 2653 * @param int $topic_id Optional. Topic id to update. 2654 * 2655 * @return int Topic id. 2659 2656 */ 2660 2657 function bbp_update_topic_topic_id( $topic_id = 0 ) { … … 2667 2664 2668 2665 /** 2669 * Adjust the total reply count of a topic 2666 * Adjust the total reply count of a topic. 2670 2667 * 2671 2668 * @since 2.0.0 bbPress (r2467) 2672 2669 * 2673 * @param int $topic_id Optional. Topic id to update 2670 * @param int $topic_id Optional. Topic id to update. 2674 2671 * @param int $reply_count Optional. Set the reply count manually. 2675 * @return int Topic reply count 2672 * 2673 * @return int Topic reply count. 2676 2674 */ 2677 2675 function bbp_update_topic_reply_count( $topic_id = 0, $reply_count = false ) { … … 2695 2693 /** 2696 2694 * Adjust the total hidden reply count of a topic (hidden includes trashed, 2697 * spammed and pending replies) 2695 * spammed and pending replies). 2698 2696 * 2699 2697 * @since 2.0.0 bbPress (r2740) 2700 2698 * 2701 * @param int $topic_id Optional. Topic id to update 2702 * @param int $reply_count Optional. Set the reply count manually 2703 * @return int Topic hidden reply count 2699 * @param int $topic_id Optional. Topic id to update. 2700 * @param int $reply_count Optional. Set the reply count manually. 2701 * 2702 * @return int Topic hidden reply count. 2704 2703 */ 2705 2704 function bbp_update_topic_reply_count_hidden( $topic_id = 0, $reply_count = false ) { … … 2722 2721 2723 2722 /** 2724 * Update the topic with the last active post ID 2723 * Update the topic with the last active post ID. 2725 2724 * 2726 2725 * @since 2.0.0 bbPress (r2888) 2727 2726 * 2728 * @param int $topic_id Optional. Topic id to update 2729 * @param int $active_id Optional. active id 2730 * @return int Active id 2727 * @param int $topic_id Optional. Topic id to update. 2728 * @param int $active_id Optional. Active id. 2729 * 2730 * @return int Active id. 2731 2731 */ 2732 2732 function bbp_update_topic_last_active_id( $topic_id = 0, $active_id = 0 ) { … … 2757 2757 2758 2758 /** 2759 * Update the topics last active date/time (aka freshness) 2759 * Update the topics last active date/time (aka freshness). 2760 2760 * 2761 2761 * @since 2.0.0 bbPress (r2680) … … 2763 2763 * @param int $topic_id Optional. Topic id. 2764 2764 * @param string $new_time Optional. New time in mysql format. 2765 * @return string MySQL timestamp of last active reply 2765 * 2766 * @return string MySQL timestamp of last active reply. 2766 2767 */ 2767 2768 function bbp_update_topic_last_active_time( $topic_id = 0, $new_time = '' ) { … … 2787 2788 2788 2789 /** 2789 * Update the topic with the most recent reply ID 2790 * Update the topic with the most recent reply ID. 2790 2791 * 2791 2792 * @since 2.0.0 bbPress (r2625) 2792 2793 * 2793 * @param int $topic_id Optional. Topic id to update 2794 * @param int $reply_id Optional. Reply id 2795 * @return int Reply id 2794 * @param int $topic_id Optional. Topic id to update. 2795 * @param int $reply_id Optional. Reply id. 2796 * 2797 * @return int Reply id. 2796 2798 */ 2797 2799 function bbp_update_topic_last_reply_id( $topic_id = 0, $reply_id = 0 ) { … … 2825 2827 2826 2828 /** 2827 * Adjust the total voice count of a topic 2829 * Adjust the total voice count of a topic. 2828 2830 * 2829 2831 * @since 2.0.0 bbPress (r2567) 2830 * @since 2.6.0 bbPress (r6515) This must be called after any engagement changes 2831 * 2832 * @param int $topic_id Optional. Topic id to update 2833 * @return int Voice count 2832 * @since 2.6.0 bbPress (r6515) This must be called after any engagement changes. 2833 * 2834 * @param int $topic_id Optional. Topic id to update. 2835 * 2836 * @return int Voice count. 2834 2837 */ 2835 2838 function bbp_update_topic_voice_count( $topic_id = 0 ) { … … 2856 2859 2857 2860 /** 2858 * Adjust the total anonymous reply count of a topic 2861 * Adjust the total anonymous reply count of a topic. 2859 2862 * 2860 2863 * @since 2.0.0 bbPress (r2567) 2861 2864 * 2862 * @param int $topic_id Optional. Topic id to update 2863 * @return int Anonymous reply count 2865 * @param int $topic_id Optional. Topic id to update. 2866 * 2867 * @return int Anonymous reply count. 2864 2868 */ 2865 2869 function bbp_update_topic_anonymous_reply_count( $topic_id = 0 ) { … … 2882 2886 2883 2887 /** 2884 * Update the revision log of the topic 2888 * Update the revision log of the topic. 2885 2889 * 2886 2890 * @since 2.0.0 bbPress (r2782) … … 2891 2895 * - reason: Reason for editing 2892 2896 * - revision_id: Revision id 2893 * @return mixed False on failure, true on success 2897 * 2898 * @return mixed False on failure, true on success. 2894 2899 */ 2895 2900 function bbp_update_topic_revision_log( $args = array() ) { … … 2927 2932 2928 2933 /** 2929 * Closes a topic 2934 * Closes a topic. 2930 2935 * 2931 2936 * @since 2.0.0 bbPress (r2740) 2932 2937 * 2933 * @param int $topic_id Topic id 2934 * @return mixed False or {@link WP_Error} on failure, topic id on success 2938 * @param int $topic_id Topic id. 2939 * 2940 * @return mixed False or {@link WP_Error} on failure, topic id on success. 2935 2941 */ 2936 2942 function bbp_close_topic( $topic_id = 0 ) { … … 2986 2992 2987 2993 /** 2988 * Opens a topic 2994 * Opens a topic. 2989 2995 * 2990 2996 * @since 2.0.0 bbPress (r2740) 2991 2997 * 2992 * @param int $topic_id Topic id 2993 * @return mixed False or {@link WP_Error} on failure, topic id on success 2998 * @param int $topic_id Topic id. 2999 * 3000 * @return mixed False or {@link WP_Error} on failure, topic id on success. 2994 3001 */ 2995 3002 function bbp_open_topic( $topic_id = 0 ) { … … 3046 3053 3047 3054 /** 3048 * Marks a topic as spam 3055 * Marks a topic as spam. 3049 3056 * 3050 3057 * @since 2.0.0 bbPress (r2740) 3051 3058 * 3052 * @param int $topic_id Topic id 3053 * @return mixed False or {@link WP_Error} on failure, topic id on success 3059 * @param int $topic_id Topic id. 3060 * @return mixed False or {@link WP_Error} on failure, topic id on success. 3054 3061 */ 3055 3062 function bbp_spam_topic( $topic_id = 0 ) { … … 3095 3102 3096 3103 /** 3097 * Trash replies to a topic when it's marked as spam 3104 * Trash replies to a topic when it's marked as spam. 3098 3105 * 3099 3106 * Usually you'll want to do this before the topic itself is marked as spam. … … 3101 3108 * @since 2.6.0 bbPress (r5405) 3102 3109 * 3103 * @param int $topic_id 3110 * @param int $topic_id Topic id. 3104 3111 */ 3105 3112 function bbp_spam_topic_replies( $topic_id = 0 ) { … … 3156 3163 * @since 2.6.0 bbPress (r5405) 3157 3164 * 3158 * @param int $topic_id 3165 * @param int $topic_id Topic id. 3166 * 3167 * @return array 3159 3168 */ 3160 3169 function bbp_spam_topic_tags( $topic_id = 0 ) { … … 3189 3198 3190 3199 /** 3191 * Unspams a topic 3200 * Unspams a topic. 3192 3201 * 3193 3202 * @since 2.0.0 bbPress (r2740) 3194 3203 * 3195 * @param int $topic_id Topic id 3196 * @return mixed False or {@link WP_Error} on failure, topic id on success 3204 * @param int $topic_id Topic id. 3205 * 3206 * @return mixed False or {@link WP_Error} on failure, topic id on success. 3197 3207 */ 3198 3208 function bbp_unspam_topic( $topic_id = 0 ) { … … 3247 3257 * @since 2.6.0 bbPress (r5405) 3248 3258 * 3249 * @param int $topic_id 3259 * @param int $topic_id Topic id. 3250 3260 */ 3251 3261 function bbp_unspam_topic_replies( $topic_id = 0 ) { … … 3282 3292 * @since 2.6.0 bbPress (r5405) 3283 3293 * 3284 * @param int $topic_id 3294 * @param int $topic_id Topic id. 3295 * 3296 * @return array 3285 3297 */ 3286 3298 function bbp_unspam_topic_tags( $topic_id = 0 ) { … … 3301 3313 3302 3314 /** 3303 * Sticks a topic to a forum or front 3315 * Sticks a topic to a forum or front. 3304 3316 * 3305 3317 * @since 2.0.0 bbPress (r2754) 3306 3318 * 3307 * @param int $topic_id Optional. Topic id 3319 * @param int $topic_id Optional. Topic id. 3308 3320 * @param int $super Should we make the topic a super sticky? 3321 * 3309 3322 * @return bool True on success, false on failure 3310 3323 */ … … 3356 3369 3357 3370 /** 3358 * Approves a pending topic 3371 * Approves a pending topic. 3359 3372 * 3360 3373 * @since 2.6.0 bbPress (r5503) 3361 3374 * 3362 * @param int $topic_id Topic id 3363 * @return mixed False or {@link WP_Error} on failure, topic id on success 3375 * @param int $topic_id Topic id. 3376 * 3377 * @return mixed False or {@link WP_Error} on failure, topic id on success. 3364 3378 */ 3365 3379 function bbp_approve_topic( $topic_id = 0 ) { … … 3402 3416 3403 3417 /** 3404 * Unapproves a topic 3418 * Unapproves a topic. 3405 3419 * 3406 3420 * @since 2.6.0 bbPress (r5503) 3407 3421 * 3408 * @param int $topic_id Topic id 3409 * @return mixed False or {@link WP_Error} on failure, topic id on success 3422 * @param int $topic_id Topic id. 3423 * 3424 * @return mixed False or {@link WP_Error} on failure, topic id on success. 3410 3425 */ 3411 3426 function bbp_unapprove_topic( $topic_id = 0 ) { … … 3445 3460 3446 3461 /** 3447 * Unsticks a topic both from front and it's forum 3462 * Unsticks a topic both from front and it's forum. 3448 3463 * 3449 3464 * @since 2.0.0 bbPress (r2754) 3450 3465 * 3451 * @param int $topic_id Optional. Topic id 3466 * @param int $topic_id Optional. Topic id. 3467 * 3452 3468 * @return bool Always true. 3453 3469 */ … … 3503 3519 * handled by WordPress core API functions. It is used to clean up after 3504 3520 * a topic that is being deleted. 3521 * 3522 * @since 2.0.0 bbPress (r2895) 3523 * 3524 * @param int $topic_id Topic id. 3505 3525 */ 3506 3526 function bbp_delete_topic( $topic_id = 0 ) { … … 3517 3537 3518 3538 /** 3519 * Delete replies to a topic when it's deleted 3539 * Delete replies to a topic when it's deleted. 3520 3540 * 3521 3541 * Usually you'll want to do this before the topic itself is deleted. … … 3523 3543 * @since 2.6.0 bbPress (r5405) 3524 3544 * 3525 * @param int $topic_id 3545 * @param int $topic_id Topic id. 3526 3546 */ 3527 3547 function bbp_delete_topic_replies( $topic_id = 0 ) { … … 3562 3582 3563 3583 /** 3564 * Called before trashing a topic 3584 * Called before trashing a topic. 3565 3585 * 3566 3586 * This function is supplemental to the actual topic being trashed which is 3567 3587 * handled by WordPress core API functions. It is used to clean up after 3568 3588 * a topic that is being trashed. 3589 * 3590 * @since 2.0.0 bbPress (r2895) 3591 * 3592 * @param int $topic_id Topic id. 3569 3593 */ 3570 3594 function bbp_trash_topic( $topic_id = 0 ) { … … 3587 3611 * @since 2.6.0 bbPress (r5405) 3588 3612 * 3589 * @param int $topic_id 3613 * @param int $topic_id Topic id. 3590 3614 */ 3591 3615 function bbp_trash_topic_replies( $topic_id = 0 ) { … … 3635 3659 3636 3660 /** 3637 * Called before untrashing a topic 3661 * Called before untrashing a topic. 3662 * 3663 * @since 2.0.0 bbPress (r2895) 3664 * 3665 * @param int $topic_id Topic id. 3638 3666 */ 3639 3667 function bbp_untrash_topic( $topic_id = 0 ) { … … 3654 3682 * @since 2.6.0 bbPress (r5405) 3655 3683 * 3656 * @param int $topic_id 3684 * @param int $topic_id Topic id. 3657 3685 */ 3658 3686 function bbp_untrash_topic_replies( $topic_id = 0 ) { … … 3685 3713 3686 3714 /** 3687 * Called after deleting a topic 3715 * Called after deleting a topic. 3688 3716 * 3689 3717 * @since 2.0.0 bbPress (r2993) 3718 * 3719 * @param int $topic_id Topic id. 3690 3720 */ 3691 3721 function bbp_deleted_topic( $topic_id = 0 ) { … … 3700 3730 3701 3731 /** 3702 * Called after trashing a topic 3732 * Called after trashing a topic. 3703 3733 * 3704 3734 * @since 2.0.0 bbPress (r2993) 3735 * 3736 * @param int $topic_id Topic id. 3705 3737 */ 3706 3738 function bbp_trashed_topic( $topic_id = 0 ) { … … 3715 3747 3716 3748 /** 3717 * Called after untrashing a topic 3749 * Called after untrashing a topic. 3718 3750 * 3719 3751 * @since 2.0.0 bbPress (r2993) 3752 * 3753 * @param int $topic_id Topic id. 3720 3754 */ 3721 3755 function bbp_untrashed_topic( $topic_id = 0 ) { … … 3732 3766 3733 3767 /** 3734 * Return the topics per page setting 3768 * Return the topics per page setting. 3735 3769 * 3736 3770 * @since 2.0.0 bbPress (r3540) 3737 * @return int 3771 * 3772 * @param int $default Optional. Number of topics per page if no value exists. 3773 * 3774 * @return int Number of topics per page. 3738 3775 */ 3739 3776 function bbp_get_topics_per_page( $default = 15 ) { … … 3752 3789 3753 3790 /** 3754 * Return the topics per RSS page setting 3791 * Return the topics per RSS page setting. 3755 3792 * 3756 3793 * @since 2.0.0 bbPress (r3540) 3757 3794 * 3758 3795 * @param int $default Default replies per page (25) 3759 * @return int 3796 * 3797 * @return int Number of topics per RSS page. 3760 3798 */ 3761 3799 function bbp_get_topics_per_rss_page( $default = 25 ) { … … 3776 3814 3777 3815 /** 3778 * Get topic tags for a specific topic ID 3816 * Get topic tags for a specific topic ID. 3779 3817 * 3780 3818 * @since 2.6.0 bbPress (r5836) 3781 3819 * 3782 * @param int $topic_id 3820 * @param int $topic_id Topic id. 3783 3821 * 3784 3822 * @return string … … 3794 3832 3795 3833 /** 3796 * Get topic tags for a specific topic ID 3834 * Get topic tags for a specific topic ID. 3797 3835 * 3798 3836 * @since 2.2.0 bbPress (r4165) 3799 3837 * 3800 * @param int $topic_id 3801 * @param string $sep 3838 * @param int $topic_id Topic id. 3839 * @param string $sep Separator string. 3802 3840 * 3803 3841 * @return string … … 3876 3914 3877 3915 /** 3878 * Check if autoembeds are enabled and hook them in if so 3916 * Check if autoembeds are enabled and hook them in if so. 3879 3917 * 3880 3918 * @since 2.1.0 bbPress (r3752) … … 3989 4027 3990 4028 /** 3991 * Redirect if unauthorized user is attempting to edit a topic 4029 * Redirect if unauthorized user is attempting to edit a topic. 3992 4030 * 3993 4031 * @since 2.1.0 bbPress (r3605) … … 4007 4045 4008 4046 /** 4009 * Redirect if unauthorized user is attempting to edit a topic tag 4047 * Redirect if unauthorized user is attempting to edit a topic tag. 4010 4048 * 4011 4049 * @since 2.1.0 bbPress (r3605) -
trunk/src/includes/topics/template.php
r7379 r7380 2 2 3 3 /** 4 * bbPress Topic Template Tags 4 * bbPress Topic Template Tags. 5 5 * 6 6 * @package bbPress … … 14 14 15 15 /** 16 * Output the unique id of the custom post type for topics 16 * Output the unique id of the custom post type for topics. 17 17 * 18 18 * @since 2.0.0 bbPress (r2857) … … 21 21 echo bbp_get_topic_post_type(); 22 22 } 23 /** 24 * Return the unique id of the custom post type for topics 25 * 26 * @since 2.0.0 bbPress (r2857) 27 * 28 * @return string The unique topic post type id 29 */ 30 function bbp_get_topic_post_type() { 31 32 // Filter & return 33 return apply_filters( 'bbp_get_topic_post_type', bbpress()->topic_post_type ); 34 } 35 36 /** 37 * Return array of labels used by the topic post type 23 24 /** 25 * Return the unique id of the custom post type for topics. 26 * 27 * @since 2.0.0 bbPress (r2857) 28 * 29 * @return string The unique topic post type id. 30 */ 31 function bbp_get_topic_post_type() { 32 33 // Filter & return 34 return apply_filters( 'bbp_get_topic_post_type', bbpress()->topic_post_type ); 35 } 36 37 /** 38 * Return array of labels used by the topic post type. 38 39 * 39 40 * @since 2.5.0 bbPress (r5129) … … 84 85 85 86 /** 86 * Return array of topic post type rewrite settings 87 * Return array of topic post type rewrite settings. 87 88 * 88 89 * @since 2.5.0 bbPress (r5129) … … 103 104 104 105 /** 105 * Return array of features the topic post type supports 106 * Return array of features the topic post type supports. 106 107 * 107 108 * @since 2.5.0 bbPress (r5129) … … 129 130 * @since 2.0.0 bbPress (r2954) 130 131 * 131 * @param $show_lead Optional. Default false 132 * @return bool Yes if the topic appears as a lead, otherwise false 132 * @param $show_lead Optional. Default false. 133 * @return bool Yes if the topic appears as a lead, otherwise false. 133 134 */ 134 135 function bbp_show_lead_topic( $show_lead = false ) { … … 146 147 147 148 /** 148 * The main topic loop. WordPress makes this easy for us 149 * The main topic loop. WordPress makes this easy for us. 149 150 * 150 151 * @since 2.0.0 bbPress (r2485) 151 152 * 152 * @param array $args All the arguments supported by {@link WP_Query} 153 * @return object Multidimensional array of topic information 153 * @param array $args All the arguments supported by {@link WP_Query}. 154 * @return object Multidimensional array of topic information. 154 155 */ 155 156 function bbp_has_topics( $args = array() ) { … … 294 295 295 296 /** 296 * Whether there are more topics available in the loop 297 * Whether there are more topics available in the loop. 297 298 * 298 299 * @since 2.0.0 bbPress (r2485) 299 300 * 300 * @return object Topic information 301 * @return object Topic information. 301 302 */ 302 303 function bbp_topics() { … … 314 315 315 316 /** 316 * Loads up the current topic in the loop 317 * Loads up the current topic in the loop. 317 318 * 318 319 * @since 2.0.0 bbPress (r2485) 319 320 * 320 * @return object Topic information 321 * @return object Topic information. 321 322 */ 322 323 function bbp_the_topic() { … … 325 326 326 327 /** 327 * Add sticky topics to a topics query object 328 * Add sticky topics to a topics query object. 328 329 * 329 330 * @since 2.6.0 bbPress (r6402) … … 467 468 468 469 /** 469 * Output the topic id 470 * Output the topic id. 470 471 * 471 472 * @since 2.0.0 bbPress (r2485) … … 474 475 echo bbp_get_topic_id( $topic_id ); 475 476 } 476 /** 477 * Return the topic id 478 * 479 * @since 2.0.0 bbPress (r2485) 480 * 481 * @param $topic_id Optional. Used to check emptiness 482 * @return int The topic id 483 */ 484 function bbp_get_topic_id( $topic_id = 0 ) { 485 $bbp = bbpress(); 486 $wp_query = bbp_get_wp_query(); 487 488 // Easy empty checking 489 if ( ! empty( $topic_id ) && is_numeric( $topic_id ) ) { 490 $bbp_topic_id = $topic_id; 491 492 // Currently inside a topic loop 493 } elseif ( ! empty( $bbp->topic_query->in_the_loop ) && isset( $bbp->topic_query->post->ID ) ) { 494 $bbp_topic_id = $bbp->topic_query->post->ID; 495 496 // Currently inside a search loop 497 } elseif ( ! empty( $bbp->search_query->in_the_loop ) && isset( $bbp->search_query->post->ID ) && bbp_is_topic( $bbp->search_query->post->ID ) ) { 498 $bbp_topic_id = $bbp->search_query->post->ID; 499 500 // Currently viewing/editing a topic, likely alone 501 } elseif ( ( bbp_is_single_topic() || bbp_is_topic_edit() ) && ! empty( $bbp->current_topic_id ) ) { 502 $bbp_topic_id = $bbp->current_topic_id; 503 504 // Currently viewing/editing a topic, likely in a loop 505 } elseif ( ( bbp_is_single_topic() || bbp_is_topic_edit() ) && isset( $wp_query->post->ID ) ) { 506 $bbp_topic_id = $wp_query->post->ID; 507 508 // Currently viewing/editing a reply 509 } elseif ( bbp_is_single_reply() || bbp_is_reply_edit() ) { 510 $bbp_topic_id = bbp_get_reply_topic_id(); 511 512 // Fallback 513 } else { 514 $bbp_topic_id = 0; 515 } 516 517 // Filter & return 518 return (int) apply_filters( 'bbp_get_topic_id', (int) $bbp_topic_id, $topic_id ); 519 } 520 521 /** 522 * Gets a topic 477 478 /** 479 * Return the topic id. 480 * 481 * @since 2.0.0 bbPress (r2485) 482 * 483 * @param $topic_id Optional. Used to check emptiness. 484 * @return int The topic id. 485 */ 486 function bbp_get_topic_id( $topic_id = 0 ) { 487 $bbp = bbpress(); 488 $wp_query = bbp_get_wp_query(); 489 490 // Easy empty checking 491 if ( ! empty( $topic_id ) && is_numeric( $topic_id ) ) { 492 $bbp_topic_id = $topic_id; 493 494 // Currently inside a topic loop 495 } elseif ( ! empty( $bbp->topic_query->in_the_loop ) && isset( $bbp->topic_query->post->ID ) ) { 496 $bbp_topic_id = $bbp->topic_query->post->ID; 497 498 // Currently inside a search loop 499 } elseif ( ! empty( $bbp->search_query->in_the_loop ) && isset( $bbp->search_query->post->ID ) && bbp_is_topic( $bbp->search_query->post->ID ) ) { 500 $bbp_topic_id = $bbp->search_query->post->ID; 501 502 // Currently viewing/editing a topic, likely alone 503 } elseif ( ( bbp_is_single_topic() || bbp_is_topic_edit() ) && ! empty( $bbp->current_topic_id ) ) { 504 $bbp_topic_id = $bbp->current_topic_id; 505 506 // Currently viewing/editing a topic, likely in a loop 507 } elseif ( ( bbp_is_single_topic() || bbp_is_topic_edit() ) && isset( $wp_query->post->ID ) ) { 508 $bbp_topic_id = $wp_query->post->ID; 509 510 // Currently viewing/editing a reply 511 } elseif ( bbp_is_single_reply() || bbp_is_reply_edit() ) { 512 $bbp_topic_id = bbp_get_reply_topic_id(); 513 514 // Fallback 515 } else { 516 $bbp_topic_id = 0; 517 } 518 519 // Filter & return 520 return (int) apply_filters( 'bbp_get_topic_id', (int) $bbp_topic_id, $topic_id ); 521 } 522 523 /** 524 * Gets a topic. 523 525 * 524 526 * @since 2.0.0 bbPress (r2787) 525 527 * 526 * @return mixed Null if error or topic (in specified form) if success 528 * @return mixed Null if error or topic (in specified form) if success. 527 529 */ 528 530 function bbp_get_topic( $topic, $output = OBJECT, $filter = 'raw' ) { … … 561 563 562 564 /** 563 * Output the link to the topic in the topic loop 565 * Output the link to the topic in the topic loop. 564 566 * 565 567 * @since 2.0.0 bbPress (r2485) 566 568 * 567 * @param int $topic_id Optional. Topic id 569 * @param int $topic_id Optional. Topic id. 568 570 * @param string $redirect_to Optional. Pass a redirect value for use with 569 571 * shortcodes and other fun things. … … 572 574 echo esc_url( bbp_get_topic_permalink( $topic_id, $redirect_to ) ); 573 575 } 574 /** 575 * Return the link to the topic 576 * 577 * @since 2.0.0 bbPress (r2485) 578 * 579 * @param int $topic_id Optional. Topic id 580 * @param string $redirect_to Optional. Pass a redirect value for use with 581 * shortcodes and other fun things. 582 * @return string Permanent link to topic 583 */ 584 function bbp_get_topic_permalink( $topic_id = 0, $redirect_to = '' ) { 585 $topic_id = bbp_get_topic_id( $topic_id ); 586 587 // Use the redirect address 588 if ( ! empty( $redirect_to ) ) { 589 $topic_permalink = esc_url_raw( $redirect_to ); 590 591 // Use the topic permalink 592 } else { 593 $topic_permalink = get_permalink( $topic_id ); 594 } 595 596 // Filter & return 597 return apply_filters( 'bbp_get_topic_permalink', $topic_permalink, $topic_id ); 598 } 599 600 /** 601 * Output the title of the topic 576 577 /** 578 * Return the link to the topic. 602 579 * 603 580 * @since 2.0.0 bbPress (r2485) 604 581 * 605 * @param int $topic_id Optional. Topic id 582 * @param int $topic_id Optional. Topic id. 583 * @param string $redirect_to Optional. Pass a redirect value for use with 584 * shortcodes and other fun things. 585 * @return string Permanent link to topic. 586 */ 587 function bbp_get_topic_permalink( $topic_id = 0, $redirect_to = '' ) { 588 $topic_id = bbp_get_topic_id( $topic_id ); 589 590 // Use the redirect address 591 if ( ! empty( $redirect_to ) ) { 592 $topic_permalink = esc_url_raw( $redirect_to ); 593 594 // Use the topic permalink 595 } else { 596 $topic_permalink = get_permalink( $topic_id ); 597 } 598 599 // Filter & return 600 return apply_filters( 'bbp_get_topic_permalink', $topic_permalink, $topic_id ); 601 } 602 603 /** 604 * Output the title of the topic. 605 * 606 * @since 2.0.0 bbPress (r2485) 607 * 608 * @param int $topic_id Optional. Topic id. 606 609 */ 607 610 function bbp_topic_title( $topic_id = 0 ) { 608 611 echo bbp_get_topic_title( $topic_id ); 609 612 } 610 /** 611 * Return the title of the topic 612 * 613 * @since 2.0.0 bbPress (r2485) 614 * 615 * @param int $topic_id Optional. Topic id 616 * @return string Title of topic 617 */ 618 function bbp_get_topic_title( $topic_id = 0 ) { 619 $topic_id = bbp_get_topic_id( $topic_id ); 620 $title = get_post_field( 'post_title', $topic_id ); 621 $title = apply_filters( 'the_title', $title, $topic_id ); 622 623 // Filter & return 624 return apply_filters( 'bbp_get_topic_title', $title, $topic_id ); 625 } 626 627 /** 628 * Output the topic archive title 613 614 /** 615 * Return the title of the topic. 616 * 617 * @since 2.0.0 bbPress (r2485) 618 * 619 * @param int $topic_id Optional. Topic id. 620 * @return string Title of topic. 621 */ 622 function bbp_get_topic_title( $topic_id = 0 ) { 623 $topic_id = bbp_get_topic_id( $topic_id ); 624 $title = get_post_field( 'post_title', $topic_id ); 625 $title = apply_filters( 'the_title', $title, $topic_id ); 626 627 // Filter & return 628 return apply_filters( 'bbp_get_topic_title', $title, $topic_id ); 629 } 630 631 /** 632 * Output the topic archive title. 629 633 * 630 634 * @since 2.0.0 bbPress (r3249) 631 635 * 632 * @param string $title Default text to use as title 636 * @param string $title Default text to use as title. 633 637 */ 634 638 function bbp_topic_archive_title( $title = '' ) { 635 639 echo bbp_get_topic_archive_title( $title ); 636 640 } 637 /** 638 * Return the topic archive title 639 * 640 * @since 2.0.0 bbPress (r3249) 641 * 642 * @param string $title Default text to use as title 643 * 644 * @return string The topic archive title 645 */ 646 function bbp_get_topic_archive_title( $title = '' ) { 647 648 // If no title was passed 649 if ( empty( $title ) ) {650 651 // Set root text to page title 652 $page = bbp_get_page_by_path( bbp_get_topic_archive_slug() );653 if ( ! empty( $page ) ) {654 $title = get_the_title( $page->ID );655 656 // Default to topic post type name label 657 } else {658 $tto = get_post_type_object( bbp_get_topic_post_type() );659 $title = $tto->labels->name;660 }641 642 /** 643 * Return the topic archive title. 644 * 645 * @since 2.0.0 bbPress (r3249) 646 * 647 * @param string $title Default text to use as title. 648 * 649 * @return string The topic archive title. 650 */ 651 function bbp_get_topic_archive_title( $title = '' ) { 652 653 // If no title was passed 654 if ( empty( $title ) ) { 655 656 // Set root text to page title 657 $page = bbp_get_page_by_path( bbp_get_topic_archive_slug() ); 658 if ( ! empty( $page ) ) { 659 $title = get_the_title( $page->ID ); 660 661 // Default to topic post type name label 662 } else { 663 $tto = get_post_type_object( bbp_get_topic_post_type() ); 664 $title = $tto->labels->name; 661 665 } 662 663 // Filter & return 664 return apply_filters( 'bbp_get_topic_archive_title', $title ); 665 } 666 667 /** 668 * Output the content of the topic 666 } 667 668 // Filter & return 669 return apply_filters( 'bbp_get_topic_archive_title', $title ); 670 } 671 672 /** 673 * Output the content of the topic. 669 674 * 670 675 * @since 2.0.0 bbPress (r2780) 671 676 * 672 * @param int $topic_id Optional. Topic id 677 * @param int $topic_id Optional. Topic id. 673 678 */ 674 679 function bbp_topic_content( $topic_id = 0 ) { 675 680 echo bbp_get_topic_content( $topic_id ); 676 681 } 677 /** 678 * Return the content of the topic 679 * 680 * @since 2.0.0 bbPress (r2780) 681 * 682 * @param int $topic_id Optional. Topic id 683 * @return string Content of the topic 684 */ 685 function bbp_get_topic_content( $topic_id = 0 ) { 686 $topic_id = bbp_get_topic_id( $topic_id ); 687 688 // Check if password is required 689 if ( post_password_required( $topic_id ) ) { 690 return get_the_password_form(); 691 } 692 693 $content = get_post_field( 'post_content', $topic_id ); 694 695 // Filter & return 696 return apply_filters( 'bbp_get_topic_content', $content, $topic_id ); 697 } 698 699 /** 700 * Output the excerpt of the topic 682 683 /** 684 * Return the content of the topic. 701 685 * 702 686 * @since 2.0.0 bbPress (r2780) 703 687 * 704 * @param int $topic_id Optional. Topic id 705 * @param int $length Optional. Length of the excerpt. Defaults to 100 letters 688 * @param int $topic_id Optional. Topic id. 689 * @return string Content of the topic. 690 */ 691 function bbp_get_topic_content( $topic_id = 0 ) { 692 $topic_id = bbp_get_topic_id( $topic_id ); 693 694 // Check if password is required 695 if ( post_password_required( $topic_id ) ) { 696 return get_the_password_form(); 697 } 698 699 $content = get_post_field( 'post_content', $topic_id ); 700 701 // Filter & return 702 return apply_filters( 'bbp_get_topic_content', $content, $topic_id ); 703 } 704 705 /** 706 * Output the excerpt of the topic. 707 * 708 * @since 2.0.0 bbPress (r2780) 709 * 710 * @param int $topic_id Optional. Topic id. 711 * @param int $length Optional. Length of the excerpt. Defaults to 100 letters. 706 712 */ 707 713 function bbp_topic_excerpt( $topic_id = 0, $length = 100 ) { 708 714 echo bbp_get_topic_excerpt( $topic_id, $length ); 709 715 } 710 /** 711 * Return the excerpt of the topic 712 * 713 * @since 2.0.0 bbPress (r2780) 714 * 715 * @param int $topic_id Optional. topic id 716 * @param int $length Optional. Length of the excerpt. Defaults to 100 717 * letters 718 * @return string topic Excerpt 719 */ 720 function bbp_get_topic_excerpt( $topic_id = 0, $length = 100 ) { 721 $topic_id = bbp_get_topic_id( $topic_id ); 722 $length = (int) $length; 723 $excerpt = get_post_field( 'post_excerpt', $topic_id ); 724 725 if ( empty( $excerpt ) ) { 726 $excerpt = bbp_get_topic_content( $topic_id ); 727 } 728 729 $excerpt = wp_strip_all_tags( $excerpt ); 730 731 // Multibyte support 732 if ( function_exists( 'mb_strlen' ) ) { 733 $excerpt_length = mb_strlen( $excerpt ); 734 } else { 735 $excerpt_length = strlen( $excerpt ); 736 } 737 738 if ( ! empty( $length ) && ( $excerpt_length > $length ) ) { 739 $excerpt = mb_substr( $excerpt, 0, $length - 1 ); 740 $excerpt .= '…'; 741 } 742 743 // Filter & return 744 return apply_filters( 'bbp_get_topic_excerpt', $excerpt, $topic_id, $length ); 745 } 746 747 /** 748 * Output the post date and time of a topic 716 717 /** 718 * Return the excerpt of the topic. 719 * 720 * @since 2.0.0 bbPress (r2780) 721 * 722 * @param int $topic_id Optional. topic id. 723 * @param int $length Optional. Length of the excerpt. Defaults to 100 724 * letters. 725 * @return string topic Excerpt. 726 */ 727 function bbp_get_topic_excerpt( $topic_id = 0, $length = 100 ) { 728 $topic_id = bbp_get_topic_id( $topic_id ); 729 $length = (int) $length; 730 $excerpt = get_post_field( 'post_excerpt', $topic_id ); 731 732 if ( empty( $excerpt ) ) { 733 $excerpt = bbp_get_topic_content( $topic_id ); 734 } 735 736 $excerpt = wp_strip_all_tags( $excerpt ); 737 738 // Multibyte support 739 if ( function_exists( 'mb_strlen' ) ) { 740 $excerpt_length = mb_strlen( $excerpt ); 741 } else { 742 $excerpt_length = strlen( $excerpt ); 743 } 744 745 if ( ! empty( $length ) && ( $excerpt_length > $length ) ) { 746 $excerpt = mb_substr( $excerpt, 0, $length - 1 ); 747 $excerpt .= '…'; 748 } 749 750 // Filter & return 751 return apply_filters( 'bbp_get_topic_excerpt', $excerpt, $topic_id, $length ); 752 } 753 754 /** 755 * Output the post date and time of a topic. 749 756 * 750 757 * @since 2.2.0 bbPress (r4155) 751 758 * 752 759 * @param int $topic_id Optional. Topic id. 753 * @param bool $humanize Optional. Humanize output using time_since 754 * @param bool $gmt Optional. Use GMT 760 * @param bool $humanize Optional. Humanize output using time_since. 761 * @param bool $gmt Optional. Use GMT. 755 762 */ 756 763 function bbp_topic_post_date( $topic_id = 0, $humanize = false, $gmt = false ) { 757 764 echo bbp_get_topic_post_date( $topic_id, $humanize, $gmt ); 758 765 } 759 /** 760 * Return the post date and time of a topic 761 * 762 * @since 2.2.0 bbPress (r4155) 763 * 764 * @param int $topic_id Optional. Topic id. 765 * @param bool $humanize Optional. Humanize output using time_since 766 * @param bool $gmt Optional. Use GMT 767 * @return string 768 */ 769 function bbp_get_topic_post_date( $topic_id = 0, $humanize = false, $gmt = false ) { 770 $topic_id = bbp_get_topic_id( $topic_id ); 771 772 // 4 days, 4 hours ago 773 if ( ! empty( $humanize ) ) { 774 $gmt_s = ! empty( $gmt ) ? 'G' : 'U'; 775 $date = get_post_time( $gmt_s, $gmt, $topic_id ); 776 $time = false; // For filter below 777 $result = bbp_get_time_since( $date ); 778 779 // August 4, 2012 at 2:37 pm 780 } else { 781 $date = get_post_time( get_option( 'date_format' ), $gmt, $topic_id, true ); 782 $time = get_post_time( get_option( 'time_format' ), $gmt, $topic_id, true ); 783 /* translators: 1: Date, 2: Time */ 784 $result = sprintf( _x( '%1$s at %2$s', 'date at time', 'bbpress' ), $date, $time ); 785 } 786 787 // Filter & return 788 return apply_filters( 'bbp_get_topic_post_date', $result, $topic_id, $humanize, $gmt, $date, $time ); 789 } 790 791 /** 792 * Output pagination links of a topic within the topic loop 766 767 /** 768 * Return the post date and time of a topic. 769 * 770 * @since 2.2.0 bbPress (r4155) 771 * 772 * @param int $topic_id Optional. Topic id. 773 * @param bool $humanize Optional. Humanize output using time_since. 774 * @param bool $gmt Optional. Use GMT. 775 * @return string 776 */ 777 function bbp_get_topic_post_date( $topic_id = 0, $humanize = false, $gmt = false ) { 778 $topic_id = bbp_get_topic_id( $topic_id ); 779 780 // 4 days, 4 hours ago 781 if ( ! empty( $humanize ) ) { 782 $gmt_s = ! empty( $gmt ) ? 'G' : 'U'; 783 $date = get_post_time( $gmt_s, $gmt, $topic_id ); 784 $time = false; // For filter below 785 $result = bbp_get_time_since( $date ); 786 787 // August 4, 2012 at 2:37 pm 788 } else { 789 $date = get_post_time( get_option( 'date_format' ), $gmt, $topic_id, true ); 790 $time = get_post_time( get_option( 'time_format' ), $gmt, $topic_id, true ); 791 /* translators: 1: Date, 2: Time */ 792 $result = sprintf( _x( '%1$s at %2$s', 'date at time', 'bbpress' ), $date, $time ); 793 } 794 795 // Filter & return 796 return apply_filters( 'bbp_get_topic_post_date', $result, $topic_id, $humanize, $gmt, $date, $time ); 797 } 798 799 /** 800 * Output pagination links of a topic within the topic loop. 793 801 * 794 802 * @since 2.0.0 bbPress (r2966) 795 803 * 796 * @param array $args See {@link bbp_get_topic_pagination()} 804 * @param array $args See {@link bbp_get_topic_pagination()}. 797 805 */ 798 806 function bbp_topic_pagination( $args = array() ) { 799 807 echo bbp_get_topic_pagination( $args ); 800 808 } 801 /** 802 * Returns pagination links of a topic within the topic loop 803 * 804 * @since 2.0.0 bbPress (r2966) 805 * 806 * @param array $args This function supports these arguments: 807 * - topic_id: Topic id 808 * - before: Before the links 809 * - after: After the links 810 * @return string Pagination links 811 */ 812 function bbp_get_topic_pagination( $args = array() ) { 813 814 // Bail if threading replies 815 if ( bbp_thread_replies() ) { 816 return; 817 } 818 819 // Parse arguments against default values 820 $r = bbp_parse_args( 821 $args, 822 array( 823 'topic_id' => bbp_get_topic_id(), 824 'before' => '<span class="bbp-topic-pagination">', 825 'after' => '</span>', 826 ), 827 'get_topic_pagination' 828 ); 829 830 // Slug must be checked for topics that have never been approved/published 831 $has_slug = bbp_get_topic( $r['topic_id'] )->post_name; 832 833 // Get the topic permalink 834 $topic_permalink = bbp_get_topic_permalink( $r['topic_id'] ); 835 836 // If pretty permalinks are enabled, make our pagination pretty 837 $base = ! empty( $has_slug ) && bbp_use_pretty_urls() && bbp_is_topic_public( $r['topic_id'] ) 838 ? trailingslashit( $topic_permalink ) . user_trailingslashit( bbp_get_paged_slug() . '/%#%/' ) 839 : add_query_arg( 'paged', '%#%', $topic_permalink ); 840 841 // Get total and add 1 if topic is included in the reply loop 842 $total = bbp_get_topic_reply_count( $r['topic_id'], true ); 843 844 // Bump if topic is in loop 845 if ( ! bbp_show_lead_topic() ) { 846 ++$total; 847 } 848 849 // Total for pagination boundaries 850 $total_pages = ceil( $total / bbp_get_replies_per_page() ); 851 852 // Maybe add view-all args 853 $add_args = bbp_get_view_all( 'edit_others_replies' ) 854 ? array( 'view' => 'all' ) 855 : false; 856 857 // Pagination settings with filter 858 $bbp_topic_pagination = apply_filters( 859 'bbp_get_topic_pagination', 860 array( 861 'base' => $base, 862 'total' => $total_pages, 863 'current' => 0, 864 'prev_next' => false, 865 'mid_size' => 2, 866 'end_size' => 2, 867 'add_args' => $add_args 868 ) 869 ); 870 871 // Add pagination to query object 872 $pagination_links = bbp_paginate_links( $bbp_topic_pagination ); 873 874 // Maybe add before and after to pagination links 875 if ( ! empty( $pagination_links ) ) { 876 $pagination_links = $r['before'] . $pagination_links . $r['after']; 877 } 878 879 // Filter & return 880 return apply_filters( 'bbp_get_topic_pagination', $pagination_links, $args ); 881 } 882 883 /** 884 * Append revisions to the topic content 809 810 /** 811 * Returns pagination links of a topic within the topic loop. 812 * 813 * @since 2.0.0 bbPress (r2966) 814 * 815 * @param array $args This function supports these arguments: 816 * - topic_id: Topic id 817 * - before: Before the links 818 * - after: After the links 819 * @return string Pagination links. 820 */ 821 function bbp_get_topic_pagination( $args = array() ) { 822 823 // Bail if threading replies 824 if ( bbp_thread_replies() ) { 825 return; 826 } 827 828 // Parse arguments against default values 829 $r = bbp_parse_args( 830 $args, 831 array( 832 'topic_id' => bbp_get_topic_id(), 833 'before' => '<span class="bbp-topic-pagination">', 834 'after' => '</span>', 835 ), 836 'get_topic_pagination' 837 ); 838 839 // Slug must be checked for topics that have never been approved/published 840 $has_slug = bbp_get_topic( $r['topic_id'] )->post_name; 841 842 // Get the topic permalink 843 $topic_permalink = bbp_get_topic_permalink( $r['topic_id'] ); 844 845 // If pretty permalinks are enabled, make our pagination pretty 846 $base = ! empty( $has_slug ) && bbp_use_pretty_urls() && bbp_is_topic_public( $r['topic_id'] ) 847 ? trailingslashit( $topic_permalink ) . user_trailingslashit( bbp_get_paged_slug() . '/%#%/' ) 848 : add_query_arg( 'paged', '%#%', $topic_permalink ); 849 850 // Get total and add 1 if topic is included in the reply loop 851 $total = bbp_get_topic_reply_count( $r['topic_id'], true ); 852 853 // Bump if topic is in loop 854 if ( ! bbp_show_lead_topic() ) { 855 ++$total; 856 } 857 858 // Total for pagination boundaries 859 $total_pages = ceil( $total / bbp_get_replies_per_page() ); 860 861 // Maybe add view-all args 862 $add_args = bbp_get_view_all( 'edit_others_replies' ) 863 ? array( 'view' => 'all' ) 864 : false; 865 866 // Pagination settings with filter 867 $bbp_topic_pagination = apply_filters( 868 'bbp_get_topic_pagination', 869 array( 870 'base' => $base, 871 'total' => $total_pages, 872 'current' => 0, 873 'prev_next' => false, 874 'mid_size' => 2, 875 'end_size' => 2, 876 'add_args' => $add_args 877 ) 878 ); 879 880 // Add pagination to query object 881 $pagination_links = bbp_paginate_links( $bbp_topic_pagination ); 882 883 // Maybe add before and after to pagination links 884 if ( ! empty( $pagination_links ) ) { 885 $pagination_links = $r['before'] . $pagination_links . $r['after']; 886 } 887 888 // Filter & return 889 return apply_filters( 'bbp_get_topic_pagination', $pagination_links, $args ); 890 } 891 892 /** 893 * Append revisions to the topic content. 885 894 * 886 895 * @since 2.0.0 bbPress (r2782) 887 896 * 888 * @param string $content Optional. Content to which we need to append the revisions to 889 * @param int $topic_id Optional. Topic id 890 * @return string Content with the revisions appended 897 * @param string $content Optional. Content to which we need to append the revisions to. 898 * @param int $topic_id Optional. Topic id. 899 * @return string Content with the revisions appended. 891 900 */ 892 901 function bbp_topic_content_append_revisions( $content = '', $topic_id = 0 ) { … … 905 914 906 915 /** 907 * Output the revision log of the topic 916 * Output the revision log of the topic. 908 917 * 909 918 * @since 2.0.0 bbPress (r2782) 910 919 * 911 * @param int $topic_id Optional. Topic id 920 * @param int $topic_id Optional. Topic id. 912 921 */ 913 922 function bbp_topic_revision_log( $topic_id = 0 ) { 914 923 echo bbp_get_topic_revision_log( $topic_id ); 915 924 } 916 /** 917 * Return the formatted revision log of the topic 918 * 919 * @since 2.0.0 bbPress (r2782) 920 * 921 * @param int $topic_id Optional. Topic id 922 * @return string Revision log of the topic 923 */ 924 function bbp_get_topic_revision_log( $topic_id = 0 ) { 925 926 // Create necessary variables 927 $topic_id = bbp_get_topic_id( $topic_id ); 928 $revision_log = bbp_get_topic_raw_revision_log( $topic_id ); 929 930 if ( empty( $topic_id ) || empty( $revision_log ) || ! is_array( $revision_log ) ) { 931 return false; 925 926 /** 927 * Return the formatted revision log of the topic. 928 * 929 * @since 2.0.0 bbPress (r2782) 930 * 931 * @param int $topic_id Optional. Topic id. 932 * @return string Revision log of the topic. 933 */ 934 function bbp_get_topic_revision_log( $topic_id = 0 ) { 935 936 // Create necessary variables 937 $topic_id = bbp_get_topic_id( $topic_id ); 938 $revision_log = bbp_get_topic_raw_revision_log( $topic_id ); 939 940 if ( empty( $topic_id ) || empty( $revision_log ) || ! is_array( $revision_log ) ) { 941 return false; 942 } 943 944 $revisions = bbp_get_topic_revisions( $topic_id ); 945 if ( empty( $revisions ) ) { 946 return false; 947 } 948 949 $retval = "\n\n" . '<ul id="bbp-topic-revision-log-' . esc_attr( $topic_id ) . '" class="bbp-topic-revision-log">' . "\n\n"; 950 951 // Loop through revisions 952 foreach ( (array) $revisions as $revision ) { 953 954 if ( empty( $revision_log[ $revision->ID ] ) ) { 955 $author_id = $revision->post_author; 956 $reason = ''; 957 } else { 958 $author_id = $revision_log[ $revision->ID ]['author']; 959 $reason = $revision_log[ $revision->ID ]['reason']; 932 960 } 933 961 934 $revisions = bbp_get_topic_revisions( $topic_id ); 935 if ( empty( $revisions ) ) { 936 return false; 962 $since = bbp_get_time_since( bbp_convert_date( $revision->post_modified ) ); 963 $author = bbp_get_author_link( 964 array( 965 'size' => 14, 966 'link_text' => bbp_get_topic_author_display_name( $revision->ID ), 967 'post_id' => $revision->ID 968 ) 969 ); 970 971 $retval .= "\t" . '<li id="bbp-topic-revision-log-' . esc_attr( $topic_id ) . '-item-' . esc_attr( $revision->ID ) . '" class="bbp-topic-revision-log-item">' . "\n"; 972 if ( ! empty( $reason ) ) { 973 /* translators: 1: Time since modification, 2: Author link, 3: Modification reason */ 974 $retval .= "\t\t" . sprintf( esc_html__( 'This topic was modified %1$s by %2$s. Reason: %3$s', 'bbpress' ), esc_html( $since ), $author, esc_html( $reason ) ) . "\n"; 975 } else { 976 /* translators: 1: Time since modification, 2: Author link */ 977 $retval .= "\t\t" . sprintf( esc_html__( 'This topic was modified %1$s by %2$s.', 'bbpress' ), esc_html( $since ), $author ) . "\n"; 937 978 } 938 939 $retval = "\n\n" . '<ul id="bbp-topic-revision-log-' . esc_attr( $topic_id ) . '" class="bbp-topic-revision-log">' . "\n\n"; 940 941 // Loop through revisions 942 foreach ( (array) $revisions as $revision ) { 943 944 if ( empty( $revision_log[ $revision->ID ] ) ) { 945 $author_id = $revision->post_author; 946 $reason = ''; 947 } else { 948 $author_id = $revision_log[ $revision->ID ]['author']; 949 $reason = $revision_log[ $revision->ID ]['reason']; 950 } 951 952 $since = bbp_get_time_since( bbp_convert_date( $revision->post_modified ) ); 953 $author = bbp_get_author_link( 954 array( 955 'size' => 14, 956 'link_text' => bbp_get_topic_author_display_name( $revision->ID ), 957 'post_id' => $revision->ID 958 ) 959 ); 960 961 $retval .= "\t" . '<li id="bbp-topic-revision-log-' . esc_attr( $topic_id ) . '-item-' . esc_attr( $revision->ID ) . '" class="bbp-topic-revision-log-item">' . "\n"; 962 if ( ! empty( $reason ) ) { 963 /* translators: 1: Time since modification, 2: Author link, 3: Modification reason */ 964 $retval .= "\t\t" . sprintf( esc_html__( 'This topic was modified %1$s by %2$s. Reason: %3$s', 'bbpress' ), esc_html( $since ), $author, esc_html( $reason ) ) . "\n"; 965 } else { 966 /* translators: 1: Time since modification, 2: Author link */ 967 $retval .= "\t\t" . sprintf( esc_html__( 'This topic was modified %1$s by %2$s.', 'bbpress' ), esc_html( $since ), $author ) . "\n"; 968 } 969 $retval .= "\t" . '</li>' . "\n"; 970 } 971 972 $retval .= "\n" . '</ul>' . "\n\n"; 973 974 // Filter & return 975 return apply_filters( 'bbp_get_topic_revision_log', $retval, $topic_id ); 976 } 977 /** 978 * Return the raw revision log of the topic 979 * 980 * @since 2.0.0 bbPress (r2782) 981 * 982 * @param int $topic_id Optional. Topic id 983 * @return string Raw revision log of the topic 984 */ 985 function bbp_get_topic_raw_revision_log( $topic_id = 0 ) { 986 $topic_id = bbp_get_topic_id( $topic_id ); 987 988 $revision_log = get_post_meta( $topic_id, '_bbp_revision_log', true ); 989 $revision_log = ! empty( $revision_log ) 990 ? $revision_log 991 : array(); 992 993 // Filter & return 994 return apply_filters( 'bbp_get_topic_raw_revision_log', $revision_log, $topic_id ); 995 } 996 997 /** 998 * Return the revisions of the topic 979 $retval .= "\t" . '</li>' . "\n"; 980 } 981 982 $retval .= "\n" . '</ul>' . "\n\n"; 983 984 // Filter & return 985 return apply_filters( 'bbp_get_topic_revision_log', $retval, $topic_id ); 986 } 987 988 /** 989 * Return the raw revision log of the topic. 999 990 * 1000 991 * @since 2.0.0 bbPress (r2782) 1001 992 * 1002 * @param int $topic_id Optional. Topic id 1003 * @return WP_Post[]|int[] Topic revisions 993 * @param int $topic_id Optional. Topic id. 994 * @return string Raw revision log of the topic. 995 */ 996 function bbp_get_topic_raw_revision_log( $topic_id = 0 ) { 997 $topic_id = bbp_get_topic_id( $topic_id ); 998 999 $revision_log = get_post_meta( $topic_id, '_bbp_revision_log', true ); 1000 $revision_log = ! empty( $revision_log ) 1001 ? $revision_log 1002 : array(); 1003 1004 // Filter & return 1005 return apply_filters( 'bbp_get_topic_raw_revision_log', $revision_log, $topic_id ); 1006 } 1007 1008 /** 1009 * Return the revisions of the topic. 1010 * 1011 * @since 2.0.0 bbPress (r2782) 1012 * 1013 * @param int $topic_id Optional. Topic id. 1014 * @return WP_Post[]|int[] Topic revisions. 1004 1015 */ 1005 1016 function bbp_get_topic_revisions( $topic_id = 0 ) { … … 1012 1023 1013 1024 /** 1014 * Return the revision count of the topic 1025 * Return the revision count of the topic. 1015 1026 * 1016 1027 * @since 2.0.0 bbPress (r2782) 1017 1028 * 1018 * @param int $topic_id Optional. Topic id 1019 * @return string Topic revision count 1029 * @param int $topic_id Optional. Topic id. 1030 * @return string Topic revision count. 1020 1031 */ 1021 1032 function bbp_get_topic_revision_count( $topic_id = 0, $integer = false ) { … … 1034 1045 * @since 2.0.0 bbPress (r2754) 1035 1046 * 1036 * @param int $topic_id Optional. Topic id 1047 * @param int $topic_id Optional. Topic id. 1037 1048 * @param int $check_super Optional. If set to true and if the topic is not a 1038 1049 * normal sticky, it is checked if it is a super … … 1060 1071 * @since 2.0.0 bbPress (r2754) 1061 1072 * 1062 * @param int $topic_id Optional. Topic id 1073 * @param int $topic_id Optional. Topic id. 1063 1074 * @return bool True if super sticky, false if not. 1064 1075 */ … … 1073 1084 1074 1085 /** 1075 * Output the status of the topic 1086 * Output the status of the topic. 1076 1087 * 1077 1088 * @since 2.0.0 bbPress (r2667) 1078 1089 * 1079 * @param int $topic_id Optional. Topic id 1090 * @param int $topic_id Optional. Topic id. 1080 1091 */ 1081 1092 function bbp_topic_status( $topic_id = 0 ) { 1082 1093 echo bbp_get_topic_status( $topic_id ); 1083 1094 } 1084 /** 1085 * Return the status of the topic 1086 * 1087 * @since 2.0.0 bbPress (r2667) 1088 * 1089 * @param int $topic_id Optional. Topic id 1090 * @return string Status of topic 1091 */ 1092 function bbp_get_topic_status( $topic_id = 0 ) { 1093 $topic_id = bbp_get_topic_id( $topic_id ); 1094 1095 // Filter & return 1096 return apply_filters( 'bbp_get_topic_status', get_post_status( $topic_id ), $topic_id ); 1097 } 1095 1096 /** 1097 * Return the status of the topic. 1098 * 1099 * @since 2.0.0 bbPress (r2667) 1100 * 1101 * @param int $topic_id Optional. Topic id. 1102 * @return string Status of topic. 1103 */ 1104 function bbp_get_topic_status( $topic_id = 0 ) { 1105 $topic_id = bbp_get_topic_id( $topic_id ); 1106 1107 // Filter & return 1108 return apply_filters( 'bbp_get_topic_status', get_post_status( $topic_id ), $topic_id ); 1109 } 1098 1110 1099 1111 /** … … 1102 1114 * @since 2.0.0 bbPress (r2746) 1103 1115 * 1104 * @param int $topic_id Optional. Topic id 1116 * @param int $topic_id Optional. Topic id. 1105 1117 * 1106 1118 * @return bool True if closed, false if not. … … 1120 1132 * @since 2.0.0 bbPress (r2727) 1121 1133 * 1122 * @param int $topic_id Optional. Topic id 1134 * @param int $topic_id Optional. Topic id. 1123 1135 * 1124 1136 * @return bool True if open, false if closed. … … 1135 1147 * @since 2.6.0 bbPress (r6383) 1136 1148 * 1137 * @param int $topic_id Optional. Topic id 1149 * @param int $topic_id Optional. Topic id. 1138 1150 * @return bool True if public, false if not. 1139 1151 */ … … 1153 1165 * @since 2.0.0 bbPress (r3496) 1154 1166 * 1155 * @param int $topic_id Optional. Topic id 1167 * @param int $topic_id Optional. Topic id. 1156 1168 * @return bool True if published, false if not. 1157 1169 */ … … 1170 1182 * @since 2.0.0 bbPress (r2727) 1171 1183 * 1172 * @param int $topic_id Optional. Topic id 1184 * @param int $topic_id Optional. Topic id. 1173 1185 * @return bool True if spam, false if not. 1174 1186 */ … … 1187 1199 * @since 2.0.0 bbPress (r2888) 1188 1200 * 1189 * @param int $topic_id Optional. Topic id 1201 * @param int $topic_id Optional. Topic id. 1190 1202 * @return bool True if trashed, false if not. 1191 1203 */ … … 1204 1216 * @since 2.6.0 bbPress (r5504) 1205 1217 * 1206 * @param int $topic_id Optional. Topic id 1218 * @param int $topic_id Optional. Topic id. 1207 1219 * @return bool True if pending, false if not. 1208 1220 */ … … 1221 1233 * @since 2.6.0 bbPress (r5504) 1222 1234 * 1223 * @param int $topic_id Optional. Topic id 1235 * @param int $topic_id Optional. Topic id. 1224 1236 * @return bool True if private, false if not. 1225 1237 */ … … 1238 1250 * @since 2.0.0 bbPress (r2753) 1239 1251 * 1240 * @param int $topic_id Optional. Topic id 1252 * @param int $topic_id Optional. Topic id. 1241 1253 * @return bool True if the post is by an anonymous user, false if not. 1242 1254 */ … … 1268 1280 * @deprecated 2.5.0 bbPress (r5119) 1269 1281 * 1270 * @param int $topic_id Optional. Topic id 1282 * @param int $topic_id Optional. Topic id. 1271 1283 */ 1272 1284 function bbp_topic_author( $topic_id = 0 ) { 1273 1285 echo bbp_get_topic_author_display_name( $topic_id ); 1274 1286 } 1275 /** 1276 * Deprecated. Use bbp_get_topic_author_display_name() instead. 1277 * 1278 * Return the author of the topic 1279 * 1280 * @since 2.0.0 bbPress (r2590) 1281 * 1282 * @deprecated 2.5.0 bbPress (r5119) 1283 * 1284 * @param int $topic_id Optional. Topic id 1285 * @return string Author of topic 1286 */ 1287 function bbp_get_topic_author( $topic_id = 0 ) { 1288 $topic_id = bbp_get_topic_id( $topic_id ); 1289 1290 if ( ! bbp_is_topic_anonymous( $topic_id ) ) { 1291 $author = get_the_author_meta( 'display_name', bbp_get_topic_author_id( $topic_id ) ); 1292 } else { 1293 $author = get_post_meta( $topic_id, '_bbp_anonymous_name', true ); 1294 } 1295 1296 // Filter & return 1297 return apply_filters( 'bbp_get_topic_author', $author, $topic_id ); 1298 } 1299 1300 /** 1301 * Output the author ID of the topic 1287 1288 /** 1289 * Deprecated. Use bbp_get_topic_author_display_name() instead. 1290 * 1291 * Return the author of the topic. 1302 1292 * 1303 1293 * @since 2.0.0 bbPress (r2590) 1304 1294 * 1305 * @param int $topic_id Optional. Topic id 1295 * @deprecated 2.5.0 bbPress (r5119) 1296 * 1297 * @param int $topic_id Optional. Topic id. 1298 * @return string Author of topic. 1299 */ 1300 function bbp_get_topic_author( $topic_id = 0 ) { 1301 $topic_id = bbp_get_topic_id( $topic_id ); 1302 1303 if ( ! bbp_is_topic_anonymous( $topic_id ) ) { 1304 $author = get_the_author_meta( 'display_name', bbp_get_topic_author_id( $topic_id ) ); 1305 } else { 1306 $author = get_post_meta( $topic_id, '_bbp_anonymous_name', true ); 1307 } 1308 1309 // Filter & return 1310 return apply_filters( 'bbp_get_topic_author', $author, $topic_id ); 1311 } 1312 1313 /** 1314 * Output the author ID of the topic. 1315 * 1316 * @since 2.0.0 bbPress (r2590) 1317 * 1318 * @param int $topic_id Optional. Topic id. 1306 1319 */ 1307 1320 function bbp_topic_author_id( $topic_id = 0 ) { 1308 1321 echo bbp_get_topic_author_id( $topic_id ); 1309 1322 } 1310 /** 1311 * Return the author ID of the topic 1312 * 1313 * @since 2.0.0 bbPress (r2590) 1314 * 1315 * @param int $topic_id Optional. Topic id 1316 * @return string Author of topic 1317 */ 1318 function bbp_get_topic_author_id( $topic_id = 0 ) { 1319 $topic_id = bbp_get_topic_id( $topic_id ); 1320 $author_id = get_post_field( 'post_author', $topic_id ); 1321 1322 // Filter & return 1323 return (int) apply_filters( 'bbp_get_topic_author_id', (int) $author_id, $topic_id ); 1324 } 1325 1326 /** 1327 * Output the author display_name of the topic 1323 1324 /** 1325 * Return the author ID of the topic. 1328 1326 * 1329 1327 * @since 2.0.0 bbPress (r2590) 1330 1328 * 1331 * @param int $topic_id Optional. Topic id 1329 * @param int $topic_id Optional. Topic id. 1330 * @return string Author of topic. 1331 */ 1332 function bbp_get_topic_author_id( $topic_id = 0 ) { 1333 $topic_id = bbp_get_topic_id( $topic_id ); 1334 $author_id = get_post_field( 'post_author', $topic_id ); 1335 1336 // Filter & return 1337 return (int) apply_filters( 'bbp_get_topic_author_id', (int) $author_id, $topic_id ); 1338 } 1339 1340 /** 1341 * Output the author display_name of the topic. 1342 * 1343 * @since 2.0.0 bbPress (r2590) 1344 * 1345 * @param int $topic_id Optional. Topic id. 1332 1346 */ 1333 1347 function bbp_topic_author_display_name( $topic_id = 0 ) { 1334 1348 echo bbp_get_topic_author_display_name( $topic_id ); 1335 1349 } 1336 /** 1337 * Return the author display_name of the topic 1338 * 1339 * @since 2.0.0 bbPress (r2485) 1340 * 1341 * @param int $topic_id Optional. Topic id 1342 * @return string Topic's author's display name 1343 */ 1344 function bbp_get_topic_author_display_name( $topic_id = 0 ) { 1345 $topic_id = bbp_get_topic_id( $topic_id ); 1346 1347 // Check for anonymous user 1348 if ( ! bbp_is_topic_anonymous( $topic_id ) ) { 1349 1350 // Get the author ID 1351 $author_id = bbp_get_topic_author_id( $topic_id ); 1352 1353 // Try to get a display name 1354 $author_name = get_the_author_meta( 'display_name', $author_id ); 1355 1356 // Fall back to user login 1357 if ( empty( $author_name ) ) { 1358 $author_name = get_the_author_meta( 'user_login', $author_id ); 1359 } 1360 1361 // User does not have an account 1362 } else { 1363 $author_name = get_post_meta( $topic_id, '_bbp_anonymous_name', true ); 1350 1351 /** 1352 * Return the author display_name of the topic. 1353 * 1354 * @since 2.0.0 bbPress (r2485) 1355 * 1356 * @param int $topic_id Optional. Topic id. 1357 * @return string Topic's author's display name. 1358 */ 1359 function bbp_get_topic_author_display_name( $topic_id = 0 ) { 1360 $topic_id = bbp_get_topic_id( $topic_id ); 1361 1362 // Check for anonymous user 1363 if ( ! bbp_is_topic_anonymous( $topic_id ) ) { 1364 1365 // Get the author ID 1366 $author_id = bbp_get_topic_author_id( $topic_id ); 1367 1368 // Try to get a display name 1369 $author_name = get_the_author_meta( 'display_name', $author_id ); 1370 1371 // Fall back to user login 1372 if ( empty( $author_name ) ) { 1373 $author_name = get_the_author_meta( 'user_login', $author_id ); 1364 1374 } 1365 1375 1366 // Fallback if nothing could be found 1367 if ( empty( $author_name ) ) { 1368 $author_name = bbp_get_fallback_display_name( $topic_id ); 1369 } 1370 1371 // Filter & return 1372 return apply_filters( 'bbp_get_topic_author_display_name', $author_name, $topic_id ); 1373 } 1374 1375 /** 1376 * Output the author avatar of the topic 1376 // User does not have an account 1377 } else { 1378 $author_name = get_post_meta( $topic_id, '_bbp_anonymous_name', true ); 1379 } 1380 1381 // Fallback if nothing could be found 1382 if ( empty( $author_name ) ) { 1383 $author_name = bbp_get_fallback_display_name( $topic_id ); 1384 } 1385 1386 // Filter & return 1387 return apply_filters( 'bbp_get_topic_author_display_name', $author_name, $topic_id ); 1388 } 1389 1390 /** 1391 * Output the author avatar of the topic. 1377 1392 * 1378 1393 * @since 2.0.0 bbPress (r2590) 1379 1394 * 1380 * @param int $topic_id Optional. Topic id 1381 * @param int $size Optional. Avatar size. Defaults to 40 1395 * @param int $topic_id Optional. Topic id. 1396 * @param int $size Optional. Avatar size. Defaults to 40. 1382 1397 */ 1383 1398 function bbp_topic_author_avatar( $topic_id = 0, $size = 40 ) { 1384 1399 echo bbp_get_topic_author_avatar( $topic_id, $size ); 1385 1400 } 1386 /** 1387 * Return the author avatar of the topic 1388 * 1389 * @since 2.0.0 bbPress (r2590) 1390 * 1391 * @param int $topic_id Optional. Topic id 1392 * @param int $size Optional. Avatar size. Defaults to 40 1393 * @return string Avatar of the author of the topic 1394 */ 1395 function bbp_get_topic_author_avatar( $topic_id = 0, $size = 40 ) { 1396 $author_avatar = ''; 1397 1398 $topic_id = bbp_get_topic_id( $topic_id ); 1399 if ( ! empty( $topic_id ) ) {1400 if ( ! bbp_is_topic_anonymous( $topic_id ) ) {1401 $author_avatar = get_avatar( bbp_get_topic_author_id( $topic_id ), $size );1402 } else {1403 $author_avatar = get_avatar( get_post_meta( $topic_id, '_bbp_anonymous_email', true ), $size );1404 }1401 1402 /** 1403 * Return the author avatar of the topic. 1404 * 1405 * @since 2.0.0 bbPress (r2590) 1406 * 1407 * @param int $topic_id Optional. Topic id. 1408 * @param int $size Optional. Avatar size. Defaults to 40. 1409 * @return string Avatar of the author of the topic. 1410 */ 1411 function bbp_get_topic_author_avatar( $topic_id = 0, $size = 40 ) { 1412 $author_avatar = ''; 1413 1414 $topic_id = bbp_get_topic_id( $topic_id ); 1415 if ( ! empty( $topic_id ) ) { 1416 if ( ! bbp_is_topic_anonymous( $topic_id ) ) { 1417 $author_avatar = get_avatar( bbp_get_topic_author_id( $topic_id ), $size ); 1418 } else { 1419 $author_avatar = get_avatar( get_post_meta( $topic_id, '_bbp_anonymous_email', true ), $size ); 1405 1420 } 1406 1407 // Filter & return 1408 return apply_filters( 'bbp_get_topic_author_avatar', $author_avatar, $topic_id, $size ); 1409 } 1410 1411 /** 1412 * Output the author link of the topic 1421 } 1422 1423 // Filter & return 1424 return apply_filters( 'bbp_get_topic_author_avatar', $author_avatar, $topic_id, $size ); 1425 } 1426 1427 /** 1428 * Output the author link of the topic. 1413 1429 * 1414 1430 * @since 2.0.0 bbPress (r2717) … … 1419 1435 echo bbp_get_topic_author_link( $args ); 1420 1436 } 1421 /** 1422 * Return the author link of the topic 1423 * 1424 * @since 2.0.0 bbPress (r2717) 1425 * 1426 * @param mixed|int $args If it is an integer, it is used as topic id. 1427 * Optional. 1428 * @return string Author link of topic 1429 */ 1430 function bbp_get_topic_author_link( $args = array() ) { 1431 1432 // Parse arguments against default values 1433 $r = bbp_parse_args( 1434 $args, 1435 array( 1436 'post_id' => 0, 1437 'link_title' => '', 1438 'type' => 'both', 1439 'size' => 80, 1440 'sep' => '', 1441 'show_role' => false 1442 ), 1443 'get_topic_author_link' 1444 ); 1445 1446 // Default return value 1447 $author_link = ''; 1448 1449 // Used as topic_id 1450 $topic_id = is_numeric( $args ) 1451 ? bbp_get_topic_id( $args ) 1452 : bbp_get_topic_id( $r['post_id'] ); 1453 1454 // Topic ID is good 1455 if ( ! empty( $topic_id ) ) { 1456 1457 // Get some useful topic information 1458 $author_url = bbp_get_topic_author_url( $topic_id ); 1459 $anonymous = bbp_is_topic_anonymous( $topic_id ); 1460 1461 // Tweak link title if empty 1462 if ( empty( $r['link_title'] ) ) { 1463 $author = bbp_get_topic_author_display_name( $topic_id ); 1464 $title = empty( $anonymous ) 1465 /* translators: %s: Author's name */ 1466 ? esc_attr__( "View %s's profile", 'bbpress' ) 1467 /* translators: %s: Author's name */ 1468 : esc_attr__( "Visit %s's website", 'bbpress' ); 1469 1470 $link_title = sprintf( $title, $author ); 1471 1472 // Use what was passed if not 1473 } else { 1474 $link_title = $r['link_title']; 1475 } 1476 1477 // Setup title and author_links array 1478 $author_links = array(); 1479 $link_title = ! empty( $link_title ) 1480 ? ' title="' . esc_attr( $link_title ) . '"' 1481 : ''; 1482 1483 // Get avatar (unescaped, because HTML) 1484 if ( ( 'avatar' === $r['type'] ) || ( 'both' === $r['type'] ) ) { 1485 $author_links['avatar'] = bbp_get_topic_author_avatar( $topic_id, $r['size'] ); 1486 } 1487 1488 // Get display name (escaped, because never HTML) 1489 if ( ( 'name' === $r['type'] ) || ( 'both' === $r['type'] ) ) { 1490 $author_links['name'] = esc_html( bbp_get_topic_author_display_name( $topic_id ) ); 1491 } 1492 1493 // Empty array 1494 $links = array(); 1495 $sprint = '<span%1$s>%2$s</span>'; 1496 1497 // Wrap each link 1498 foreach ( $author_links as $link => $link_text ) { 1499 $link_class = ' class="bbp-author-' . esc_attr( $link ) . '"'; 1500 $links[] = sprintf( $sprint, $link_class, $link_text ); 1501 } 1502 1503 // Juggle 1504 $author_links = $links; 1505 unset( $links ); 1506 1507 // Filter sections 1508 $sections = apply_filters( 'bbp_get_topic_author_links', $author_links, $r, $args ); 1509 1510 // Assemble sections into author link 1511 $author_link = implode( $r['sep'], $sections ); 1512 1513 // Only wrap in link if profile exists 1514 if ( empty( $anonymous ) && bbp_user_has_profile( bbp_get_topic_author_id( $topic_id ) ) ) { 1515 $author_link = sprintf( '<a href="%1$s"%2$s%3$s>%4$s</a>', esc_url( $author_url ), $link_title, ' class="bbp-author-link"', $author_link ); 1516 } 1517 1518 // Role is not linked 1519 if ( true === $r['show_role'] ) { 1520 $author_link .= bbp_get_topic_author_role( array( 'topic_id' => $topic_id ) ); 1521 } 1437 1438 /** 1439 * Return the author link of the topic. 1440 * 1441 * @since 2.0.0 bbPress (r2717) 1442 * 1443 * @param mixed|int $args If it is an integer, it is used as topic id. 1444 * Optional. 1445 * @return string Author link of topic. 1446 */ 1447 function bbp_get_topic_author_link( $args = array() ) { 1448 1449 // Parse arguments against default values 1450 $r = bbp_parse_args( 1451 $args, 1452 array( 1453 'post_id' => 0, 1454 'link_title' => '', 1455 'type' => 'both', 1456 'size' => 80, 1457 'sep' => '', 1458 'show_role' => false 1459 ), 1460 'get_topic_author_link' 1461 ); 1462 1463 // Default return value 1464 $author_link = ''; 1465 1466 // Used as topic_id 1467 $topic_id = is_numeric( $args ) 1468 ? bbp_get_topic_id( $args ) 1469 : bbp_get_topic_id( $r['post_id'] ); 1470 1471 // Topic ID is good 1472 if ( ! empty( $topic_id ) ) { 1473 1474 // Get some useful topic information 1475 $author_url = bbp_get_topic_author_url( $topic_id ); 1476 $anonymous = bbp_is_topic_anonymous( $topic_id ); 1477 1478 // Tweak link title if empty 1479 if ( empty( $r['link_title'] ) ) { 1480 $author = bbp_get_topic_author_display_name( $topic_id ); 1481 $title = empty( $anonymous ) 1482 /* translators: %s: Author's name */ 1483 ? esc_attr__( "View %s's profile", 'bbpress' ) 1484 /* translators: %s: Author's name */ 1485 : esc_attr__( "Visit %s's website", 'bbpress' ); 1486 1487 $link_title = sprintf( $title, $author ); 1488 1489 // Use what was passed if not 1490 } else { 1491 $link_title = $r['link_title']; 1522 1492 } 1523 1493 1524 // Filter & return 1525 return apply_filters( 'bbp_get_topic_author_link', $author_link, $r, $args ); 1526 } 1527 1528 /** 1529 * Output the author url of the topic 1494 // Setup title and author_links array 1495 $author_links = array(); 1496 $link_title = ! empty( $link_title ) 1497 ? ' title="' . esc_attr( $link_title ) . '"' 1498 : ''; 1499 1500 // Get avatar (unescaped, because HTML) 1501 if ( ( 'avatar' === $r['type'] ) || ( 'both' === $r['type'] ) ) { 1502 $author_links['avatar'] = bbp_get_topic_author_avatar( $topic_id, $r['size'] ); 1503 } 1504 1505 // Get display name (escaped, because never HTML) 1506 if ( ( 'name' === $r['type'] ) || ( 'both' === $r['type'] ) ) { 1507 $author_links['name'] = esc_html( bbp_get_topic_author_display_name( $topic_id ) ); 1508 } 1509 1510 // Empty array 1511 $links = array(); 1512 $sprint = '<span%1$s>%2$s</span>'; 1513 1514 // Wrap each link 1515 foreach ( $author_links as $link => $link_text ) { 1516 $link_class = ' class="bbp-author-' . esc_attr( $link ) . '"'; 1517 $links[] = sprintf( $sprint, $link_class, $link_text ); 1518 } 1519 1520 // Juggle 1521 $author_links = $links; 1522 unset( $links ); 1523 1524 // Filter sections 1525 $sections = apply_filters( 'bbp_get_topic_author_links', $author_links, $r, $args ); 1526 1527 // Assemble sections into author link 1528 $author_link = implode( $r['sep'], $sections ); 1529 1530 // Only wrap in link if profile exists 1531 if ( empty( $anonymous ) && bbp_user_has_profile( bbp_get_topic_author_id( $topic_id ) ) ) { 1532 $author_link = sprintf( '<a href="%1$s"%2$s%3$s>%4$s</a>', esc_url( $author_url ), $link_title, ' class="bbp-author-link"', $author_link ); 1533 } 1534 1535 // Role is not linked 1536 if ( true === $r['show_role'] ) { 1537 $author_link .= bbp_get_topic_author_role( array( 'topic_id' => $topic_id ) ); 1538 } 1539 } 1540 1541 // Filter & return 1542 return apply_filters( 'bbp_get_topic_author_link', $author_link, $r, $args ); 1543 } 1544 1545 /** 1546 * Output the author url of the topic. 1530 1547 * 1531 1548 * @since 2.0.0 bbPress (r2590) 1532 1549 * 1533 * @param int $topic_id Optional. Topic id 1550 * @param int $topic_id Optional. Topic id. 1534 1551 */ 1535 1552 function bbp_topic_author_url( $topic_id = 0 ) { … … 1537 1554 } 1538 1555 1539 /** 1540 * Return the author url of the topic 1541 * 1542 * @since 2.0.0 bbPress (r2590) 1543 * 1544 * @param int $topic_id Optional. Topic id 1545 * @return string Author URL of topic 1546 */ 1547 function bbp_get_topic_author_url( $topic_id = 0 ) { 1548 $topic_id = bbp_get_topic_id( $topic_id ); 1549 1550 // Check for anonymous user or non-existant user 1551 if ( ! bbp_is_topic_anonymous( $topic_id ) && bbp_user_has_profile( bbp_get_topic_author_id( $topic_id ) ) ) { 1552 $author_url = bbp_get_user_profile_url( bbp_get_topic_author_id( $topic_id ) ); 1553 } else { 1554 $author_url = get_post_meta( $topic_id, '_bbp_anonymous_website', true ); 1555 1556 // Set empty author_url as empty string 1557 if ( empty( $author_url ) ) { 1558 $author_url = ''; 1559 } 1556 /** 1557 * Return the author url of the topic. 1558 * 1559 * @since 2.0.0 bbPress (r2590) 1560 * 1561 * @param int $topic_id Optional. Topic id. 1562 * @return string Author URL of topic. 1563 */ 1564 function bbp_get_topic_author_url( $topic_id = 0 ) { 1565 $topic_id = bbp_get_topic_id( $topic_id ); 1566 1567 // Check for anonymous user or non-existant user 1568 if ( ! bbp_is_topic_anonymous( $topic_id ) && bbp_user_has_profile( bbp_get_topic_author_id( $topic_id ) ) ) { 1569 $author_url = bbp_get_user_profile_url( bbp_get_topic_author_id( $topic_id ) ); 1570 } else { 1571 $author_url = get_post_meta( $topic_id, '_bbp_anonymous_website', true ); 1572 1573 // Set empty author_url as empty string 1574 if ( empty( $author_url ) ) { 1575 $author_url = ''; 1560 1576 } 1561 1562 // Filter & return 1563 return apply_filters( 'bbp_get_topic_author_url', $author_url, $topic_id ); 1564 } 1565 1566 /** 1567 * Output the topic author email address 1577 } 1578 1579 // Filter & return 1580 return apply_filters( 'bbp_get_topic_author_url', $author_url, $topic_id ); 1581 } 1582 1583 /** 1584 * Output the topic author email address. 1568 1585 * 1569 1586 * @since 2.0.0 bbPress (r3445) 1570 1587 * 1571 * @param int $topic_id Optional. Reply id 1588 * @param int $topic_id Optional. Reply id. 1572 1589 */ 1573 1590 function bbp_topic_author_email( $topic_id = 0 ) { 1574 1591 echo bbp_get_topic_author_email( $topic_id ); 1575 1592 } 1576 /** 1577 * Return the topic author email address 1578 * 1579 * @since 2.0.0 bbPress (r3445) 1580 * 1581 * @param int $topic_id Optional. Reply id 1582 * @return string Topic author email address 1583 */ 1584 function bbp_get_topic_author_email( $topic_id = 0 ) { 1585 $topic_id = bbp_get_topic_id( $topic_id ); 1586 1587 // Not anonymous user 1588 if ( ! bbp_is_topic_anonymous( $topic_id ) ) {1589 1590 // Use topic author email address 1591 $user_id = bbp_get_topic_author_id( $topic_id );1592 $user = get_userdata( $user_id );1593 $author_email = ! empty( $user->user_email ) ? $user->user_email : '';1594 1595 // Anonymous 1596 } else {1597 1598 // Get email from post meta 1599 $author_email = get_post_meta( $topic_id, '_bbp_anonymous_email', true );1600 1601 // Sanity check for missing email address 1602 if ( empty( $author_email ) ) {1603 $author_email = '';1604 }1593 1594 /** 1595 * Return the topic author email address. 1596 * 1597 * @since 2.0.0 bbPress (r3445) 1598 * 1599 * @param int $topic_id Optional. Reply id. 1600 * @return string Topic author email address. 1601 */ 1602 function bbp_get_topic_author_email( $topic_id = 0 ) { 1603 $topic_id = bbp_get_topic_id( $topic_id ); 1604 1605 // Not anonymous user 1606 if ( ! bbp_is_topic_anonymous( $topic_id ) ) { 1607 1608 // Use topic author email address 1609 $user_id = bbp_get_topic_author_id( $topic_id ); 1610 $user = get_userdata( $user_id ); 1611 $author_email = ! empty( $user->user_email ) ? $user->user_email : ''; 1612 1613 // Anonymous 1614 } else { 1615 1616 // Get email from post meta 1617 $author_email = get_post_meta( $topic_id, '_bbp_anonymous_email', true ); 1618 1619 // Sanity check for missing email address 1620 if ( empty( $author_email ) ) { 1621 $author_email = ''; 1605 1622 } 1606 1607 // Filter & return 1608 return apply_filters( 'bbp_get_topic_author_email', $author_email, $topic_id ); 1609 } 1610 1611 /** 1612 * Output the topic author role 1623 } 1624 1625 // Filter & return 1626 return apply_filters( 'bbp_get_topic_author_email', $author_email, $topic_id ); 1627 } 1628 1629 /** 1630 * Output the topic author role. 1613 1631 * 1614 1632 * @since 2.1.0 bbPress (r3860) … … 1619 1637 echo bbp_get_topic_author_role( $args ); 1620 1638 } 1621 /** 1622 * Return the topic author role 1623 * 1624 * @since 2.1.0 bbPress (r3860) 1625 * 1626 * @param array $args Optional. 1627 * @return string topic author role 1628 */ 1629 function bbp_get_topic_author_role( $args = array() ) { 1630 1631 // Parse arguments against default values 1632 $r = bbp_parse_args(1633 $args,1634 array(1635 'topic_id' => 0,1636 'class' => false,1637 'before' => '<div class="bbp-author-role">',1638 'after' => '</div>'1639 ),1640 'get_topic_author_role'1641 );1642 1643 $topic_id = bbp_get_topic_id( $r['topic_id'] ); 1644 $role = bbp_get_user_display_role( bbp_get_topic_author_id( $topic_id ));1645 $css_role = sanitize_key( $role);1646 1647 // Add role as CSS class to default 'before' value. 1648 if ( empty( $args['before'] ) ) {1649 $r['before'] = '<div class="bbp-author-role bbp-role-' . esc_attr( $css_role ) . '">';1650 }1651 1652 // Backwards compatibilty with old 'class' argument 1653 if ( ! empty( $r['class'] ) ) {1654 $author_role = sprintf( '%1$s<div class="%2$s">%3$s</div>%4$s', $r['before'], $r['class'], $role, $r['after'] );1655 1656 // Simpler before & after arguments 1657 // https://bbpress.trac.wordpress.org/ticket/25571658 } else {1659 $author_role = $r['before'] . $role . $r['after'];1660 }1661 1662 // Filter & return 1663 return apply_filters( 'bbp_get_topic_author_role', $author_role, $r );1664 }1665 1666 1667 /** 1668 * Output the title of the forum a topic belongs to 1639 1640 /** 1641 * Return the topic author role. 1642 * 1643 * @since 2.1.0 bbPress (r3860) 1644 * 1645 * @param array $args Optional. 1646 * @return string topic author role. 1647 */ 1648 function bbp_get_topic_author_role( $args = array() ) { 1649 1650 // Parse arguments against default values 1651 $r = bbp_parse_args( 1652 $args, 1653 array( 1654 'topic_id' => 0, 1655 'class' => false, 1656 'before' => '<div class="bbp-author-role">', 1657 'after' => '</div>' 1658 ), 1659 'get_topic_author_role' 1660 ); 1661 1662 $topic_id = bbp_get_topic_id( $r['topic_id'] ); 1663 $role = bbp_get_user_display_role( bbp_get_topic_author_id( $topic_id ) ); 1664 $css_role = sanitize_key( $role ); 1665 1666 // Add role as CSS class to default 'before' value. 1667 if ( empty( $args['before'] ) ) { 1668 $r['before'] = '<div class="bbp-author-role bbp-role-' . esc_attr( $css_role ) . '">'; 1669 } 1670 1671 // Backwards compatibilty with old 'class' argument 1672 if ( ! empty( $r['class'] ) ) { 1673 $author_role = sprintf( '%1$s<div class="%2$s">%3$s</div>%4$s', $r['before'], $r['class'], $role, $r['after'] ); 1674 1675 // Simpler before & after arguments 1676 // https://bbpress.trac.wordpress.org/ticket/2557 1677 } else { 1678 $author_role = $r['before'] . $role . $r['after']; 1679 } 1680 1681 // Filter & return 1682 return apply_filters( 'bbp_get_topic_author_role', $author_role, $r ); 1683 } 1684 1685 /** 1686 * Output the title of the forum a topic belongs to. 1669 1687 * 1670 1688 * @since 2.0.0 bbPress (r2485) 1671 1689 * 1672 * @param int $topic_id Optional. Topic id 1690 * @param int $topic_id Optional. Topic id. 1673 1691 */ 1674 1692 function bbp_topic_forum_title( $topic_id = 0 ) { 1675 1693 echo bbp_get_topic_forum_title( $topic_id ); 1676 1694 } 1677 /** 1678 * Return the title of the forum a topic belongs to 1679 * 1680 * @since 2.0.0 bbPress (r2485) 1681 * 1682 * @param int $topic_id Optional. Topic id 1683 * @return string Topic forum title 1684 */ 1685 function bbp_get_topic_forum_title( $topic_id = 0 ) { 1686 $topic_id = bbp_get_topic_id( $topic_id ); 1687 $forum_id = bbp_get_topic_forum_id( $topic_id ); 1688 1689 // Filter & return 1690 return apply_filters( 'bbp_get_topic_forum', bbp_get_forum_title( $forum_id ), $topic_id, $forum_id ); 1691 } 1692 1693 /** 1694 * Output the forum id a topic belongs to 1695 1696 /** 1697 * Return the title of the forum a topic belongs to. 1698 * 1699 * @since 2.0.0 bbPress (r2485) 1700 * 1701 * @param int $topic_id Optional. Topic id. 1702 * @return string Topic forum title. 1703 */ 1704 function bbp_get_topic_forum_title( $topic_id = 0 ) { 1705 $topic_id = bbp_get_topic_id( $topic_id ); 1706 $forum_id = bbp_get_topic_forum_id( $topic_id ); 1707 1708 // Filter & return 1709 return apply_filters( 'bbp_get_topic_forum', bbp_get_forum_title( $forum_id ), $topic_id, $forum_id ); 1710 } 1711 1712 /** 1713 * Output the forum id a topic belongs to. 1695 1714 * 1696 1715 * @since 2.0.0 bbPress (r2491) 1697 1716 * 1698 * @param int $topic_id Optional. Topic id 1717 * @param int $topic_id Optional. Topic id. 1699 1718 */ 1700 1719 function bbp_topic_forum_id( $topic_id = 0 ) { 1701 1720 echo bbp_get_topic_forum_id( $topic_id ); 1702 1721 } 1703 /** 1704 * Return the forum id a topic belongs to 1705 * 1706 * @since 2.0.0 bbPress (r2491) 1707 * 1708 * @param int $topic_id Optional. Topic id 1709 * @return int Topic forum id 1710 */ 1711 function bbp_get_topic_forum_id( $topic_id = 0 ) { 1712 $topic_id = bbp_get_topic_id( $topic_id ); 1713 $forum_id = (int) get_post_field( 'post_parent', $topic_id ); 1714 1715 // Meta-data fallback 1716 if ( empty( $forum_id ) ) { 1717 $forum_id = (int) get_post_meta( $topic_id, '_bbp_forum_id', true ); 1718 } 1719 1720 // Filter 1721 if ( ! empty( $forum_id ) ) { 1722 $forum_id = (int) bbp_get_forum_id( $forum_id ); 1723 } 1724 1725 // Filter & return 1726 return (int) apply_filters( 'bbp_get_topic_forum_id', $forum_id, $topic_id ); 1727 } 1728 1729 /** 1730 * Output the topics last active ID 1722 1723 /** 1724 * Return the forum id a topic belongs to. 1725 * 1726 * @since 2.0.0 bbPress (r2491) 1727 * 1728 * @param int $topic_id Optional. Topic id. 1729 * @return int Topic forum id. 1730 */ 1731 function bbp_get_topic_forum_id( $topic_id = 0 ) { 1732 $topic_id = bbp_get_topic_id( $topic_id ); 1733 $forum_id = (int) get_post_field( 'post_parent', $topic_id ); 1734 1735 // Meta-data fallback 1736 if ( empty( $forum_id ) ) { 1737 $forum_id = (int) get_post_meta( $topic_id, '_bbp_forum_id', true ); 1738 } 1739 1740 // Filter 1741 if ( ! empty( $forum_id ) ) { 1742 $forum_id = (int) bbp_get_forum_id( $forum_id ); 1743 } 1744 1745 // Filter & return 1746 return (int) apply_filters( 'bbp_get_topic_forum_id', $forum_id, $topic_id ); 1747 } 1748 1749 /** 1750 * Output the topics last active ID. 1731 1751 * 1732 1752 * @since 2.0.0 bbPress (r2860) 1733 1753 * 1734 * @param int $topic_id Optional. Forum id 1754 * @param int $topic_id Optional. Forum id. 1735 1755 */ 1736 1756 function bbp_topic_last_active_id( $topic_id = 0 ) { 1737 1757 echo bbp_get_topic_last_active_id( $topic_id ); 1738 1758 } 1739 /** 1740 * Return the topics last active ID 1741 * 1742 * @since 2.0.0 bbPress (r2860) 1743 * 1744 * @param int $topic_id Optional. Forum id 1745 * @return int Forum's last active id 1746 */ 1747 function bbp_get_topic_last_active_id( $topic_id = 0 ) { 1748 $topic_id = bbp_get_topic_id( $topic_id ); 1749 $active_id = (int) get_post_meta( $topic_id, '_bbp_last_active_id', true ); 1750 1751 // Filter & return 1752 return (int) apply_filters( 'bbp_get_topic_last_active_id', $active_id, $topic_id ); 1753 } 1754 1755 /** 1756 * Output the topics last update date/time (aka freshness) 1759 1760 /** 1761 * Return the topics last active ID. 1762 * 1763 * @since 2.0.0 bbPress (r2860) 1764 * 1765 * @param int $topic_id Optional. Forum id. 1766 * @return int Forum's last active id. 1767 */ 1768 function bbp_get_topic_last_active_id( $topic_id = 0 ) { 1769 $topic_id = bbp_get_topic_id( $topic_id ); 1770 $active_id = (int) get_post_meta( $topic_id, '_bbp_last_active_id', true ); 1771 1772 // Filter & return 1773 return (int) apply_filters( 'bbp_get_topic_last_active_id', $active_id, $topic_id ); 1774 } 1775 1776 /** 1777 * Output the topics last update date/time (aka freshness). 1757 1778 * 1758 1779 * @since 2.0.0 bbPress (r2625) 1759 1780 * 1760 * @param int $topic_id Optional. Topic id 1781 * @param int $topic_id Optional. Topic id. 1761 1782 */ 1762 1783 function bbp_topic_last_active_time( $topic_id = 0 ) { 1763 1784 echo bbp_get_topic_last_active_time( $topic_id ); 1764 1785 } 1765 /** 1766 * Return the topics last update date/time (aka freshness) 1767 * 1768 * @since 2.0.0 bbPress (r2625) 1769 * 1770 * @param int $topic_id Optional. Topic id 1771 * @return string Topic freshness 1772 */ 1773 function bbp_get_topic_last_active_time( $topic_id = 0 ) { 1774 $topic_id = bbp_get_topic_id( $topic_id ); 1775 1776 // Try to get the most accurate freshness time possible 1777 $last_active = get_post_meta( $topic_id, '_bbp_last_active_time', true );1778 if ( empty( $last_active ) ) {1779 $reply_id = bbp_get_topic_last_reply_id( $topic_id );1780 if ( ! empty( $reply_id ) ) {1781 $last_active = get_post_field( 'post_date', $reply_id );1782 } else {1783 $last_active = get_post_field( 'post_date', $topic_id );1784 }1786 1787 /** 1788 * Return the topics last update date/time (aka freshness). 1789 * 1790 * @since 2.0.0 bbPress (r2625) 1791 * 1792 * @param int $topic_id Optional. Topic id. 1793 * @return string Topic freshness. 1794 */ 1795 function bbp_get_topic_last_active_time( $topic_id = 0 ) { 1796 $topic_id = bbp_get_topic_id( $topic_id ); 1797 1798 // Try to get the most accurate freshness time possible 1799 $last_active = get_post_meta( $topic_id, '_bbp_last_active_time', true ); 1800 if ( empty( $last_active ) ) { 1801 $reply_id = bbp_get_topic_last_reply_id( $topic_id ); 1802 if ( ! empty( $reply_id ) ) { 1803 $last_active = get_post_field( 'post_date', $reply_id ); 1804 } else { 1805 $last_active = get_post_field( 'post_date', $topic_id ); 1785 1806 } 1786 1787 $last_active = ! empty( $last_active ) ? bbp_get_time_since( bbp_convert_date( $last_active ) ) : ''; 1788 1789 // Filter & return 1790 return apply_filters( 'bbp_get_topic_last_active', $last_active, $topic_id ); 1791 } 1807 } 1808 1809 $last_active = ! empty( $last_active ) ? bbp_get_time_since( bbp_convert_date( $last_active ) ) : ''; 1810 1811 // Filter & return 1812 return apply_filters( 'bbp_get_topic_last_active', $last_active, $topic_id ); 1813 } 1792 1814 1793 1815 /** Topic Subscriptions *******************************************************/ 1794 1816 1795 1817 /** 1796 * Output the topic subscription link 1818 * Output the topic subscription link. 1797 1819 * 1798 1820 * @since 2.5.0 bbPress (r5156) … … 1803 1825 } 1804 1826 1805 /** 1806 * Get the topic subscription link 1807 * 1808 * A custom wrapper for bbp_get_user_subscribe_link() 1809 * 1810 * @since 2.5.0 bbPress (r5156) 1811 * @since 2.6.0 bbPress (r6308) Add 'redirect_to' support 1812 */ 1813 function bbp_get_topic_subscription_link( $args = array() ) { 1814 1815 // Defaults 1816 $retval = false; 1817 $user_id = bbp_get_current_user_id(); 1818 $redirect_to = bbp_is_subscriptions() 1819 ? bbp_get_subscriptions_permalink( $user_id ) 1820 : ''; 1821 1822 // Parse the arguments 1823 $r = bbp_parse_args( 1824 $args, 1825 array( 1826 'user_id' => $user_id, 1827 'object_id' => bbp_get_topic_id(), 1828 'object_type' => 'post', 1829 'before' => ' | ', 1830 'after' => '', 1831 'subscribe' => esc_html__( 'Subscribe', 'bbpress' ), 1832 'unsubscribe' => esc_html__( 'Unsubscribe', 'bbpress' ), 1833 'redirect_to' => $redirect_to 1834 ), 1835 'get_topic_subscribe_link' 1836 ); 1837 1838 // Get the link 1839 $retval = bbp_get_user_subscribe_link( $r ); 1840 1841 // Filter & return 1842 return apply_filters( 'bbp_get_topic_subscribe_link', $retval, $r, $args ); 1843 } 1844 1845 /** Topic Favorites ***********************************************************/ 1846 1847 /** 1848 * Output the topic favorite link 1827 /** 1828 * Get the topic subscription link. 1829 * 1830 * A custom wrapper for bbp_get_user_subscribe_link() 1849 1831 * 1850 1832 * @since 2.5.0 bbPress (r5156) 1851 1833 * @since 2.6.0 bbPress (r6308) Add 'redirect_to' support 1852 1834 */ 1835 function bbp_get_topic_subscription_link( $args = array() ) { 1836 1837 // Defaults 1838 $retval = false; 1839 $user_id = bbp_get_current_user_id(); 1840 $redirect_to = bbp_is_subscriptions() 1841 ? bbp_get_subscriptions_permalink( $user_id ) 1842 : ''; 1843 1844 // Parse the arguments 1845 $r = bbp_parse_args( 1846 $args, 1847 array( 1848 'user_id' => $user_id, 1849 'object_id' => bbp_get_topic_id(), 1850 'object_type' => 'post', 1851 'before' => ' | ', 1852 'after' => '', 1853 'subscribe' => esc_html__( 'Subscribe', 'bbpress' ), 1854 'unsubscribe' => esc_html__( 'Unsubscribe', 'bbpress' ), 1855 'redirect_to' => $redirect_to 1856 ), 1857 'get_topic_subscribe_link' 1858 ); 1859 1860 // Get the link 1861 $retval = bbp_get_user_subscribe_link( $r ); 1862 1863 // Filter & return 1864 return apply_filters( 'bbp_get_topic_subscribe_link', $retval, $r, $args ); 1865 } 1866 1867 /** Topic Favorites ***********************************************************/ 1868 1869 /** 1870 * Output the topic favorite link. 1871 * 1872 * @since 2.5.0 bbPress (r5156) 1873 * @since 2.6.0 bbPress (r6308) Add 'redirect_to' support 1874 */ 1853 1875 function bbp_topic_favorite_link( $args = array() ) { 1854 1876 echo bbp_get_topic_favorite_link( $args ); 1855 1877 } 1856 1878 1857 /**1858 * Get the forum favorite link 1859 *1860 * A custom wrapper for bbp_get_user_favorites_link() 1861 *1862 * @since 2.5.0 bbPress (r5156)1863 * @since 2.6.0 bbPress (r6308) Add 'redirect_to' support1864 */1865 function bbp_get_topic_favorite_link( $args = array() ) {1866 1867 // No link1868 $retval = false;1869 $user_id = bbp_get_current_user_id();1870 $redirect_to = bbp_is_favorites()1871 ? bbp_get_favorites_permalink( $user_id )1872 : '';1873 1874 // Parse the arguments1875 $r = bbp_parse_args(1876 $args,1877 array(1878 'user_id' => $user_id,1879 'object_id' => bbp_get_topic_id(),1880 'object_type' => 'post',1881 'before' => '',1882 'after' => '',1883 'favorite' => esc_html__( 'Favorite', 'bbpress' ),1884 'favorited' => esc_html__( 'Unfavorite', 'bbpress' ),1885 'redirect_to' => $redirect_to1886 ),1887 'get_topic_favorite_link'1888 );1889 1890 // Get the link1891 $retval = bbp_get_user_favorites_link( $r );1892 1893 // Filter & return1894 return apply_filters( 'bbp_get_topic_favorite_link', $retval, $r, $args );1895 }1879 /** 1880 * Get the forum favorite link. 1881 * 1882 * A custom wrapper for bbp_get_user_favorites_link(). 1883 * 1884 * @since 2.5.0 bbPress (r5156) 1885 * @since 2.6.0 bbPress (r6308) Add 'redirect_to' support 1886 */ 1887 function bbp_get_topic_favorite_link( $args = array() ) { 1888 1889 // No link 1890 $retval = false; 1891 $user_id = bbp_get_current_user_id(); 1892 $redirect_to = bbp_is_favorites() 1893 ? bbp_get_favorites_permalink( $user_id ) 1894 : ''; 1895 1896 // Parse the arguments 1897 $r = bbp_parse_args( 1898 $args, 1899 array( 1900 'user_id' => $user_id, 1901 'object_id' => bbp_get_topic_id(), 1902 'object_type' => 'post', 1903 'before' => '', 1904 'after' => '', 1905 'favorite' => esc_html__( 'Favorite', 'bbpress' ), 1906 'favorited' => esc_html__( 'Unfavorite', 'bbpress' ), 1907 'redirect_to' => $redirect_to 1908 ), 1909 'get_topic_favorite_link' 1910 ); 1911 1912 // Get the link 1913 $retval = bbp_get_user_favorites_link( $r ); 1914 1915 // Filter & return 1916 return apply_filters( 'bbp_get_topic_favorite_link', $retval, $r, $args ); 1917 } 1896 1918 1897 1919 /** Topic Last Reply **********************************************************/ 1898 1920 1899 1921 /** 1900 * Output the id of the topics last reply 1922 * Output the id of the topics last reply. 1901 1923 * 1902 1924 * @since 2.0.0 bbPress (r2625) 1903 1925 * 1904 * @param int $topic_id Optional. Topic id 1926 * @param int $topic_id Optional. Topic id. 1905 1927 */ 1906 1928 function bbp_topic_last_reply_id( $topic_id = 0 ) { 1907 1929 echo bbp_get_topic_last_reply_id( $topic_id ); 1908 1930 } 1909 /** 1910 * Return the id of the topics last reply 1911 * 1912 * @since 2.0.0 bbPress (r2625) 1913 * 1914 * @param int $topic_id Optional. Topic id 1915 * @return int Topic last reply id 1916 */ 1917 function bbp_get_topic_last_reply_id( $topic_id = 0 ) { 1918 $topic_id = bbp_get_topic_id( $topic_id ); 1919 $reply_id = (int) get_post_meta( $topic_id, '_bbp_last_reply_id', true ); 1920 1921 // Filter & return 1922 return (int) apply_filters( 'bbp_get_topic_last_reply_id', $reply_id, $topic_id ); 1923 } 1924 1925 /** 1926 * Output the title of the last reply inside a topic 1931 1932 /** 1933 * Return the id of the topics last reply. 1934 * 1935 * @since 2.0.0 bbPress (r2625) 1936 * 1937 * @param int $topic_id Optional. Topic id. 1938 * @return int Topic last reply id. 1939 */ 1940 function bbp_get_topic_last_reply_id( $topic_id = 0 ) { 1941 $topic_id = bbp_get_topic_id( $topic_id ); 1942 $reply_id = (int) get_post_meta( $topic_id, '_bbp_last_reply_id', true ); 1943 1944 // Filter & return 1945 return (int) apply_filters( 'bbp_get_topic_last_reply_id', $reply_id, $topic_id ); 1946 } 1947 1948 /** 1949 * Output the title of the last reply inside a topic. 1927 1950 * 1928 1951 * @since 2.0.0 bbPress (r2753) 1929 1952 * 1930 * @param int $topic_id Optional. Topic id 1953 * @param int $topic_id Optional. Topic id. 1931 1954 */ 1932 1955 function bbp_topic_last_reply_title( $topic_id = 0 ) { 1933 1956 echo bbp_get_topic_last_reply_title( $topic_id ); 1934 1957 } 1935 /** 1936 * Return the title of the last reply inside a topic 1937 * 1938 * @since 2.0.0 bbPress (r2753) 1939 * @since 2.6.0 bbPress https://bbpress.trac.wordpress.org/ticket/3039 1940 * 1941 * @param int $topic_id Optional. Topic id 1942 * @return string Topic last reply title 1943 */ 1944 function bbp_get_topic_last_reply_title( $topic_id = 0 ) { 1945 $topic_id = bbp_get_topic_id( $topic_id ); 1946 $reply_id = bbp_get_topic_last_reply_id( $topic_id ); 1947 $retval = bbp_get_reply_title( $reply_id ); 1948 1949 // Misspelled. Use 'bbp_get_topic_last_reply_title' hook instead. 1950 $retval = apply_filters( 'bbp_get_topic_last_topic_title', $retval, $topic_id, $reply_id ); 1951 1952 // Filter & return 1953 return apply_filters( 'bbp_get_topic_last_reply_title', $retval, $topic_id, $reply_id ); 1954 } 1955 1956 /** 1957 * Output the link to the last reply in a topic 1958 1959 /** 1960 * Return the title of the last reply inside a topic. 1961 * 1962 * @since 2.0.0 bbPress (r2753) 1963 * @since 2.6.0 bbPress https://bbpress.trac.wordpress.org/ticket/3039 1964 * 1965 * @param int $topic_id Optional. Topic id. 1966 * @return string Topic last reply title. 1967 */ 1968 function bbp_get_topic_last_reply_title( $topic_id = 0 ) { 1969 $topic_id = bbp_get_topic_id( $topic_id ); 1970 $reply_id = bbp_get_topic_last_reply_id( $topic_id ); 1971 $retval = bbp_get_reply_title( $reply_id ); 1972 1973 // Misspelled. Use 'bbp_get_topic_last_reply_title' hook instead. 1974 $retval = apply_filters( 'bbp_get_topic_last_topic_title', $retval, $topic_id, $reply_id ); 1975 1976 // Filter & return 1977 return apply_filters( 'bbp_get_topic_last_reply_title', $retval, $topic_id, $reply_id ); 1978 } 1979 1980 /** 1981 * Output the link to the last reply in a topic. 1958 1982 * 1959 1983 * @since 2.0.0 bbPress (r2464) 1960 1984 * 1961 * @param int $topic_id Optional. Topic id 1985 * @param int $topic_id Optional. Topic id. 1962 1986 */ 1963 1987 function bbp_topic_last_reply_permalink( $topic_id = 0 ) { 1964 1988 echo esc_url( bbp_get_topic_last_reply_permalink( $topic_id ) ); 1965 1989 } 1966 /** 1967 * Return the link to the last reply in a topic 1968 * 1969 * @since 2.0.0 bbPress (r2464) 1970 * 1971 * @param int $topic_id Optional. Topic id 1972 * @return string Permanent link to the reply 1973 */ 1974 function bbp_get_topic_last_reply_permalink( $topic_id = 0 ) { 1975 $topic_id = bbp_get_topic_id( $topic_id ); 1976 $reply_id = bbp_get_topic_last_reply_id( $topic_id ); 1977 $retval = bbp_get_reply_permalink( $reply_id ); 1978 1979 // Filter & return 1980 return apply_filters( 'bbp_get_topic_last_reply_permalink', $retval, $topic_id, $reply_id ); 1981 } 1982 1983 /** 1984 * Output the link to the last reply in a topic 1990 1991 /** 1992 * Return the link to the last reply in a topic. 1993 * 1994 * @since 2.0.0 bbPress (r2464) 1995 * 1996 * @param int $topic_id Optional. Topic id. 1997 * @return string Permanent link to the reply. 1998 */ 1999 function bbp_get_topic_last_reply_permalink( $topic_id = 0 ) { 2000 $topic_id = bbp_get_topic_id( $topic_id ); 2001 $reply_id = bbp_get_topic_last_reply_id( $topic_id ); 2002 $retval = bbp_get_reply_permalink( $reply_id ); 2003 2004 // Filter & return 2005 return apply_filters( 'bbp_get_topic_last_reply_permalink', $retval, $topic_id, $reply_id ); 2006 } 2007 2008 /** 2009 * Output the link to the last reply in a topic. 1985 2010 * 1986 2011 * @since 2.0.0 bbPress (r2683) 1987 2012 * 1988 * @param int $topic_id Optional. Topic id 2013 * @param int $topic_id Optional. Topic id. 1989 2014 */ 1990 2015 function bbp_topic_last_reply_url( $topic_id = 0 ) { 1991 2016 echo esc_url( bbp_get_topic_last_reply_url( $topic_id ) ); 1992 2017 } 1993 /** 1994 * Return the link to the last reply in a topic 1995 * 1996 * @since 2.0.0 bbPress (r2683) 1997 * 1998 * @param int $topic_id Optional. Topic id 1999 * @return string Topic last reply url 2000 */ 2001 function bbp_get_topic_last_reply_url( $topic_id = 0 ) { 2002 $topic_id = bbp_get_topic_id( $topic_id ); 2003 $reply_id = bbp_get_topic_last_reply_id( $topic_id ); 2004 2005 if ( ! empty( $reply_id ) && ( $reply_id !== $topic_id ) ) { 2006 $reply_url = bbp_get_reply_url( $reply_id ); 2007 } else { 2008 $reply_url = bbp_get_topic_permalink( $topic_id ); 2009 } 2010 2011 // Filter & return 2012 return apply_filters( 'bbp_get_topic_last_reply_url', $reply_url, $topic_id, $reply_id ); 2013 } 2018 2019 /** 2020 * Return the link to the last reply in a topic. 2021 * 2022 * @since 2.0.0 bbPress (r2683) 2023 * 2024 * @param int $topic_id Optional. Topic id. 2025 * @return string Topic last reply url. 2026 */ 2027 function bbp_get_topic_last_reply_url( $topic_id = 0 ) { 2028 $topic_id = bbp_get_topic_id( $topic_id ); 2029 $reply_id = bbp_get_topic_last_reply_id( $topic_id ); 2030 2031 if ( ! empty( $reply_id ) && ( $reply_id !== $topic_id ) ) { 2032 $reply_url = bbp_get_reply_url( $reply_id ); 2033 } else { 2034 $reply_url = bbp_get_topic_permalink( $topic_id ); 2035 } 2036 2037 // Filter & return 2038 return apply_filters( 'bbp_get_topic_last_reply_url', $reply_url, $topic_id, $reply_id ); 2039 } 2014 2040 2015 2041 /** … … 2019 2045 * @since 2.0.0 bbPress (r2625) 2020 2046 * 2021 * @param int $topic_id Optional. Topic id 2047 * @param int $topic_id Optional. Topic id. 2022 2048 */ 2023 2049 function bbp_topic_freshness_link( $topic_id = 0 ) { 2024 2050 echo bbp_get_topic_freshness_link( $topic_id ); 2025 2051 } 2026 /** 2027 * Returns link to the most recent activity inside a topic, complete 2028 * with link attributes and content. 2029 * 2030 * @since 2.0.0 bbPress (r2625) 2031 * 2032 * @param int $topic_id Optional. Topic id 2033 * @return string Topic freshness link 2034 */ 2035 function bbp_get_topic_freshness_link( $topic_id = 0 ) { 2036 $topic_id = bbp_get_topic_id( $topic_id ); 2037 $link_url = bbp_get_topic_last_reply_url( $topic_id ); 2038 $title = bbp_get_topic_last_reply_title( $topic_id ); 2039 $time_since = bbp_get_topic_last_active_time( $topic_id ); 2040 2041 if ( ! empty( $time_since ) ) { 2042 $anchor = '<a href="' . esc_url( $link_url ) . '" title="' . esc_attr( $title ) . '">' . esc_html( $time_since ) . '</a>'; 2043 } else { 2044 $anchor = esc_html__( 'No Replies', 'bbpress' ); 2045 } 2046 2047 // Filter & return 2048 return apply_filters( 'bbp_get_topic_freshness_link', $anchor, $topic_id, $time_since, $link_url, $title ); 2049 } 2050 2051 /** 2052 * Output the replies link of the topic 2052 2053 /** 2054 * Returns link to the most recent activity inside a topic, complete 2055 * with link attributes and content. 2056 * 2057 * @since 2.0.0 bbPress (r2625) 2058 * 2059 * @param int $topic_id Optional. Topic id. 2060 * @return string Topic freshness link. 2061 */ 2062 function bbp_get_topic_freshness_link( $topic_id = 0 ) { 2063 $topic_id = bbp_get_topic_id( $topic_id ); 2064 $link_url = bbp_get_topic_last_reply_url( $topic_id ); 2065 $title = bbp_get_topic_last_reply_title( $topic_id ); 2066 $time_since = bbp_get_topic_last_active_time( $topic_id ); 2067 2068 if ( ! empty( $time_since ) ) { 2069 $anchor = '<a href="' . esc_url( $link_url ) . '" title="' . esc_attr( $title ) . '">' . esc_html( $time_since ) . '</a>'; 2070 } else { 2071 $anchor = esc_html__( 'No Replies', 'bbpress' ); 2072 } 2073 2074 // Filter & return 2075 return apply_filters( 'bbp_get_topic_freshness_link', $anchor, $topic_id, $time_since, $link_url, $title ); 2076 } 2077 2078 /** 2079 * Output the replies link of the topic. 2053 2080 * 2054 2081 * @since 2.0.0 bbPress (r2740) 2055 2082 * 2056 * @param int $topic_id Optional. Topic id 2083 * @param int $topic_id Optional. Topic id. 2057 2084 */ 2058 2085 function bbp_topic_replies_link( $topic_id = 0 ) { … … 2060 2087 } 2061 2088 2062 /**2063 * Return the replies link of the topic 2064 *2065 * @since 2.0.0 bbPress (r2740)2066 *2067 * @param int $topic_id Optional. Topic id 2068 */2069 function bbp_get_topic_replies_link( $topic_id = 0 ) {2070 $topic_id = bbp_get_topic_id( $topic_id );2071 $link = bbp_get_topic_permalink( $topic_id );2072 /* translators: %s: Number of replies */2073 $replies = sprintf( _n( '%s reply', '%s replies', bbp_get_topic_reply_count( $topic_id, true ), 'bbpress' ), bbp_get_topic_reply_count( $topic_id, false ) );2074 2075 // First link never has view=all2076 $retval = bbp_get_view_all( 'edit_others_replies' )2077 ? "<a href='" . esc_url( bbp_remove_view_all( $link ) ) . "'>" . esc_html( $replies ) . '</a>'2078 : $replies;2079 2080 // Any deleted replies?2081 $deleted_int = bbp_get_topic_reply_count_hidden( $topic_id, true );2082 2083 // This topic has hidden replies2084 if ( ! empty( $deleted_int ) && current_user_can( 'edit_others_replies' ) ) {2085 2086 // Hidden replies2087 $deleted_num = bbp_get_topic_reply_count_hidden( $topic_id, false );2088 /* translators: %s: Number of hidden replies */2089 $extra = ' ' . sprintf( _n( '(+%s hidden)', '(+%s hidden)', $deleted_int, 'bbpress' ), $deleted_num );2090 2091 // Hidden link2092 $retval .= ! bbp_get_view_all( 'edit_others_replies' )2093 ? " <a href='" . esc_url( bbp_add_view_all( $link, true ) ) . "'>" . esc_html( $extra ) . '</a>'2094 : " {$extra}";2095 }2096 2097 // Filter & return2098 return apply_filters( 'bbp_get_topic_replies_link', $retval, $topic_id );2099 }2100 2101 /** 2102 * Output total reply count of a topic 2089 /** 2090 * Return the replies link of the topic. 2091 * 2092 * @since 2.0.0 bbPress (r2740) 2093 * 2094 * @param int $topic_id Optional. Topic id. 2095 */ 2096 function bbp_get_topic_replies_link( $topic_id = 0 ) { 2097 $topic_id = bbp_get_topic_id( $topic_id ); 2098 $link = bbp_get_topic_permalink( $topic_id ); 2099 /* translators: %s: Number of replies */ 2100 $replies = sprintf( _n( '%s reply', '%s replies', bbp_get_topic_reply_count( $topic_id, true ), 'bbpress' ), bbp_get_topic_reply_count( $topic_id, false ) ); 2101 2102 // First link never has view=all 2103 $retval = bbp_get_view_all( 'edit_others_replies' ) 2104 ? "<a href='" . esc_url( bbp_remove_view_all( $link ) ) . "'>" . esc_html( $replies ) . '</a>' 2105 : $replies; 2106 2107 // Any deleted replies? 2108 $deleted_int = bbp_get_topic_reply_count_hidden( $topic_id, true ); 2109 2110 // This topic has hidden replies 2111 if ( ! empty( $deleted_int ) && current_user_can( 'edit_others_replies' ) ) { 2112 2113 // Hidden replies 2114 $deleted_num = bbp_get_topic_reply_count_hidden( $topic_id, false ); 2115 /* translators: %s: Number of hidden replies */ 2116 $extra = ' ' . sprintf( _n( '(+%s hidden)', '(+%s hidden)', $deleted_int, 'bbpress' ), $deleted_num ); 2117 2118 // Hidden link 2119 $retval .= ! bbp_get_view_all( 'edit_others_replies' ) 2120 ? " <a href='" . esc_url( bbp_add_view_all( $link, true ) ) . "'>" . esc_html( $extra ) . '</a>' 2121 : " {$extra}"; 2122 } 2123 2124 // Filter & return 2125 return apply_filters( 'bbp_get_topic_replies_link', $retval, $topic_id ); 2126 } 2127 2128 /** 2129 * Output total reply count of a topic. 2103 2130 * 2104 2131 * @since 2.0.0 bbPress (r2485) 2105 2132 * 2106 * @param int $topic_id Optional. Topic id 2107 * @param boolean $integer Optional. Whether or not to format the result 2133 * @param int $topic_id Optional. Topic id. 2134 * @param boolean $integer Optional. Whether or not to format the result. 2108 2135 */ 2109 2136 function bbp_topic_reply_count( $topic_id = 0, $integer = false ) { 2110 2137 echo bbp_get_topic_reply_count( $topic_id, $integer ); 2111 2138 } 2112 /** 2113 * Return total reply count of a topic 2114 * 2115 * @since 2.0.0 bbPress (r2485) 2116 * 2117 * @param int $topic_id Optional. Topic id 2118 * @param boolean $integer Optional. Whether or not to format the result 2119 * @return int Reply count 2120 */ 2121 function bbp_get_topic_reply_count( $topic_id = 0, $integer = false ) { 2122 $topic_id = bbp_get_topic_id( $topic_id ); 2123 $replies = (int) get_post_meta( $topic_id, '_bbp_reply_count', true ); 2124 $filter = ( true === $integer ) 2125 ? 'bbp_get_topic_reply_count_int' 2126 : 'bbp_get_topic_reply_count'; 2127 2128 return apply_filters( $filter, $replies, $topic_id ); 2129 } 2130 2131 /** 2132 * Output total post count of a topic 2139 2140 /** 2141 * Return total reply count of a topic. 2142 * 2143 * @since 2.0.0 bbPress (r2485) 2144 * 2145 * @param int $topic_id Optional. Topic id. 2146 * @param boolean $integer Optional. Whether or not to format the result. 2147 * @return int Reply count. 2148 */ 2149 function bbp_get_topic_reply_count( $topic_id = 0, $integer = false ) { 2150 $topic_id = bbp_get_topic_id( $topic_id ); 2151 $replies = (int) get_post_meta( $topic_id, '_bbp_reply_count', true ); 2152 $filter = ( true === $integer ) 2153 ? 'bbp_get_topic_reply_count_int' 2154 : 'bbp_get_topic_reply_count'; 2155 2156 return apply_filters( $filter, $replies, $topic_id ); 2157 } 2158 2159 /** 2160 * Output total post count of a topic. 2133 2161 * 2134 2162 * @since 2.0.0 bbPress (r2954) 2135 2163 * 2136 * @param int $topic_id Optional. Topic id 2137 * @param boolean $integer Optional. Whether or not to format the result 2164 * @param int $topic_id Optional. Topic id. 2165 * @param boolean $integer Optional. Whether or not to format the result. 2138 2166 */ 2139 2167 function bbp_topic_post_count( $topic_id = 0, $integer = false ) { 2140 2168 echo bbp_get_topic_post_count( $topic_id, $integer ); 2141 2169 } 2142 /** 2143 * Return total post count of a topic 2144 * 2145 * @since 2.0.0 bbPress (r2954) 2146 * 2147 * @param int $topic_id Optional. Topic id 2148 * @param boolean $integer Optional. Whether or not to format the result 2149 * @return int Post count 2150 */ 2151 function bbp_get_topic_post_count( $topic_id = 0, $integer = false ) { 2152 $topic_id = bbp_get_topic_id( $topic_id ); 2153 $replies = ( (int) get_post_meta( $topic_id, '_bbp_reply_count', true ) ) + 1; 2154 $filter = ( true === $integer ) 2155 ? 'bbp_get_topic_post_count_int' 2156 : 'bbp_get_topic_post_count'; 2157 2158 return apply_filters( $filter, $replies, $topic_id ); 2159 } 2170 2171 /** 2172 * Return total post count of a topic. 2173 * 2174 * @since 2.0.0 bbPress (r2954) 2175 * 2176 * @param int $topic_id Optional. Topic id. 2177 * @param boolean $integer Optional. Whether or not to format the result. 2178 * @return int Post count. 2179 */ 2180 function bbp_get_topic_post_count( $topic_id = 0, $integer = false ) { 2181 $topic_id = bbp_get_topic_id( $topic_id ); 2182 $replies = ( (int) get_post_meta( $topic_id, '_bbp_reply_count', true ) ) + 1; 2183 $filter = ( true === $integer ) 2184 ? 'bbp_get_topic_post_count_int' 2185 : 'bbp_get_topic_post_count'; 2186 2187 return apply_filters( $filter, $replies, $topic_id ); 2188 } 2160 2189 2161 2190 /** 2162 2191 * Output total hidden reply count of a topic (hidden includes trashed and 2163 * spammed replies) 2192 * spammed replies). 2164 2193 * 2165 2194 * @since 2.0.0 bbPress (r2740) 2166 2195 * 2167 * @param int $topic_id Optional. Topic id 2168 * @param boolean $integer Optional. Whether or not to format the result 2196 * @param int $topic_id Optional. Topic id. 2197 * @param boolean $integer Optional. Whether or not to format the result. 2169 2198 */ 2170 2199 function bbp_topic_reply_count_hidden( $topic_id = 0, $integer = false ) { 2171 2200 echo bbp_get_topic_reply_count_hidden( $topic_id, $integer ); 2172 2201 } 2173 /** 2174 * Return total hidden reply count of a topic (hidden includes trashed 2175 * and spammed replies) 2176 * 2177 * @since 2.0.0 bbPress (r2740) 2178 * 2179 * @param int $topic_id Optional. Topic id 2180 * @param boolean $integer Optional. Whether or not to format the result 2181 * @return int Topic hidden reply count 2182 */ 2183 function bbp_get_topic_reply_count_hidden( $topic_id = 0, $integer = false ) { 2184 $topic_id = bbp_get_topic_id( $topic_id ); 2185 $replies = (int) get_post_meta( $topic_id, '_bbp_reply_count_hidden', true ); 2186 $filter = ( true === $integer ) 2187 ? 'bbp_get_topic_reply_count_hidden_int' 2188 : 'bbp_get_topic_reply_count_hidden'; 2189 2190 return apply_filters( $filter, $replies, $topic_id ); 2191 } 2192 2193 /** 2194 * Output total voice count of a topic 2202 2203 /** 2204 * Return total hidden reply count of a topic (hidden includes trashed 2205 * and spammed replies). 2206 * 2207 * @since 2.0.0 bbPress (r2740) 2208 * 2209 * @param int $topic_id Optional. Topic id. 2210 * @param boolean $integer Optional. Whether or not to format the result. 2211 * @return int Topic hidden reply count. 2212 */ 2213 function bbp_get_topic_reply_count_hidden( $topic_id = 0, $integer = false ) { 2214 $topic_id = bbp_get_topic_id( $topic_id ); 2215 $replies = (int) get_post_meta( $topic_id, '_bbp_reply_count_hidden', true ); 2216 $filter = ( true === $integer ) 2217 ? 'bbp_get_topic_reply_count_hidden_int' 2218 : 'bbp_get_topic_reply_count_hidden'; 2219 2220 return apply_filters( $filter, $replies, $topic_id ); 2221 } 2222 2223 /** 2224 * Output total voice count of a topic. 2195 2225 * 2196 2226 * @since 2.0.0 bbPress (r2567) 2197 2227 * 2198 * @param int $topic_id Optional. Topic id 2228 * @param int $topic_id Optional. Topic id. 2199 2229 */ 2200 2230 function bbp_topic_voice_count( $topic_id = 0, $integer = false ) { 2201 2231 echo bbp_get_topic_voice_count( $topic_id, $integer ); 2202 2232 } 2203 /** 2204 * Return total voice count of a topic 2205 * 2206 * @since 2.0.0 bbPress (r2567) 2207 * 2208 * @param int $topic_id Optional. Topic id 2209 * @return int Voice count of the topic 2210 */ 2211 function bbp_get_topic_voice_count( $topic_id = 0, $integer = false ) { 2212 $topic_id = bbp_get_topic_id( $topic_id ); 2213 $voices = (int) get_post_meta( $topic_id, '_bbp_voice_count', true ); 2214 $filter = ( true === $integer ) 2215 ? 'bbp_get_topic_voice_count_int' 2216 : 'bbp_get_topic_voice_count'; 2217 2218 return apply_filters( $filter, $voices, $topic_id ); 2219 } 2220 2221 /** 2222 * Output a the tags of a topic 2233 2234 /** 2235 * Return total voice count of a topic. 2236 * 2237 * @since 2.0.0 bbPress (r2567) 2238 * 2239 * @param int $topic_id Optional. Topic id. 2240 * @return int Voice count of the topic. 2241 */ 2242 function bbp_get_topic_voice_count( $topic_id = 0, $integer = false ) { 2243 $topic_id = bbp_get_topic_id( $topic_id ); 2244 $voices = (int) get_post_meta( $topic_id, '_bbp_voice_count', true ); 2245 $filter = ( true === $integer ) 2246 ? 'bbp_get_topic_voice_count_int' 2247 : 'bbp_get_topic_voice_count'; 2248 2249 return apply_filters( $filter, $voices, $topic_id ); 2250 } 2251 2252 /** 2253 * Output a the tags of a topic. 2223 2254 * 2224 2255 * @since 2.0.0 bbPress (r2688) 2225 2256 * 2226 * @param int $topic_id Optional. Topic id 2227 * @param array $args See {@link bbp_get_topic_tag_list()} 2257 * @param int $topic_id Optional. Topic id. 2258 * @param array $args See {@link bbp_get_topic_tag_list()}. 2228 2259 */ 2229 2260 function bbp_topic_tag_list( $topic_id = 0, $args = array() ) { 2230 2261 echo bbp_get_topic_tag_list( $topic_id, $args ); 2231 2262 } 2232 /** 2233 * Return the tags of a topic 2234 * 2235 * @since 2.0.0 bbPress (r2688) 2236 * 2237 * @param int $topic_id Optional. Topic id 2238 * @param array $args This function supports these arguments: 2239 * - before: Before the tag list 2240 * - sep: Tag separator 2241 * - after: After the tag list 2242 * @return string Tag list of the topic 2243 */ 2244 function bbp_get_topic_tag_list( $topic_id = 0, $args = array() ) { 2245 2246 // Bail if topic-tags are off 2247 if ( ! bbp_allow_topic_tags() ) { 2248 return ''; 2263 2264 /** 2265 * Return the tags of a topic. 2266 * 2267 * @since 2.0.0 bbPress (r2688) 2268 * 2269 * @param int $topic_id Optional. Topic id. 2270 * @param array $args This function supports these arguments: 2271 * - before: Before the tag list 2272 * - sep: Tag separator 2273 * - after: After the tag list 2274 * @return string Tag list of the topic. 2275 */ 2276 function bbp_get_topic_tag_list( $topic_id = 0, $args = array() ) { 2277 2278 // Bail if topic-tags are off 2279 if ( ! bbp_allow_topic_tags() ) { 2280 return ''; 2281 } 2282 2283 // Parse arguments against default values 2284 $r = bbp_parse_args( 2285 $args, 2286 array( 2287 'before' => '<div class="bbp-topic-tags"><p>' . esc_html__( 'Tagged:', 'bbpress' ) . ' ', 2288 'sep' => ', ', 2289 'after' => '</p></div>', 2290 'none' => '' 2291 ), 2292 'get_topic_tag_list' 2293 ); 2294 2295 $topic_id = bbp_get_topic_id( $topic_id ); 2296 2297 // Topic is spammed, so display pre-spam terms 2298 if ( bbp_is_topic_spam( $topic_id ) ) { 2299 2300 // Get pre-spam terms 2301 $terms = get_post_meta( $topic_id, '_bbp_spam_topic_tags', true ); 2302 2303 // If terms exist, implode them and compile the return value 2304 if ( ! empty( $terms ) ) { 2305 $terms = $r['before'] . implode( $r['sep'], $terms ) . $r['after']; 2249 2306 } 2250 2307 2251 // Parse arguments against default values 2252 $r = bbp_parse_args( 2253 $args, 2254 array( 2255 'before' => '<div class="bbp-topic-tags"><p>' . esc_html__( 'Tagged:', 'bbpress' ) . ' ', 2256 'sep' => ', ', 2257 'after' => '</p></div>', 2258 'none' => '' 2259 ), 2260 'get_topic_tag_list' 2261 ); 2262 2263 $topic_id = bbp_get_topic_id( $topic_id ); 2264 2265 // Topic is spammed, so display pre-spam terms 2266 if ( bbp_is_topic_spam( $topic_id ) ) { 2267 2268 // Get pre-spam terms 2269 $terms = get_post_meta( $topic_id, '_bbp_spam_topic_tags', true ); 2270 2271 // If terms exist, implode them and compile the return value 2272 if ( ! empty( $terms ) ) { 2273 $terms = $r['before'] . implode( $r['sep'], $terms ) . $r['after']; 2274 } 2275 2276 // Topic is not spam so display a clickable term list 2277 } else { 2278 $terms = get_the_term_list( $topic_id, bbp_get_topic_tag_tax_id(), $r['before'], $r['sep'], $r['after'] ); 2279 } 2280 2281 // No terms so return none string 2282 if ( ! empty( $terms ) ) { 2283 $retval = $terms; 2284 } else { 2285 $retval = $r['none']; 2286 } 2287 2288 return $retval; 2289 } 2290 2291 /** 2292 * Output the row class of a topic 2308 // Topic is not spam so display a clickable term list 2309 } else { 2310 $terms = get_the_term_list( $topic_id, bbp_get_topic_tag_tax_id(), $r['before'], $r['sep'], $r['after'] ); 2311 } 2312 2313 // No terms so return none string 2314 if ( ! empty( $terms ) ) { 2315 $retval = $terms; 2316 } else { 2317 $retval = $r['none']; 2318 } 2319 2320 return $retval; 2321 } 2322 2323 /** 2324 * Output the row class of a topic. 2293 2325 * 2294 2326 * @since 2.0.0 bbPress (r2667) 2295 2327 * 2296 * @param int $topic_id Optional. Topic id 2297 * @param array Extra classes you can pass when calling this function 2328 * @param int $topic_id Optional. Topic id. 2329 * @param array Extra classes you can pass when calling this function. 2298 2330 */ 2299 2331 function bbp_topic_class( $topic_id = 0, $classes = array() ) { 2300 2332 echo bbp_get_topic_class( $topic_id, $classes ); 2301 2333 } 2302 /** 2303 * Return the row class of a topic 2304 * 2305 * @since 2.0.0 bbPress (r2667) 2306 * 2307 * @param int $topic_id Optional. Topic id 2308 * @param array Extra classes you can pass when calling this function 2309 * @return string Row class of a topic 2310 */ 2311 function bbp_get_topic_class( $topic_id = 0, $classes = array() ) { 2312 $bbp = bbpress(); 2313 $topic_id = bbp_get_topic_id( $topic_id ); 2314 $forum_id = bbp_get_topic_forum_id( $topic_id ); 2315 $author_id = bbp_get_topic_author_id( $topic_id ); 2316 $classes = array_filter( (array) $classes ); 2317 $count = isset( $bbp->topic_query->current_post ) 2318 ? (int) $bbp->topic_query->current_post 2319 : 1; 2320 2321 // Stripes 2322 $even_odd = ( $count % 2 ) 2323 ? 'even' 2324 : 'odd'; 2325 2326 // Forum moderator replied to topic 2327 $forum_moderator = ( bbp_is_user_forum_moderator( $author_id, $forum_id ) === $author_id ) 2328 ? 'forum-mod' 2329 : ''; 2330 2331 // Is this topic a sticky? 2332 $sticky = bbp_is_topic_sticky( $topic_id, false ) 2333 ? 'sticky' 2334 : ''; 2335 2336 // Is this topic a super-sticky? 2337 $super_sticky = bbp_is_topic_super_sticky( $topic_id ) 2338 ? 'super-sticky' 2339 : ''; 2340 2341 // Get topic classes 2342 $topic_classes = array( 2343 'loop-item-' . $count, 2344 'user-id-' . $author_id, 2345 'bbp-parent-forum-' . $forum_id, 2346 $even_odd, 2347 $forum_moderator, 2348 $sticky, 2349 $super_sticky 2350 ); 2351 2352 // Run the topic classes through the post-class filters, which also 2353 // handles the escaping of each individual class. 2354 $post_classes = get_post_class( array_merge( $classes, $topic_classes ), $topic_id ); 2355 2356 // Filter 2357 $new_classes = apply_filters( 'bbp_get_topic_class', $post_classes, $topic_id, $classes ); 2358 2359 // Return 2360 return 'class="' . implode( ' ', $new_classes ) . '"'; 2361 } 2334 2335 /** 2336 * Return the row class of a topic. 2337 * 2338 * @since 2.0.0 bbPress (r2667) 2339 * 2340 * @param int $topic_id Optional. Topic id. 2341 * @param array Extra classes you can pass when calling this function. 2342 * @return string Row class of a topic. 2343 */ 2344 function bbp_get_topic_class( $topic_id = 0, $classes = array() ) { 2345 $bbp = bbpress(); 2346 $topic_id = bbp_get_topic_id( $topic_id ); 2347 $forum_id = bbp_get_topic_forum_id( $topic_id ); 2348 $author_id = bbp_get_topic_author_id( $topic_id ); 2349 $classes = array_filter( (array) $classes ); 2350 $count = isset( $bbp->topic_query->current_post ) 2351 ? (int) $bbp->topic_query->current_post 2352 : 1; 2353 2354 // Stripes 2355 $even_odd = ( $count % 2 ) 2356 ? 'even' 2357 : 'odd'; 2358 2359 // Forum moderator replied to topic 2360 $forum_moderator = ( bbp_is_user_forum_moderator( $author_id, $forum_id ) === $author_id ) 2361 ? 'forum-mod' 2362 : ''; 2363 2364 // Is this topic a sticky? 2365 $sticky = bbp_is_topic_sticky( $topic_id, false ) 2366 ? 'sticky' 2367 : ''; 2368 2369 // Is this topic a super-sticky? 2370 $super_sticky = bbp_is_topic_super_sticky( $topic_id ) 2371 ? 'super-sticky' 2372 : ''; 2373 2374 // Get topic classes 2375 $topic_classes = array( 2376 'loop-item-' . $count, 2377 'user-id-' . $author_id, 2378 'bbp-parent-forum-' . $forum_id, 2379 $even_odd, 2380 $forum_moderator, 2381 $sticky, 2382 $super_sticky 2383 ); 2384 2385 // Run the topic classes through the post-class filters, which also 2386 // handles the escaping of each individual class. 2387 $post_classes = get_post_class( array_merge( $classes, $topic_classes ), $topic_id ); 2388 2389 // Filter 2390 $new_classes = apply_filters( 'bbp_get_topic_class', $post_classes, $topic_id, $classes ); 2391 2392 // Return 2393 return 'class="' . implode( ' ', $new_classes ) . '"'; 2394 } 2362 2395 2363 2396 /** Topic Admin Links *********************************************************/ 2364 2397 2365 2398 /** 2366 * Output admin links for topic 2367 * 2368 * @param array $args See {@link bbp_get_topic_admin_links()} 2399 * Output admin links for topic. 2400 * 2401 * @param array $args See {@link bbp_get_topic_admin_links()}. 2369 2402 */ 2370 2403 function bbp_topic_admin_links( $args = array() ) { 2371 2404 echo bbp_get_topic_admin_links( $args ); 2372 2405 } 2373 /** 2374 * Return admin links for topic. 2375 * 2376 * Move topic functionality is handled by the edit topic page. 2377 * 2378 * @param array $args This function supports these arguments: 2379 * - id: Optional. Topic id 2380 * - before: Before the links 2381 * - after: After the links 2382 * - sep: Links separator 2383 * - links: Topic admin links array 2384 * @return string Topic admin links 2385 */ 2386 function bbp_get_topic_admin_links( $args = array() ) { 2387 2388 // Parse arguments against default values 2389 $r = bbp_parse_args( 2390 $args, 2406 2407 /** 2408 * Return admin links for topic. 2409 * 2410 * Move topic functionality is handled by the edit topic page. 2411 * 2412 * @param array $args This function supports these arguments: 2413 * - id: Optional. Topic id 2414 * - before: Before the links 2415 * - after: After the links 2416 * - sep: Links separator 2417 * - links: Topic admin links array 2418 * @return string Topic admin links. 2419 */ 2420 function bbp_get_topic_admin_links( $args = array() ) { 2421 2422 // Parse arguments against default values 2423 $r = bbp_parse_args( 2424 $args, 2425 array( 2426 'id' => bbp_get_topic_id(), 2427 'before' => '<span class="bbp-admin-links">', 2428 'after' => '</span>', 2429 'sep' => ' | ', 2430 'links' => array() 2431 ), 2432 'get_topic_admin_links' 2433 ); 2434 2435 if ( empty( $r['links'] ) ) { 2436 $r['links'] = apply_filters( 2437 'bbp_topic_admin_links', 2391 2438 array( 2392 'id' => bbp_get_topic_id(), 2393 'before' => '<span class="bbp-admin-links">', 2394 'after' => '</span>', 2395 'sep' => ' | ', 2396 'links' => array() 2439 'edit' => bbp_get_topic_edit_link ( $r ), 2440 'merge' => bbp_get_topic_merge_link ( $r ), 2441 'close' => bbp_get_topic_close_link ( $r ), 2442 'stick' => bbp_get_topic_stick_link ( $r ), 2443 'trash' => bbp_get_topic_trash_link ( $r ), 2444 'spam' => bbp_get_topic_spam_link ( $r ), 2445 'approve' => bbp_get_topic_approve_link( $r ), 2446 'reply' => bbp_get_topic_reply_link ( $r ) 2397 2447 ), 2398 'get_topic_admin_links'2448 $r['id'] 2399 2449 ); 2400 2401 if ( empty( $r['links'] ) ) { 2402 $r['links'] = apply_filters(2403 'bbp_topic_admin_links',2404 array(2405 'edit' => bbp_get_topic_edit_link ( $r ), 2406 'merge' => bbp_get_topic_merge_link ( $r ),2407 'close' => bbp_get_topic_close_link ( $r ),2408 'stick' => bbp_get_topic_stick_link ( $r ), 2409 'trash' => bbp_get_topic_trash_link ( $r ),2410 'spam' => bbp_get_topic_spam_link ( $r ),2411 'approve' => bbp_get_topic_approve_link( $r ),2412 'reply' => bbp_get_topic_reply_link ( $r ) 2413 ),2414 $r['id']2415 );2450 } 2451 2452 // See if links need to be unset 2453 $topic_status = bbp_get_topic_status( $r['id'] ); 2454 if ( in_array( $topic_status, bbp_get_non_public_topic_statuses(), true ) ) { 2455 2456 // Close link shouldn't be visible on trashed/spammed/pending topics 2457 unset( $r['links']['close'] ); 2458 2459 // Spam link shouldn't be visible on trashed topics 2460 if ( bbp_get_trash_status_id() === $topic_status ) { 2461 unset( $r['links']['spam'] ); 2462 2463 // Trash link shouldn't be visible on spam topics 2464 } elseif ( bbp_get_spam_status_id() === $topic_status ) { 2465 unset( $r['links']['trash'] ); 2416 2466 } 2417 2418 // See if links need to be unset 2419 $topic_status = bbp_get_topic_status( $r['id'] ); 2420 if ( in_array( $topic_status, bbp_get_non_public_topic_statuses(), true ) ) { 2421 2422 // Close link shouldn't be visible on trashed/spammed/pending topics 2423 unset( $r['links']['close'] ); 2424 2425 // Spam link shouldn't be visible on trashed topics 2426 if ( bbp_get_trash_status_id() === $topic_status ) { 2427 unset( $r['links']['spam'] ); 2428 2429 // Trash link shouldn't be visible on spam topics 2430 } elseif ( bbp_get_spam_status_id() === $topic_status ) { 2431 unset( $r['links']['trash'] ); 2432 } 2433 } 2434 2435 // Process the admin links 2436 $links = implode( $r['sep'], array_filter( $r['links'] ) ); 2437 $retval = $r['before'] . $links . $r['after']; 2438 2439 // Filter & return 2440 return apply_filters( 'bbp_get_topic_admin_links', $retval, $r, $args ); 2441 } 2442 2443 /** 2444 * Output the edit link of the topic 2467 } 2468 2469 // Process the admin links 2470 $links = implode( $r['sep'], array_filter( $r['links'] ) ); 2471 $retval = $r['before'] . $links . $r['after']; 2472 2473 // Filter & return 2474 return apply_filters( 'bbp_get_topic_admin_links', $retval, $r, $args ); 2475 } 2476 2477 /** 2478 * Output the edit link of the topic. 2445 2479 * 2446 2480 * @since 2.0.0 bbPress (r2727) 2447 2481 * 2448 * @param array $args See {@link bbp_get_topic_edit_link()} 2482 * @param array $args See {@link bbp_get_topic_edit_link()}. 2449 2483 */ 2450 2484 function bbp_topic_edit_link( $args = array() ) { … … 2452 2486 } 2453 2487 2454 /** 2455 * Return the edit link of the topic 2456 * 2457 * @since 2.0.0 bbPress (r2727) 2458 * 2459 * @param array $args This function supports these args: 2460 * - id: Optional. Topic id 2461 * - link_before: Before the link 2462 * - link_after: After the link 2463 * - edit_text: Edit text 2464 * @return string Topic edit link 2465 */ 2466 function bbp_get_topic_edit_link( $args = array() ) { 2467 2468 // Parse arguments against default values 2469 $r = bbp_parse_args( 2470 $args, 2471 array( 2472 'id' => 0, 2473 'link_before' => '', 2474 'link_after' => '', 2475 'edit_text' => esc_html__( 'Edit', 'bbpress' ) 2476 ), 2477 'get_topic_edit_link' 2478 ); 2479 2480 // Get the topic 2481 $topic = bbp_get_topic( $r['id'] ); 2482 2483 // Bypass check if user has caps 2484 if ( ! current_user_can( 'edit_others_topics' ) ) { 2485 2486 // User cannot edit or it is past the lock time 2487 if ( empty( $topic ) || ! current_user_can( 'edit_topic', $topic->ID ) || bbp_past_edit_lock( $topic->post_date_gmt ) ) { 2488 return; 2489 } 2490 } 2491 2492 // Get uri 2493 $uri = bbp_get_topic_edit_url( $topic->ID ); 2494 2495 // Bail if no uri 2496 if ( empty( $uri ) ) { 2488 /** 2489 * Return the edit link of the topic. 2490 * 2491 * @since 2.0.0 bbPress (r2727) 2492 * 2493 * @param array $args This function supports these args: 2494 * - id: Optional. Topic id 2495 * - link_before: Before the link 2496 * - link_after: After the link 2497 * - edit_text: Edit text 2498 * @return string Topic edit link. 2499 */ 2500 function bbp_get_topic_edit_link( $args = array() ) { 2501 2502 // Parse arguments against default values 2503 $r = bbp_parse_args( 2504 $args, 2505 array( 2506 'id' => 0, 2507 'link_before' => '', 2508 'link_after' => '', 2509 'edit_text' => esc_html__( 'Edit', 'bbpress' ) 2510 ), 2511 'get_topic_edit_link' 2512 ); 2513 2514 // Get the topic 2515 $topic = bbp_get_topic( $r['id'] ); 2516 2517 // Bypass check if user has caps 2518 if ( ! current_user_can( 'edit_others_topics' ) ) { 2519 2520 // User cannot edit or it is past the lock time 2521 if ( empty( $topic ) || ! current_user_can( 'edit_topic', $topic->ID ) || bbp_past_edit_lock( $topic->post_date_gmt ) ) { 2497 2522 return; 2498 2523 } 2499 2500 $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-edit-link">' . $r['edit_text'] . '</a>' . $r['link_after']; 2501 2502 // Filter & return 2503 return apply_filters( 'bbp_get_topic_edit_link', $retval, $r, $args ); 2504 } 2505 2506 /** 2507 * Output URL to the topic edit page 2524 } 2525 2526 // Get uri 2527 $uri = bbp_get_topic_edit_url( $topic->ID ); 2528 2529 // Bail if no uri 2530 if ( empty( $uri ) ) { 2531 return; 2532 } 2533 2534 $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-edit-link">' . $r['edit_text'] . '</a>' . $r['link_after']; 2535 2536 // Filter & return 2537 return apply_filters( 'bbp_get_topic_edit_link', $retval, $r, $args ); 2538 } 2539 2540 /** 2541 * Output URL to the topic edit page. 2508 2542 * 2509 2543 * @since 2.0.0 bbPress (r2753) 2510 2544 * 2511 * @param int $topic_id Optional. Topic id 2545 * @param int $topic_id Optional. Topic id. 2512 2546 */ 2513 2547 function bbp_topic_edit_url( $topic_id = 0 ) { 2514 2548 echo esc_url( bbp_get_topic_edit_url( $topic_id ) ); 2515 2549 } 2516 /** 2517 * Return URL to the topic edit page 2518 * 2519 * @since 2.0.0 bbPress (r2753) 2520 * 2521 * @param int $topic_id Optional. Topic id 2522 * @return string Topic edit url 2523 */ 2524 function bbp_get_topic_edit_url( $topic_id = 0 ) { 2525 2526 $topic = bbp_get_topic( $topic_id ); 2527 if ( empty( $topic ) ) { 2528 return; 2529 } 2530 2531 // Remove view=all link from edit 2532 $topic_link = bbp_remove_view_all( bbp_get_topic_permalink( $topic_id ) ); 2533 2534 // Pretty permalinks, previously used `bbp_use_pretty_urls()` 2535 // https://bbpress.trac.wordpress.org/ticket/3054 2536 if ( false === strpos( $topic_link, '?' ) ) { 2537 $url = trailingslashit( $topic_link ) . bbp_get_edit_slug(); 2538 $url = user_trailingslashit( $url ); 2539 2540 // Unpretty permalinks 2541 } else { 2542 $url = add_query_arg( 2543 array( 2544 bbp_get_topic_post_type() => $topic->post_name, 2545 bbp_get_edit_rewrite_id() => '1' 2546 ), 2547 $topic_link 2548 ); 2549 } 2550 2551 // Maybe add view=all 2552 $url = bbp_add_view_all( $url ); 2553 2554 // Filter & return 2555 return apply_filters( 'bbp_get_topic_edit_url', $url, $topic_id ); 2556 } 2557 2558 /** 2559 * Output the trash link of the topic 2550 2551 /** 2552 * Return URL to the topic edit page. 2553 * 2554 * @since 2.0.0 bbPress (r2753) 2555 * 2556 * @param int $topic_id Optional. Topic id. 2557 * @return string Topic edit url. 2558 */ 2559 function bbp_get_topic_edit_url( $topic_id = 0 ) { 2560 2561 $topic = bbp_get_topic( $topic_id ); 2562 if ( empty( $topic ) ) { 2563 return; 2564 } 2565 2566 // Remove view=all link from edit 2567 $topic_link = bbp_remove_view_all( bbp_get_topic_permalink( $topic_id ) ); 2568 2569 // Pretty permalinks, previously used `bbp_use_pretty_urls()` 2570 // https://bbpress.trac.wordpress.org/ticket/3054 2571 if ( false === strpos( $topic_link, '?' ) ) { 2572 $url = trailingslashit( $topic_link ) . bbp_get_edit_slug(); 2573 $url = user_trailingslashit( $url ); 2574 2575 // Unpretty permalinks 2576 } else { 2577 $url = add_query_arg( 2578 array( 2579 bbp_get_topic_post_type() => $topic->post_name, 2580 bbp_get_edit_rewrite_id() => '1' 2581 ), 2582 $topic_link 2583 ); 2584 } 2585 2586 // Maybe add view=all 2587 $url = bbp_add_view_all( $url ); 2588 2589 // Filter & return 2590 return apply_filters( 'bbp_get_topic_edit_url', $url, $topic_id ); 2591 } 2592 2593 /** 2594 * Output the trash link of the topic. 2560 2595 * 2561 2596 * @since 2.0.0 bbPress (r2727) 2562 2597 * 2563 * @param array $args See {@link bbp_get_topic_trash_link()} 2598 * @param array $args See {@link bbp_get_topic_trash_link()}. 2564 2599 */ 2565 2600 function bbp_topic_trash_link( $args = array() ) { … … 2567 2602 } 2568 2603 2569 /** 2570 * Return the trash link of the topic 2571 * 2572 * @since 2.0.0 bbPress (r2727) 2573 * 2574 * @param array $args This function supports these args: 2575 * - id: Optional. Topic id 2576 * - link_before: Before the link 2577 * - link_after: After the link 2578 * - sep: Links separator 2579 * - trash_text: Trash text 2580 * - restore_text: Restore text 2581 * - delete_text: Delete text 2582 * @return string Topic trash link 2583 */ 2584 function bbp_get_topic_trash_link( $args = array() ) { 2585 2586 // Parse arguments against default values 2587 $r = bbp_parse_args( 2588 $args, 2604 /** 2605 * Return the trash link of the topic. 2606 * 2607 * @since 2.0.0 bbPress (r2727) 2608 * 2609 * @param array $args This function supports these args: 2610 * - id: Optional. Topic id 2611 * - link_before: Before the link 2612 * - link_after: After the link 2613 * - sep: Links separator 2614 * - trash_text: Trash text 2615 * - restore_text: Restore text 2616 * - delete_text: Delete text 2617 * @return string Topic trash link. 2618 */ 2619 function bbp_get_topic_trash_link( $args = array() ) { 2620 2621 // Parse arguments against default values 2622 $r = bbp_parse_args( 2623 $args, 2624 array( 2625 'id' => 0, 2626 'link_before' => '', 2627 'link_after' => '', 2628 'sep' => ' | ', 2629 'trash_text' => esc_html__( 'Trash', 'bbpress' ), 2630 'restore_text' => esc_html__( 'Restore', 'bbpress' ), 2631 'delete_text' => esc_html__( 'Delete', 'bbpress' ) 2632 ), 2633 'get_topic_trash_link' 2634 ); 2635 2636 // Get topic 2637 $topic = bbp_get_topic( $r['id'] ); 2638 2639 // Bail if no topic or current user cannot delete 2640 if ( empty( $topic ) || ! current_user_can( 'delete_topic', $topic->ID ) ) { 2641 return; 2642 } 2643 2644 $actions = array(); 2645 $trash_days = bbp_get_trash_days( bbp_get_topic_post_type() ); 2646 2647 if ( bbp_is_topic_trash( $topic->ID ) ) { 2648 $action_url = add_query_arg( 2589 2649 array( 2590 'id' => 0, 2591 'link_before' => '', 2592 'link_after' => '', 2593 'sep' => ' | ', 2594 'trash_text' => esc_html__( 'Trash', 'bbpress' ), 2595 'restore_text' => esc_html__( 'Restore', 'bbpress' ), 2596 'delete_text' => esc_html__( 'Delete', 'bbpress' ) 2597 ), 2598 'get_topic_trash_link' 2650 'action' => 'bbp_toggle_topic_trash', 2651 'sub_action' => 'untrash', 2652 'topic_id' => $topic->ID 2653 ) 2599 2654 ); 2600 2601 // Get topic 2602 $topic = bbp_get_topic( $r['id'] ); 2603 2604 // Bail if no topic or current user cannot delete 2605 if ( empty( $topic ) || ! current_user_can( 'delete_topic', $topic->ID ) ) { 2606 return; 2607 } 2608 2609 $actions = array(); 2610 $trash_days = bbp_get_trash_days( bbp_get_topic_post_type() ); 2611 2612 if ( bbp_is_topic_trash( $topic->ID ) ) { 2613 $action_url = add_query_arg( 2614 array( 2615 'action' => 'bbp_toggle_topic_trash', 2616 'sub_action' => 'untrash', 2617 'topic_id' => $topic->ID 2618 ) 2619 ); 2620 $action = 'untrash-' . $topic->post_type . '_' . $topic->ID; 2621 $nonce_url = wp_nonce_url( $action_url, $action ); 2622 2623 $actions['untrash'] = '<a title="' . esc_attr__( 'Restore this item from the Trash', 'bbpress' ) . '" href="' . esc_url( $nonce_url ) . '" class="bbp-topic-restore-link">' . $r['restore_text'] . '</a>'; 2624 } elseif ( ! empty( $trash_days ) ) { 2625 $action_url = add_query_arg( 2626 array( 2627 'action' => 'bbp_toggle_topic_trash', 2628 'sub_action' => 'trash', 2629 'topic_id' => $topic->ID 2630 ) 2631 ); 2632 $action = 'trash-' . $topic->post_type . '_' . $topic->ID; 2633 $nonce_url = wp_nonce_url( $action_url, $action ); 2634 2635 $actions['trash'] = '<a title="' . esc_attr__( 'Move this item to the Trash', 'bbpress' ) . '" href="' . esc_url( $nonce_url ) . '" class="bbp-topic-trash-link">' . $r['trash_text'] . '</a>'; 2636 } 2637 2638 if ( bbp_is_topic_trash( $topic->ID ) || empty( $trash_days ) ) { 2639 $action_url = add_query_arg( 2640 array( 2641 'action' => 'bbp_toggle_topic_trash', 2642 'sub_action' => 'delete', 2643 'topic_id' => $topic->ID 2644 ) 2645 ); 2646 $action = 'delete-' . $topic->post_type . '_' . $topic->ID; 2647 $nonce_url = wp_nonce_url( $action_url, $action ); 2648 2649 $actions['delete'] = '<a title="' . esc_attr__( 'Delete this item permanently', 'bbpress' ) . '" href="' . esc_url( $nonce_url ) . '" onclick="return confirm(\'' . esc_js( esc_html__( 'Are you sure you want to delete that permanently?', 'bbpress' ) ) . '\' );" class="bbp-topic-delete-link">' . $r['delete_text'] . '</a>'; 2650 } 2651 2652 // Process the admin links 2653 $retval = $r['link_before'] . implode( $r['sep'], $actions ) . $r['link_after']; 2654 2655 // Filter & return 2656 return apply_filters( 'bbp_get_topic_trash_link', $retval, $r, $args ); 2657 } 2658 2659 /** 2660 * Output the close link of the topic 2655 $action = 'untrash-' . $topic->post_type . '_' . $topic->ID; 2656 $nonce_url = wp_nonce_url( $action_url, $action ); 2657 2658 $actions['untrash'] = '<a title="' . esc_attr__( 'Restore this item from the Trash', 'bbpress' ) . '" href="' . esc_url( $nonce_url ) . '" class="bbp-topic-restore-link">' . $r['restore_text'] . '</a>'; 2659 } elseif ( ! empty( $trash_days ) ) { 2660 $action_url = add_query_arg( 2661 array( 2662 'action' => 'bbp_toggle_topic_trash', 2663 'sub_action' => 'trash', 2664 'topic_id' => $topic->ID 2665 ) 2666 ); 2667 $action = 'trash-' . $topic->post_type . '_' . $topic->ID; 2668 $nonce_url = wp_nonce_url( $action_url, $action ); 2669 2670 $actions['trash'] = '<a title="' . esc_attr__( 'Move this item to the Trash', 'bbpress' ) . '" href="' . esc_url( $nonce_url ) . '" class="bbp-topic-trash-link">' . $r['trash_text'] . '</a>'; 2671 } 2672 2673 if ( bbp_is_topic_trash( $topic->ID ) || empty( $trash_days ) ) { 2674 $action_url = add_query_arg( 2675 array( 2676 'action' => 'bbp_toggle_topic_trash', 2677 'sub_action' => 'delete', 2678 'topic_id' => $topic->ID 2679 ) 2680 ); 2681 $action = 'delete-' . $topic->post_type . '_' . $topic->ID; 2682 $nonce_url = wp_nonce_url( $action_url, $action ); 2683 2684 $actions['delete'] = '<a title="' . esc_attr__( 'Delete this item permanently', 'bbpress' ) . '" href="' . esc_url( $nonce_url ) . '" onclick="return confirm(\'' . esc_js( esc_html__( 'Are you sure you want to delete that permanently?', 'bbpress' ) ) . '\' );" class="bbp-topic-delete-link">' . $r['delete_text'] . '</a>'; 2685 } 2686 2687 // Process the admin links 2688 $retval = $r['link_before'] . implode( $r['sep'], $actions ) . $r['link_after']; 2689 2690 // Filter & return 2691 return apply_filters( 'bbp_get_topic_trash_link', $retval, $r, $args ); 2692 } 2693 2694 /** 2695 * Output the close link of the topic. 2661 2696 * 2662 2697 * @since 2.0.0 bbPress (r2727) 2663 2698 * 2664 * @param array $args See {@link bbp_get_topic_close_link()} 2699 * @param array $args See {@link bbp_get_topic_close_link()}. 2665 2700 */ 2666 2701 function bbp_topic_close_link( $args = array() ) { … … 2668 2703 } 2669 2704 2670 /** 2671 * Return the close link of the topic 2672 * 2673 * @since 2.0.0 bbPress (r2727) 2674 * 2675 * @param array $args This function supports these args: 2676 * - id: Optional. Topic id 2677 * - link_before: Before the link 2678 * - link_after: After the link 2679 * - close_text: Close text 2680 * - open_text: Open text 2681 * @return string Topic close link 2682 */ 2683 function bbp_get_topic_close_link( $args = array() ) { 2684 2685 // Parse arguments against default values 2686 $r = bbp_parse_args( 2687 $args, 2705 /** 2706 * Return the close link of the topic. 2707 * 2708 * @since 2.0.0 bbPress (r2727) 2709 * 2710 * @param array $args This function supports these args: 2711 * - id: Optional. Topic id 2712 * - link_before: Before the link 2713 * - link_after: After the link 2714 * - close_text: Close text 2715 * - open_text: Open text 2716 * @return string Topic close link. 2717 */ 2718 function bbp_get_topic_close_link( $args = array() ) { 2719 2720 // Parse arguments against default values 2721 $r = bbp_parse_args( 2722 $args, 2723 array( 2724 'id' => 0, 2725 'link_before' => '', 2726 'link_after' => '', 2727 'sep' => ' | ', 2728 'close_text' => esc_html_x( 'Close', 'Close the topic', 'bbpress' ), 2729 'open_text' => esc_html_x( 'Open', 'Open the topic', 'bbpress' ) 2730 ), 2731 'get_topic_close_link' 2732 ); 2733 2734 // Get topic 2735 $topic = bbp_get_topic( $r['id'] ); 2736 2737 // Bail if no topic or current user cannot moderate 2738 if ( empty( $topic ) || ! current_user_can( 'moderate', $topic->ID ) ) { 2739 return; 2740 } 2741 2742 $display = bbp_is_topic_open( $topic->ID ) ? $r['close_text'] : $r['open_text']; 2743 $uri = add_query_arg( 2744 array( 2745 'action' => 'bbp_toggle_topic_close', 2746 'topic_id' => $topic->ID 2747 ) 2748 ); 2749 $uri = wp_nonce_url( $uri, 'close-topic_' . $topic->ID ); 2750 $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-close-link">' . $display . '</a>' . $r['link_after']; 2751 2752 // Filter & return 2753 return apply_filters( 'bbp_get_topic_close_link', $retval, $r, $args ); 2754 } 2755 2756 /** 2757 * Output the approve link of the topic. 2758 * 2759 * @since 2.6.0 bbPress (r5504) 2760 * 2761 * @param array $args See {@link bbp_get_topic_approve_link()}. 2762 */ 2763 function bbp_topic_approve_link( $args = array() ) { 2764 echo bbp_get_topic_approve_link( $args ); 2765 } 2766 2767 /** 2768 * Return the approve link of the topic. 2769 * 2770 * @since 2.6.0 bbPress (r5504) 2771 * 2772 * @param array $args This function supports these args: 2773 * - id: Optional. Topic id 2774 * - link_before: Before the link 2775 * - link_after: After the link 2776 * - sep: Separator between links 2777 * - approve_text: Approve text 2778 * - unapprove_text: Unapprove text 2779 * @return string Topic approve link. 2780 */ 2781 function bbp_get_topic_approve_link( $args = array() ) { 2782 2783 // Parse arguments against default values 2784 $r = bbp_parse_args( 2785 $args, 2786 array( 2787 'id' => 0, 2788 'link_before' => '', 2789 'link_after' => '', 2790 'sep' => ' | ', 2791 'approve_text' => esc_html_x( 'Approve', 'Approve the topic', 'bbpress' ), 2792 'unapprove_text' => esc_html_x( 'Unapprove', 'Unapprove the topic', 'bbpress' ) 2793 ), 2794 'get_topic_approve_link' 2795 ); 2796 2797 // Get topic 2798 $topic = bbp_get_topic( $r['id'] ); 2799 2800 // Bail if no topic or current user cannot moderate 2801 if ( empty( $topic ) || ! current_user_can( 'moderate', $topic->ID ) ) { 2802 return; 2803 } 2804 2805 $display = bbp_is_topic_pending( $topic->ID ) ? $r['approve_text'] : $r['unapprove_text']; 2806 $uri = add_query_arg( 2807 array( 2808 'action' => 'bbp_toggle_topic_approve', 2809 'topic_id' => $topic->ID 2810 ) 2811 ); 2812 $uri = wp_nonce_url( $uri, 'approve-topic_' . $topic->ID ); 2813 $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-approve-link">' . $display . '</a>' . $r['link_after']; 2814 2815 // Filter & return 2816 return apply_filters( 'bbp_get_topic_approve_link', $retval, $r, $args ); 2817 } 2818 2819 /** 2820 * Output the stick link of the topic. 2821 * 2822 * @since 2.0.0 bbPress (r2754) 2823 * 2824 * @param array $args See {@link bbp_get_topic_stick_link()}. 2825 */ 2826 function bbp_topic_stick_link( $args = array() ) { 2827 echo bbp_get_topic_stick_link( $args ); 2828 } 2829 2830 /** 2831 * Return the stick link of the topic. 2832 * 2833 * @since 2.0.0 bbPress (r2754) 2834 * 2835 * @param array $args This function supports these args: 2836 * - id: Optional. Topic id 2837 * - link_before: Before the link 2838 * - link_after: After the link 2839 * - stick_text: Stick text 2840 * - unstick_text: Unstick text 2841 * - super_text: Stick to front text 2842 * 2843 * @return string Topic stick link. 2844 */ 2845 function bbp_get_topic_stick_link( $args = array() ) { 2846 2847 // Parse arguments against default values 2848 $r = bbp_parse_args( 2849 $args, 2850 array( 2851 'id' => 0, 2852 'link_before' => '', 2853 'link_after' => '', 2854 'stick_text' => esc_html__( 'Stick', 'bbpress' ), 2855 'unstick_text' => esc_html__( 'Unstick', 'bbpress' ), 2856 'super_text' => esc_html__( '(to front)', 'bbpress' ), 2857 ), 2858 'get_topic_stick_link' 2859 ); 2860 2861 // Get topic 2862 $topic = bbp_get_topic( $r['id'] ); 2863 2864 // Bail if no topic or current user cannot moderate 2865 if ( empty( $topic ) || ! current_user_can( 'moderate', $topic->ID ) ) { 2866 return; 2867 } 2868 2869 $is_sticky = bbp_is_topic_sticky( $topic->ID ); 2870 2871 $stick_uri = add_query_arg( 2872 array( 2873 'action' => 'bbp_toggle_topic_stick', 2874 'topic_id' => $topic->ID 2875 ) 2876 ); 2877 $stick_uri = wp_nonce_url( $stick_uri, 'stick-topic_' . $topic->ID ); 2878 2879 $stick_display = ( true === $is_sticky ) 2880 ? $r['unstick_text'] 2881 : $r['stick_text']; 2882 $stick_display = '<a href="' . esc_url( $stick_uri ) . '" class="bbp-topic-sticky-link">' . $stick_display . '</a>'; 2883 2884 if ( empty( $is_sticky ) ) { 2885 $super_uri = add_query_arg( 2688 2886 array( 2689 'id' => 0, 2690 'link_before' => '', 2691 'link_after' => '', 2692 'sep' => ' | ', 2693 'close_text' => esc_html_x( 'Close', 'Close the topic', 'bbpress' ), 2694 'open_text' => esc_html_x( 'Open', 'Open the topic', 'bbpress' ) 2695 ), 2696 'get_topic_close_link' 2697 ); 2698 2699 // Get topic 2700 $topic = bbp_get_topic( $r['id'] ); 2701 2702 // Bail if no topic or current user cannot moderate 2703 if ( empty( $topic ) || ! current_user_can( 'moderate', $topic->ID ) ) { 2704 return; 2705 } 2706 2707 $display = bbp_is_topic_open( $topic->ID ) ? $r['close_text'] : $r['open_text']; 2708 $uri = add_query_arg( 2709 array( 2710 'action' => 'bbp_toggle_topic_close', 2711 'topic_id' => $topic->ID 2887 'action' => 'bbp_toggle_topic_stick', 2888 'topic_id' => $topic->ID, 2889 'super' => 1 2712 2890 ) 2713 2891 ); 2714 $uri = wp_nonce_url( $uri, 'close-topic_' . $topic->ID ); 2715 $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-close-link">' . $display . '</a>' . $r['link_after']; 2716 2717 // Filter & return 2718 return apply_filters( 'bbp_get_topic_close_link', $retval, $r, $args ); 2719 } 2720 2721 /** 2722 * Output the approve link of the topic 2723 * 2724 * @since 2.6.0 bbPress (r5504) 2725 * 2726 * @param array $args See {@link bbp_get_topic_approve_link()} 2727 */ 2728 function bbp_topic_approve_link( $args = array() ) { 2729 echo bbp_get_topic_approve_link( $args ); 2730 } 2731 2732 /** 2733 * Return the approve link of the topic 2734 * 2735 * @since 2.6.0 bbPress (r5504) 2736 * 2737 * @param array $args This function supports these args: 2738 * - id: Optional. Topic id 2739 * - link_before: Before the link 2740 * - link_after: After the link 2741 * - sep: Separator between links 2742 * - approve_text: Approve text 2743 * - unapprove_text: Unapprove text 2744 * @return string Topic approve link 2745 */ 2746 function bbp_get_topic_approve_link( $args = array() ) { 2747 2748 // Parse arguments against default values 2749 $r = bbp_parse_args( 2750 $args, 2751 array( 2752 'id' => 0, 2753 'link_before' => '', 2754 'link_after' => '', 2755 'sep' => ' | ', 2756 'approve_text' => esc_html_x( 'Approve', 'Approve the topic', 'bbpress' ), 2757 'unapprove_text' => esc_html_x( 'Unapprove', 'Unapprove the topic', 'bbpress' ) 2758 ), 2759 'get_topic_approve_link' 2760 ); 2761 2762 // Get topic 2763 $topic = bbp_get_topic( $r['id'] ); 2764 2765 // Bail if no topic or current user cannot moderate 2766 if ( empty( $topic ) || ! current_user_can( 'moderate', $topic->ID ) ) { 2767 return; 2768 } 2769 2770 $display = bbp_is_topic_pending( $topic->ID ) ? $r['approve_text'] : $r['unapprove_text']; 2771 $uri = add_query_arg( 2772 array( 2773 'action' => 'bbp_toggle_topic_approve', 2774 'topic_id' => $topic->ID 2775 ) 2776 ); 2777 $uri = wp_nonce_url( $uri, 'approve-topic_' . $topic->ID ); 2778 $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-approve-link">' . $display . '</a>' . $r['link_after']; 2779 2780 // Filter & return 2781 return apply_filters( 'bbp_get_topic_approve_link', $retval, $r, $args ); 2782 } 2783 2784 /** 2785 * Output the stick link of the topic 2786 * 2787 * @since 2.0.0 bbPress (r2754) 2788 * 2789 * @param array $args See {@link bbp_get_topic_stick_link()} 2790 */ 2791 function bbp_topic_stick_link( $args = array() ) { 2792 echo bbp_get_topic_stick_link( $args ); 2793 } 2794 2795 /** 2796 * Return the stick link of the topic 2797 * 2798 * @since 2.0.0 bbPress (r2754) 2799 * 2800 * @param array $args This function supports these args: 2801 * - id: Optional. Topic id 2802 * - link_before: Before the link 2803 * - link_after: After the link 2804 * - stick_text: Stick text 2805 * - unstick_text: Unstick text 2806 * - super_text: Stick to front text 2807 * 2808 * @return string Topic stick link 2809 */ 2810 function bbp_get_topic_stick_link( $args = array() ) { 2811 2812 // Parse arguments against default values 2813 $r = bbp_parse_args( 2814 $args, 2815 array( 2816 'id' => 0, 2817 'link_before' => '', 2818 'link_after' => '', 2819 'stick_text' => esc_html__( 'Stick', 'bbpress' ), 2820 'unstick_text' => esc_html__( 'Unstick', 'bbpress' ), 2821 'super_text' => esc_html__( '(to front)', 'bbpress' ), 2822 ), 2823 'get_topic_stick_link' 2824 ); 2825 2826 // Get topic 2827 $topic = bbp_get_topic( $r['id'] ); 2828 2829 // Bail if no topic or current user cannot moderate 2830 if ( empty( $topic ) || ! current_user_can( 'moderate', $topic->ID ) ) { 2831 return; 2832 } 2833 2834 $is_sticky = bbp_is_topic_sticky( $topic->ID ); 2835 2836 $stick_uri = add_query_arg( 2837 array( 2838 'action' => 'bbp_toggle_topic_stick', 2839 'topic_id' => $topic->ID 2840 ) 2841 ); 2842 $stick_uri = wp_nonce_url( $stick_uri, 'stick-topic_' . $topic->ID ); 2843 2844 $stick_display = ( true === $is_sticky ) 2845 ? $r['unstick_text'] 2846 : $r['stick_text']; 2847 $stick_display = '<a href="' . esc_url( $stick_uri ) . '" class="bbp-topic-sticky-link">' . $stick_display . '</a>'; 2848 2849 if ( empty( $is_sticky ) ) { 2850 $super_uri = add_query_arg( 2851 array( 2852 'action' => 'bbp_toggle_topic_stick', 2853 'topic_id' => $topic->ID, 2854 'super' => 1 2855 ) 2856 ); 2857 $super_uri = wp_nonce_url( $super_uri, 'stick-topic_' . $topic->ID ); 2858 2859 $super_display = ' <a href="' . esc_url( $super_uri ) . '" class="bbp-topic-super-sticky-link">' . $r['super_text'] . '</a>'; 2860 } else { 2861 $super_display = ''; 2862 } 2863 2864 // Combine the HTML into 1 string 2865 $retval = $r['link_before'] . $stick_display . $super_display . $r['link_after']; 2866 2867 // Filter & return 2868 return apply_filters( 'bbp_get_topic_stick_link', $retval, $r, $args ); 2869 } 2870 2871 /** 2872 * Output the merge link of the topic 2892 $super_uri = wp_nonce_url( $super_uri, 'stick-topic_' . $topic->ID ); 2893 2894 $super_display = ' <a href="' . esc_url( $super_uri ) . '" class="bbp-topic-super-sticky-link">' . $r['super_text'] . '</a>'; 2895 } else { 2896 $super_display = ''; 2897 } 2898 2899 // Combine the HTML into 1 string 2900 $retval = $r['link_before'] . $stick_display . $super_display . $r['link_after']; 2901 2902 // Filter & return 2903 return apply_filters( 'bbp_get_topic_stick_link', $retval, $r, $args ); 2904 } 2905 2906 /** 2907 * Output the merge link of the topic. 2873 2908 * 2874 2909 * @since 2.0.0 bbPress (r2756) … … 2880 2915 } 2881 2916 2882 /**2883 * Return the merge link of the topic 2884 *2885 * @since 2.0.0 bbPress (r2756)2886 *2887 * @param array $args This function supports these args:2888 * - id: Optional. Topic id2889 * - link_before: Before the link2890 * - link_after: After the link2891 * - merge_text: Merge text2892 *2893 * @return string Topic merge link 2894 */2895 function bbp_get_topic_merge_link( $args = array() ) {2896 2897 // Parse arguments against default values2898 $r = bbp_parse_args(2899 $args,2900 array(2901 'id' => 0,2902 'link_before' => '',2903 'link_after' => '',2904 'merge_text' => esc_html__( 'Merge', 'bbpress' ),2905 ),2906 'get_topic_merge_link'2907 );2908 2909 // Get topic2910 $topic = bbp_get_topic( $r['id'] );2911 2912 // Bail if no topic or current user cannot moderate2913 if ( empty( $topic ) || ! current_user_can( 'moderate', $topic->ID ) ) {2914 return;2915 }2916 2917 $query = array( 'action' => 'merge' );2918 $uri = add_query_arg( $query, bbp_get_topic_edit_url( $topic->ID ) );2919 $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-merge-link">' . $r['merge_text'] . '</a>' . $r['link_after'];2920 2921 // Filter & return2922 return apply_filters( 'bbp_get_topic_merge_link', $retval, $r, $args );2923 }2924 2925 /** 2926 * Output the spam link of the topic 2917 /** 2918 * Return the merge link of the topic. 2919 * 2920 * @since 2.0.0 bbPress (r2756) 2921 * 2922 * @param array $args This function supports these args: 2923 * - id: Optional. Topic id 2924 * - link_before: Before the link 2925 * - link_after: After the link 2926 * - merge_text: Merge text 2927 * 2928 * @return string Topic merge link. 2929 */ 2930 function bbp_get_topic_merge_link( $args = array() ) { 2931 2932 // Parse arguments against default values 2933 $r = bbp_parse_args( 2934 $args, 2935 array( 2936 'id' => 0, 2937 'link_before' => '', 2938 'link_after' => '', 2939 'merge_text' => esc_html__( 'Merge', 'bbpress' ), 2940 ), 2941 'get_topic_merge_link' 2942 ); 2943 2944 // Get topic 2945 $topic = bbp_get_topic( $r['id'] ); 2946 2947 // Bail if no topic or current user cannot moderate 2948 if ( empty( $topic ) || ! current_user_can( 'moderate', $topic->ID ) ) { 2949 return; 2950 } 2951 2952 $query = array( 'action' => 'merge' ); 2953 $uri = add_query_arg( $query, bbp_get_topic_edit_url( $topic->ID ) ); 2954 $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-merge-link">' . $r['merge_text'] . '</a>' . $r['link_after']; 2955 2956 // Filter & return 2957 return apply_filters( 'bbp_get_topic_merge_link', $retval, $r, $args ); 2958 } 2959 2960 /** 2961 * Output the spam link of the topic. 2927 2962 * 2928 2963 * @since 2.0.0 bbPress (r2727) 2929 2964 * 2930 * @param array $args See {@link bbp_get_topic_spam_link()} 2965 * @param array $args See {@link bbp_get_topic_spam_link()}. 2931 2966 */ 2932 2967 function bbp_topic_spam_link( $args = array() ) { … … 2934 2969 } 2935 2970 2936 /**2937 * Return the spam link of the topic 2938 *2939 * @since 2.0.0 bbPress (r2727)2940 *2941 * @param array $args This function supports these args:2942 * - id: Optional. Topic id2943 * - link_before: Before the link2944 * - link_after: After the link2945 * - spam_text: Spam text2946 * - unspam_text: Unspam text2947 *2948 * @return string Topic spam link 2949 */2950 function bbp_get_topic_spam_link( $args = array() ) {2951 2952 // Parse arguments against default values2953 $r = bbp_parse_args(2954 $args,2955 array(2956 'id' => 0,2957 'link_before' => '',2958 'link_after' => '',2959 'sep' => ' | ',2960 'spam_text' => esc_html__( 'Spam', 'bbpress' ),2961 'unspam_text' => esc_html__( 'Unspam', 'bbpress' )2962 ),2963 'get_topic_spam_link'2964 );2965 2966 $topic = bbp_get_topic( $r['id'] );2967 2968 if ( empty( $topic ) || ! current_user_can( 'moderate', $topic->ID ) ) {2969 return;2970 }2971 2972 $display = bbp_is_topic_spam( $topic->ID )2973 ? $r['unspam_text']2974 : $r['spam_text'];2975 2976 $uri = add_query_arg(2977 array(2978 'action' => 'bbp_toggle_topic_spam',2979 'topic_id' => $topic->ID2980 )2981 );2982 2983 $uri = wp_nonce_url( $uri, 'spam-topic_' . $topic->ID );2984 $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-spam-link">' . $display . '</a>' . $r['link_after'];2985 2986 // Filter & return2987 return apply_filters( 'bbp_get_topic_spam_link', $retval, $r, $args );2988 }2989 2990 /** 2991 * Output the link to go directly to the reply form 2971 /** 2972 * Return the spam link of the topic. 2973 * 2974 * @since 2.0.0 bbPress (r2727) 2975 * 2976 * @param array $args This function supports these args: 2977 * - id: Optional. Topic id 2978 * - link_before: Before the link 2979 * - link_after: After the link 2980 * - spam_text: Spam text 2981 * - unspam_text: Unspam text 2982 * 2983 * @return string Topic spam link. 2984 */ 2985 function bbp_get_topic_spam_link( $args = array() ) { 2986 2987 // Parse arguments against default values 2988 $r = bbp_parse_args( 2989 $args, 2990 array( 2991 'id' => 0, 2992 'link_before' => '', 2993 'link_after' => '', 2994 'sep' => ' | ', 2995 'spam_text' => esc_html__( 'Spam', 'bbpress' ), 2996 'unspam_text' => esc_html__( 'Unspam', 'bbpress' ) 2997 ), 2998 'get_topic_spam_link' 2999 ); 3000 3001 $topic = bbp_get_topic( $r['id'] ); 3002 3003 if ( empty( $topic ) || ! current_user_can( 'moderate', $topic->ID ) ) { 3004 return; 3005 } 3006 3007 $display = bbp_is_topic_spam( $topic->ID ) 3008 ? $r['unspam_text'] 3009 : $r['spam_text']; 3010 3011 $uri = add_query_arg( 3012 array( 3013 'action' => 'bbp_toggle_topic_spam', 3014 'topic_id' => $topic->ID 3015 ) 3016 ); 3017 3018 $uri = wp_nonce_url( $uri, 'spam-topic_' . $topic->ID ); 3019 $retval = $r['link_before'] . '<a href="' . esc_url( $uri ) . '" class="bbp-topic-spam-link">' . $display . '</a>' . $r['link_after']; 3020 3021 // Filter & return 3022 return apply_filters( 'bbp_get_topic_spam_link', $retval, $r, $args ); 3023 } 3024 3025 /** 3026 * Output the link to go directly to the reply form. 2992 3027 * 2993 3028 * @since 2.4.0 bbPress (r4966) … … 2999 3034 } 3000 3035 3001 /**3002 * Return the link to go directly to the reply form 3003 *3004 * @since 2.4.0 bbPress (r4966)3005 *3006 * @param array $args Arguments 3007 *3008 * @return string Link for a reply to a topic 3009 */3010 function bbp_get_topic_reply_link( $args = array() ) {3011 3012 // Parse arguments against default values3013 $r = bbp_parse_args(3014 $args,3015 array(3016 'id' => 0,3017 'link_before' => '',3018 'link_after' => '',3019 'reply_text' => esc_html_x( 'Reply', 'verb', 'bbpress' ),3020 'add_below' => 'post',3021 'respond_id' => 'new-reply-' . bbp_get_topic_id(),3022 ),3023 'get_topic_reply_link'3024 );3025 3026 // Get the topic to use it's ID and post_parent3027 $topic = bbp_get_topic( $r['id'] );3028 3029 // Bail if no topic or user cannot reply3030 if ( empty( $topic ) || bbp_is_single_reply() || ! bbp_current_user_can_access_create_reply_form() ) {3031 return;3032 }3033 3034 // Only add onclick if replies are threaded3035 $onclick = bbp_thread_replies()3036 ? ' onclick="return addReply.cancelForm();"'3037 : '';3038 3039 // Add $uri to the array, to be passed through the filter3040 $r['uri'] = remove_query_arg( array( 'bbp_reply_to', '_wpnonce' ) ) . '#new-post';3041 $retval = $r['link_before'] . '<a role="button" href="' . esc_url( $r['uri'] ) . '" class="bbp-topic-reply-link"' . $onclick . '>' . $r['reply_text'] . '</a>' . $r['link_after'];3042 3043 // Filter & return3044 return apply_filters( 'bbp_get_topic_reply_link', $retval, $r, $args );3045 }3036 /** 3037 * Return the link to go directly to the reply form. 3038 * 3039 * @since 2.4.0 bbPress (r4966) 3040 * 3041 * @param array $args Arguments. 3042 * 3043 * @return string Link for a reply to a topic. 3044 */ 3045 function bbp_get_topic_reply_link( $args = array() ) { 3046 3047 // Parse arguments against default values 3048 $r = bbp_parse_args( 3049 $args, 3050 array( 3051 'id' => 0, 3052 'link_before' => '', 3053 'link_after' => '', 3054 'reply_text' => esc_html_x( 'Reply', 'verb', 'bbpress' ), 3055 'add_below' => 'post', 3056 'respond_id' => 'new-reply-' . bbp_get_topic_id(), 3057 ), 3058 'get_topic_reply_link' 3059 ); 3060 3061 // Get the topic to use it's ID and post_parent 3062 $topic = bbp_get_topic( $r['id'] ); 3063 3064 // Bail if no topic or user cannot reply 3065 if ( empty( $topic ) || bbp_is_single_reply() || ! bbp_current_user_can_access_create_reply_form() ) { 3066 return; 3067 } 3068 3069 // Only add onclick if replies are threaded 3070 $onclick = bbp_thread_replies() 3071 ? ' onclick="return addReply.cancelForm();"' 3072 : ''; 3073 3074 // Add $uri to the array, to be passed through the filter 3075 $r['uri'] = remove_query_arg( array( 'bbp_reply_to', '_wpnonce' ) ) . '#new-post'; 3076 $retval = $r['link_before'] . '<a role="button" href="' . esc_url( $r['uri'] ) . '" class="bbp-topic-reply-link"' . $onclick . '>' . $r['reply_text'] . '</a>' . $r['link_after']; 3077 3078 // Filter & return 3079 return apply_filters( 'bbp_get_topic_reply_link', $retval, $r, $args ); 3080 } 3046 3081 3047 3082 /** Topic Pagination **********************************************************/ 3048 3083 3049 3084 /** 3050 * Return the base URL used inside of pagination links 3085 * Return the base URL used inside of pagination links. 3051 3086 * 3052 3087 * @since 2.6.0 bbPress (r6402) 3053 3088 * 3054 * @param int $forum_id 3089 * @param int $forum_id Forum id. 3055 3090 * @return string 3056 3091 */ … … 3118 3153 3119 3154 /** 3120 * Output the pagination count 3155 * Output the pagination count. 3121 3156 * 3122 3157 * The results are unescaped by design, to allow them to be filtered freely via … … 3128 3163 echo bbp_get_forum_pagination_count(); 3129 3164 } 3130 /** 3131 * Return the pagination count 3132 * 3133 * @since 2.0.0 bbPress (r2519) 3134 * 3135 * @return string Forum Pagination count 3136 */ 3137 function bbp_get_forum_pagination_count() { 3138 $bbp = bbpress(); 3139 3140 // Define local variable(s) 3141 $retstr = ''; 3142 3143 // Topic query exists 3144 if ( ! empty( $bbp->topic_query ) ) { 3145 3146 // Set pagination values 3147 $count_int = intval( $bbp->topic_query->post_count ); 3148 $start_num = intval( ( $bbp->topic_query->paged - 1 ) * $bbp->topic_query->posts_per_page ) + 1; 3149 $total_int = ! empty( $bbp->topic_query->found_posts ) 3150 ? (int) $bbp->topic_query->found_posts 3151 : $count_int; 3152 3153 // Format numbers for display 3154 $count_num = bbp_number_format( $count_int ); 3155 $from_num = bbp_number_format( $start_num ); 3156 $total = bbp_number_format( $total_int ); 3157 $to_num = bbp_number_format( ( $start_num + ( $bbp->topic_query->posts_per_page - 1 ) > $bbp->topic_query->found_posts ) 3158 ? $bbp->topic_query->found_posts 3159 : $start_num + ( $bbp->topic_query->posts_per_page - 1 ) 3160 ); 3161 3162 // Several topics in a forum with a single page 3163 if ( empty( $to_num ) ) { 3164 /* translators: %1$s: Total number of topics */ 3165 $retstr = sprintf( _n( 'Viewing %1$s topic', 'Viewing %1$s topics', $total_int, 'bbpress' ), $total ); 3166 3167 // Several topics in a forum with several pages 3168 } else { 3169 $retstr = sprintf( _n( 'Viewing topic %2$s (of %4$s total)', 'Viewing %1$s topics - %2$s through %3$s (of %4$s total)', $total_int, 'bbpress' ), $count_num, $from_num, $to_num, $total ); //phpcs:ignore 3170 } 3171 3172 // Escape results of _n() 3173 $retstr = esc_html( $retstr ); 3165 3166 /** 3167 * Return the pagination count. 3168 * 3169 * @since 2.0.0 bbPress (r2519) 3170 * 3171 * @return string Forum Pagination count. 3172 */ 3173 function bbp_get_forum_pagination_count() { 3174 $bbp = bbpress(); 3175 3176 // Define local variable(s) 3177 $retstr = ''; 3178 3179 // Topic query exists 3180 if ( ! empty( $bbp->topic_query ) ) { 3181 3182 // Set pagination values 3183 $count_int = intval( $bbp->topic_query->post_count ); 3184 $start_num = intval( ( $bbp->topic_query->paged - 1 ) * $bbp->topic_query->posts_per_page ) + 1; 3185 $total_int = ! empty( $bbp->topic_query->found_posts ) 3186 ? (int) $bbp->topic_query->found_posts 3187 : $count_int; 3188 3189 // Format numbers for display 3190 $count_num = bbp_number_format( $count_int ); 3191 $from_num = bbp_number_format( $start_num ); 3192 $total = bbp_number_format( $total_int ); 3193 $to_num = bbp_number_format( ( $start_num + ( $bbp->topic_query->posts_per_page - 1 ) > $bbp->topic_query->found_posts ) 3194 ? $bbp->topic_query->found_posts 3195 : $start_num + ( $bbp->topic_query->posts_per_page - 1 ) 3196 ); 3197 3198 // Several topics in a forum with a single page 3199 if ( empty( $to_num ) ) { 3200 /* translators: %1$s: Total number of topics */ 3201 $retstr = sprintf( _n( 'Viewing %1$s topic', 'Viewing %1$s topics', $total_int, 'bbpress' ), $total ); 3202 3203 // Several topics in a forum with several pages 3204 } else { 3205 $retstr = sprintf( _n( 'Viewing topic %2$s (of %4$s total)', 'Viewing %1$s topics - %2$s through %3$s (of %4$s total)', $total_int, 'bbpress' ), $count_num, $from_num, $to_num, $total ); //phpcs:ignore 3174 3206 } 3175 3207 3176 // Filter & return 3177 return apply_filters( 'bbp_get_forum_pagination_count', $retstr ); 3178 } 3179 3180 /** 3181 * Output pagination links 3208 // Escape results of _n() 3209 $retstr = esc_html( $retstr ); 3210 } 3211 3212 // Filter & return 3213 return apply_filters( 'bbp_get_forum_pagination_count', $retstr ); 3214 } 3215 3216 /** 3217 * Output pagination links. 3182 3218 * 3183 3219 * @since 2.0.0 bbPress (r2519) … … 3186 3222 echo bbp_get_forum_pagination_links(); 3187 3223 } 3188 /** 3189 * Return pagination links 3190 * 3191 * @since 2.0.0 bbPress (r2519) 3192 * 3193 * @return string Pagination links 3194 */ 3195 function bbp_get_forum_pagination_links() { 3196 $bbp = bbpress(); 3197 3198 if ( empty( $bbp->topic_query ) ) { 3199 return false; 3200 } 3201 3202 // Filter & return 3203 return apply_filters( 'bbp_get_forum_pagination_links', $bbp->topic_query->pagination_links ); 3204 } 3205 3206 /** 3207 * Displays topic notices 3224 3225 /** 3226 * Return pagination links. 3227 * 3228 * @since 2.0.0 bbPress (r2519) 3229 * 3230 * @return string Pagination links. 3231 */ 3232 function bbp_get_forum_pagination_links() { 3233 $bbp = bbpress(); 3234 3235 if ( empty( $bbp->topic_query ) ) { 3236 return false; 3237 } 3238 3239 // Filter & return 3240 return apply_filters( 'bbp_get_forum_pagination_links', $bbp->topic_query->pagination_links ); 3241 } 3242 3243 /** 3244 * Displays topic notices. 3208 3245 * 3209 3246 * @since 2.0.0 bbPress (r2744) … … 3253 3290 3254 3291 /** 3255 * Displays topic type select box (normal/sticky/super sticky) 3292 * Displays topic type select box (normal/sticky/super sticky). 3256 3293 * 3257 3294 * @since 2.0.0 bbPress (r2784) … … 3270 3307 3271 3308 /** 3272 * Displays topic type select box (normal/sticky/super sticky) 3309 * Displays topic type select box (normal/sticky/super sticky). 3273 3310 * 3274 3311 * @since 2.4.0 bbPress (r5059) … … 3283 3320 echo bbp_get_form_topic_type_dropdown( $args ); 3284 3321 } 3285 /** 3286 * Returns topic type select box (normal/sticky/super sticky) 3287 * 3288 * @since 2.4.0 bbPress (r5059) 3289 * 3290 * @param $args This function supports these arguments: 3291 * - select_id: Select id. Defaults to bbp_stick_topic 3292 * - tab: Deprecated. Tabindex 3293 * - topic_id: Topic id 3294 * - selected: Override the selected option 3295 */ 3296 function bbp_get_form_topic_type_dropdown( $args = array() ) { 3297 3298 // Parse arguments against default values 3299 $r = bbp_parse_args(3300 $args,3301 array(3302 'select_id' => 'bbp_stick_topic',3303 'select_class' => 'bbp_dropdown',3304 'tab' => false,3305 'topic_id' => 0,3306 'selected' => false3307 ),3308 'topic_type_select'3309 );3310 3311 // No specific selected value passed 3312 if ( empty( $r['selected'] ) ) {3313 3314 // Post value is passed 3315 if ( bbp_is_topic_form_post_request() && isset( $_POST[ $r['select_id'] ] ) ) {3316 $r['selected'] = sanitize_key( $_POST[ $r['select_id'] ] );3317 3318 // Edit topic 3319 } elseif ( bbp_is_single_topic() || bbp_is_topic_edit() ) {3320 3321 // Get current topic id 3322 $r['topic_id'] = bbp_get_topic_id( $r['topic_id'] );3323 3324 // Topic is super sticky 3325 if ( bbp_is_topic_super_sticky( $r['topic_id'] ) ) {3326 $r['selected'] = 'super';3327 3328 // Topic is sticky or normal 3329 } else {3330 $r['selected'] = bbp_is_topic_sticky( $r['topic_id'], false )3331 ? 'stick'3332 : 'unstick';3333 }3322 3323 /** 3324 * Returns topic type select box (normal/sticky/super sticky). 3325 * 3326 * @since 2.4.0 bbPress (r5059) 3327 * 3328 * @param $args This function supports these arguments: 3329 * - select_id: Select id. Defaults to bbp_stick_topic 3330 * - tab: Deprecated. Tabindex 3331 * - topic_id: Topic id 3332 * - selected: Override the selected option 3333 */ 3334 function bbp_get_form_topic_type_dropdown( $args = array() ) { 3335 3336 // Parse arguments against default values 3337 $r = bbp_parse_args( 3338 $args, 3339 array( 3340 'select_id' => 'bbp_stick_topic', 3341 'select_class' => 'bbp_dropdown', 3342 'tab' => false, 3343 'topic_id' => 0, 3344 'selected' => false 3345 ), 3346 'topic_type_select' 3347 ); 3348 3349 // No specific selected value passed 3350 if ( empty( $r['selected'] ) ) { 3351 3352 // Post value is passed 3353 if ( bbp_is_topic_form_post_request() && isset( $_POST[ $r['select_id'] ] ) ) { 3354 $r['selected'] = sanitize_key( $_POST[ $r['select_id'] ] ); 3355 3356 // Edit topic 3357 } elseif ( bbp_is_single_topic() || bbp_is_topic_edit() ) { 3358 3359 // Get current topic id 3360 $r['topic_id'] = bbp_get_topic_id( $r['topic_id'] ); 3361 3362 // Topic is super sticky 3363 if ( bbp_is_topic_super_sticky( $r['topic_id'] ) ) { 3364 $r['selected'] = 'super'; 3365 3366 // Topic is sticky or normal 3367 } else { 3368 $r['selected'] = bbp_is_topic_sticky( $r['topic_id'], false ) 3369 ? 'stick' 3370 : 'unstick'; 3334 3371 } 3335 3372 } 3336 3337 // Start an output buffer, we'll finish it after the select loop 3338 ob_start(); ?> 3339 3340 <select name="<?php echo esc_attr( $r['select_id'] ); ?>" id="<?php echo esc_attr( $r['select_id'] ); ?>_select" class="<?php echo esc_attr( $r['select_class'] ); ?>"<?php bbp_tab_index_attribute( $r['tab'] ); ?>> 3341 3342 <?php foreach ( bbp_get_topic_types( $r['topic_id'] ) as $key => $label ) : ?> 3343 3344 <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $r['selected'] ); ?>><?php echo esc_html( $label ); ?></option> 3345 3346 <?php endforeach; ?> 3347 3348 </select> 3349 3350 <?php 3351 3352 // Filter & return 3353 return apply_filters( 'bbp_get_form_topic_type_dropdown', ob_get_clean(), $r, $args ); 3354 } 3355 3356 /** 3357 * Output value topic status dropdown 3373 } 3374 3375 // Start an output buffer, we'll finish it after the select loop 3376 ob_start(); ?> 3377 3378 <select name="<?php echo esc_attr( $r['select_id'] ); ?>" id="<?php echo esc_attr( $r['select_id'] ); ?>_select" class="<?php echo esc_attr( $r['select_class'] ); ?>"<?php bbp_tab_index_attribute( $r['tab'] ); ?>> 3379 3380 <?php foreach ( bbp_get_topic_types( $r['topic_id'] ) as $key => $label ) : ?> 3381 3382 <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $r['selected'] ); ?>><?php echo esc_html( $label ); ?></option> 3383 3384 <?php endforeach; ?> 3385 3386 </select> 3387 3388 <?php 3389 3390 // Filter & return 3391 return apply_filters( 'bbp_get_form_topic_type_dropdown', ob_get_clean(), $r, $args ); 3392 } 3393 3394 /** 3395 * Output value topic status dropdown. 3358 3396 * 3359 3397 * @since 2.4.0 bbPress (r5059) … … 3368 3406 echo bbp_get_form_topic_status_dropdown( $args ); 3369 3407 } 3370 /** 3371 * Returns topic status dropdown 3372 * 3373 * This dropdown is only intended to be seen by users with the 'moderate' 3374 * capability. Because of this, no additional capability checks are performed 3375 * within this function to check available topic statuses. 3376 * 3377 * @since 2.4.0 bbPress (r5059) 3378 * 3379 * @param $args This function supports these arguments: 3380 * - select_id: Select id. Defaults to bbp_topic_status 3381 * - tab: Deprecated. Tabindex 3382 * - topic_id: Topic id 3383 * - selected: Override the selected option 3384 */ 3385 function bbp_get_form_topic_status_dropdown( $args = array() ) { 3386 3387 // Parse arguments against default values 3388 $r = bbp_parse_args(3389 $args,3390 array(3391 'select_id' => 'bbp_topic_status',3392 'select_class' => 'bbp_dropdown',3393 'tab' => false,3394 'topic_id' => 0,3395 'selected' => false3396 ),3397 'topic_open_close_select'3398 );3399 3400 // No specific selected value passed 3401 if ( empty( $r['selected'] ) ) {3402 3403 // Post value is passed 3404 if ( bbp_is_topic_form_post_request() && isset( $_POST[ $r['select_id'] ] ) ) {3405 $r['selected'] = sanitize_key( $_POST[ $r['select_id'] ] );3406 3407 // Edit topic 3408 } elseif ( bbp_is_topic_edit() ) {3409 $r['topic_id'] = bbp_get_topic_id( $r['topic_id'] );3410 $r['selected'] = bbp_get_topic_status( $r['topic_id'] );3411 3412 // New topic 3413 } else {3414 $r['selected'] = bbp_get_public_status_id();3415 }3408 3409 /** 3410 * Returns topic status dropdown. 3411 * 3412 * This dropdown is only intended to be seen by users with the 'moderate' 3413 * capability. Because of this, no additional capability checks are performed 3414 * within this function to check available topic statuses. 3415 * 3416 * @since 2.4.0 bbPress (r5059) 3417 * 3418 * @param $args This function supports these arguments: 3419 * - select_id: Select id. Defaults to bbp_topic_status 3420 * - tab: Deprecated. Tabindex 3421 * - topic_id: Topic id 3422 * - selected: Override the selected option 3423 */ 3424 function bbp_get_form_topic_status_dropdown( $args = array() ) { 3425 3426 // Parse arguments against default values 3427 $r = bbp_parse_args( 3428 $args, 3429 array( 3430 'select_id' => 'bbp_topic_status', 3431 'select_class' => 'bbp_dropdown', 3432 'tab' => false, 3433 'topic_id' => 0, 3434 'selected' => false 3435 ), 3436 'topic_open_close_select' 3437 ); 3438 3439 // No specific selected value passed 3440 if ( empty( $r['selected'] ) ) { 3441 3442 // Post value is passed 3443 if ( bbp_is_topic_form_post_request() && isset( $_POST[ $r['select_id'] ] ) ) { 3444 $r['selected'] = sanitize_key( $_POST[ $r['select_id'] ] ); 3445 3446 // Edit topic 3447 } elseif ( bbp_is_topic_edit() ) { 3448 $r['topic_id'] = bbp_get_topic_id( $r['topic_id'] ); 3449 $r['selected'] = bbp_get_topic_status( $r['topic_id'] ); 3450 3451 // New topic 3452 } else { 3453 $r['selected'] = bbp_get_public_status_id(); 3416 3454 } 3417 3418 // Start an output buffer, we'll finish it after the select loop 3419 ob_start(); ?> 3420 3421 <select name="<?php echo esc_attr( $r['select_id'] ); ?>" id="<?php echo esc_attr( $r['select_id'] ); ?>_select" class="<?php echo esc_attr( $r['select_class'] ); ?>"<?php bbp_tab_index_attribute( $r['tab'] ); ?>> 3422 3423 <?php foreach ( bbp_get_topic_statuses( $r['topic_id'] ) as $key => $label ) : ?> 3424 3425 <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $r['selected'] ); ?>><?php echo esc_html( $label ); ?></option> 3426 3427 <?php endforeach; ?> 3428 3429 </select> 3430 3431 <?php 3432 3433 // Filter & return 3434 return apply_filters( 'bbp_get_form_topic_status_dropdown', ob_get_clean(), $r, $args ); 3435 } 3455 } 3456 3457 // Start an output buffer, we'll finish it after the select loop 3458 ob_start(); ?> 3459 3460 <select name="<?php echo esc_attr( $r['select_id'] ); ?>" id="<?php echo esc_attr( $r['select_id'] ); ?>_select" class="<?php echo esc_attr( $r['select_class'] ); ?>"<?php bbp_tab_index_attribute( $r['tab'] ); ?>> 3461 3462 <?php foreach ( bbp_get_topic_statuses( $r['topic_id'] ) as $key => $label ) : ?> 3463 3464 <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $r['selected'] ); ?>><?php echo esc_html( $label ); ?></option> 3465 3466 <?php endforeach; ?> 3467 3468 </select> 3469 3470 <?php 3471 3472 // Filter & return 3473 return apply_filters( 'bbp_get_form_topic_status_dropdown', ob_get_clean(), $r, $args ); 3474 } 3436 3475 3437 3476 /** Single Topic **************************************************************/ … … 3448 3487 echo bbp_get_single_topic_description( $args ); 3449 3488 } 3450 /** 3451 * Return a fancy description of the current topic, including total topics, 3452 * total replies, and last activity. 3453 * 3454 * @since 2.0.0 bbPress (r2860) 3455 * 3456 * @param array $args This function supports these arguments: 3457 * - topic_id: Topic id 3458 * - before: Before the text 3459 * - after: After the text 3460 * - size: Size of the avatar 3461 * @return string Filtered topic description 3462 */ 3463 function bbp_get_single_topic_description( $args = array() ) { 3464 3465 // Parse arguments against default values 3466 $r = bbp_parse_args( 3467 $args, 3489 3490 /** 3491 * Return a fancy description of the current topic, including total topics, 3492 * total replies, and last activity. 3493 * 3494 * @since 2.0.0 bbPress (r2860) 3495 * 3496 * @param array $args This function supports these arguments: 3497 * - topic_id: Topic id 3498 * - before: Before the text 3499 * - after: After the text 3500 * - size: Size of the avatar 3501 * @return string Filtered topic description. 3502 */ 3503 function bbp_get_single_topic_description( $args = array() ) { 3504 3505 // Parse arguments against default values 3506 $r = bbp_parse_args( 3507 $args, 3508 array( 3509 'topic_id' => 0, 3510 'before' => '<div class="bbp-template-notice info"><ul><li class="bbp-topic-description">', 3511 'after' => '</li></ul></div>', 3512 'size' => 14 3513 ), 3514 'get_single_topic_description' 3515 ); 3516 3517 // Validate topic_id 3518 $topic_id = bbp_get_topic_id( $r['topic_id'] ); 3519 3520 // Unhook the 'view all' query var adder 3521 remove_filter( 'bbp_get_topic_permalink', 'bbp_add_view_all' ); 3522 3523 // Build the topic description 3524 $vc_int = bbp_get_topic_voice_count ( $topic_id, true ); 3525 $voice_count = bbp_get_topic_voice_count ( $topic_id, false ); 3526 $reply_count = bbp_get_topic_replies_link ( $topic_id ); 3527 $time_since = bbp_get_topic_freshness_link( $topic_id ); 3528 3529 // Singular/Plural 3530 /* translators: %s: Number of voices/participants */ 3531 $voice_count = sprintf( _n( '%s voice', '%s voices', $vc_int, 'bbpress' ), $voice_count ); 3532 3533 // Topic has activity (could be from reply or topic author) 3534 $last_active = bbp_get_topic_last_active_id( $topic_id ); 3535 if ( ! empty( $last_active ) ) { 3536 3537 // Last-updated-by should always exist if last-active does 3538 $last_updated_by = bbp_get_author_link( 3468 3539 array( 3469 'topic_id' => 0, 3470 'before' => '<div class="bbp-template-notice info"><ul><li class="bbp-topic-description">', 3471 'after' => '</li></ul></div>', 3472 'size' => 14 3473 ), 3474 'get_single_topic_description' 3540 'post_id' => $last_active, 3541 'size' => $r['size'] 3542 ) 3475 3543 ); 3476 3544 3477 // Validate topic_id 3478 $topic_id = bbp_get_topic_id( $r['topic_id'] ); 3479 3480 // Unhook the 'view all' query var adder 3481 remove_filter( 'bbp_get_topic_permalink', 'bbp_add_view_all' ); 3482 3483 // Build the topic description 3484 $vc_int = bbp_get_topic_voice_count ( $topic_id, true ); 3485 $voice_count = bbp_get_topic_voice_count ( $topic_id, false ); 3486 $reply_count = bbp_get_topic_replies_link ( $topic_id ); 3487 $time_since = bbp_get_topic_freshness_link( $topic_id ); 3488 3489 // Singular/Plural 3490 /* translators: %s: Number of voices/participants */ 3491 $voice_count = sprintf( _n( '%s voice', '%s voices', $vc_int, 'bbpress' ), $voice_count ); 3492 3493 // Topic has activity (could be from reply or topic author) 3494 $last_active = bbp_get_topic_last_active_id( $topic_id ); 3495 if ( ! empty( $last_active ) ) { 3496 3497 // Last-updated-by should always exist if last-active does 3498 $last_updated_by = bbp_get_author_link( 3499 array( 3500 'post_id' => $last_active, 3501 'size' => $r['size'] 3502 ) 3503 ); 3504 3505 // Voice count is non-zero (registered users engaged) 3506 if ( ! empty( $vc_int ) ) { 3507 /* translators: 1: Reply count, 2: Voice count, 3: Last updated time, 4: Last updated by */ 3508 $retstr = sprintf( esc_html__( 'This topic has %1$s, %2$s, and was last updated %3$s by %4$s.', 'bbpress' ), $reply_count, $voice_count, $time_since, $last_updated_by ); 3509 3510 // Voice count is zero (anonymous users only) 3511 } else { 3512 /* translators: 1: Last updated time, 2: Last updated by */ 3513 $retstr = sprintf( esc_html__( 'This topic was last updated %1$s by %2$s.', 'bbpress' ), $time_since, $last_updated_by ); 3514 } 3515 3516 // Topic has no replies 3517 } elseif ( ! empty( $vc_int ) && ! empty( $reply_count ) ) { 3518 /* translators: 1: Voice count, 2: Reply count */ 3519 $retstr = sprintf( esc_html__( 'This topic has %1$s and %2$s.', 'bbpress' ), $voice_count, $reply_count ); 3520 3521 // Topic has no replies and no voices 3522 } elseif ( empty( $vc_int ) && empty( $reply_count ) ) { 3523 $retstr = esc_html__( 'This topic has no replies.', 'bbpress' ); 3524 3525 // Topic is pending 3526 } elseif ( bbp_get_topic_status( $topic_id ) === bbp_get_pending_status_id() ) { 3527 $retstr = esc_html__( 'This topic is pending moderation.', 'bbpress' ); 3528 3529 // Fallback 3545 // Voice count is non-zero (registered users engaged) 3546 if ( ! empty( $vc_int ) ) { 3547 /* translators: 1: Reply count, 2: Voice count, 3: Last updated time, 4: Last updated by */ 3548 $retstr = sprintf( esc_html__( 'This topic has %1$s, %2$s, and was last updated %3$s by %4$s.', 'bbpress' ), $reply_count, $voice_count, $time_since, $last_updated_by ); 3549 3550 // Voice count is zero (anonymous users only) 3530 3551 } else { 3531 $retstr = esc_html__( 'This topic is empty.', 'bbpress' ); 3552 /* translators: 1: Last updated time, 2: Last updated by */ 3553 $retstr = sprintf( esc_html__( 'This topic was last updated %1$s by %2$s.', 'bbpress' ), $time_since, $last_updated_by ); 3532 3554 } 3533 3555 3534 // Add the 'view all' filter back 3535 add_filter( 'bbp_get_topic_permalink', 'bbp_add_view_all' ); 3536 3537 // Combine the elements together 3538 $retstr = $r['before'] . $retstr . $r['after']; 3539 3540 // Filter & return 3541 return apply_filters( 'bbp_get_single_topic_description', $retstr, $r, $args ); 3542 } 3556 // Topic has no replies 3557 } elseif ( ! empty( $vc_int ) && ! empty( $reply_count ) ) { 3558 /* translators: 1: Voice count, 2: Reply count */ 3559 $retstr = sprintf( esc_html__( 'This topic has %1$s and %2$s.', 'bbpress' ), $voice_count, $reply_count ); 3560 3561 // Topic has no replies and no voices 3562 } elseif ( empty( $vc_int ) && empty( $reply_count ) ) { 3563 $retstr = esc_html__( 'This topic has no replies.', 'bbpress' ); 3564 3565 // Topic is pending 3566 } elseif ( bbp_get_topic_status( $topic_id ) === bbp_get_pending_status_id() ) { 3567 $retstr = esc_html__( 'This topic is pending moderation.', 'bbpress' ); 3568 3569 // Fallback 3570 } else { 3571 $retstr = esc_html__( 'This topic is empty.', 'bbpress' ); 3572 } 3573 3574 // Add the 'view all' filter back 3575 add_filter( 'bbp_get_topic_permalink', 'bbp_add_view_all' ); 3576 3577 // Combine the elements together 3578 $retstr = $r['before'] . $retstr . $r['after']; 3579 3580 // Filter & return 3581 return apply_filters( 'bbp_get_single_topic_description', $retstr, $r, $args ); 3582 } 3543 3583 3544 3584 /** Topic Tags ****************************************************************/ 3545 3585 3546 3586 /** 3547 * Output the unique id of the topic tag taxonomy 3587 * Output the unique id of the topic tag taxonomy. 3548 3588 * 3549 3589 * @since 2.0.0 bbPress (r3348) … … 3552 3592 echo bbp_get_topic_tag_tax_id(); 3553 3593 } 3554 /** 3555 * Return the unique id of the topic tag taxonomy 3556 * 3557 * @since 2.0.0 bbPress (r3348) 3558 * 3559 * @return string The unique topic tag taxonomy 3560 */ 3561 function bbp_get_topic_tag_tax_id() { 3562 3563 // Filter & return 3564 return apply_filters( 'bbp_get_topic_tag_tax_id', bbpress()->topic_tag_tax_id ); 3565 } 3566 3567 /** 3568 * Return array of labels used by the topic-tag taxonomy 3594 3595 /** 3596 * Return the unique id of the topic tag taxonomy. 3597 * 3598 * @since 2.0.0 bbPress (r3348) 3599 * 3600 * @return string The unique topic tag taxonomy. 3601 */ 3602 function bbp_get_topic_tag_tax_id() { 3603 3604 // Filter & return 3605 return apply_filters( 'bbp_get_topic_tag_tax_id', bbpress()->topic_tag_tax_id ); 3606 } 3607 3608 /** 3609 * Return array of labels used by the topic-tag taxonomy. 3569 3610 * 3570 3611 * @since 2.5.0 bbPress (r5129) … … 3605 3646 3606 3647 /** 3607 * Return an array of topic-tag taxonomy rewrite settings 3648 * Return an array of topic-tag taxonomy rewrite settings. 3608 3649 * 3609 3650 * @since 2.5.0 bbPress (r5129) … … 3624 3665 3625 3666 /** 3626 * Output the id of the current tag 3667 * Output the id of the current tag. 3627 3668 * 3628 3669 * @since 2.0.0 bbPress (r3109) 3629 *3630 3670 */ 3631 3671 function bbp_topic_tag_id( $tag = '' ) { 3632 3672 echo bbp_get_topic_tag_id( $tag ); 3633 3673 } 3634 /** 3635 * Return the id of the current tag 3636 * 3637 * @since 2.0.0 bbPress (r3109) 3638 * 3639 * @return string Term Name 3640 */ 3641 function bbp_get_topic_tag_id( $tag = '' ) { 3642 3643 // Get the term 3644 if ( ! empty( $tag ) ) { 3645 $term = get_term_by( 'slug', $tag, bbp_get_topic_tag_tax_id() ); 3646 } else { 3647 $tag = get_query_var( 'term' ); 3648 $term = get_queried_object(); 3649 } 3650 3651 // Get the term ID 3652 $retval = ! empty( $term->term_id ) 3653 ? $term->term_id 3654 : 0; 3655 3656 // Filter & return 3657 return (int) apply_filters( 'bbp_get_topic_tag_id', (int) $retval, $tag, $term ); 3658 } 3659 3660 /** 3661 * Output the name of the current tag 3674 3675 /** 3676 * Return the id of the current tag. 3677 * 3678 * @since 2.0.0 bbPress (r3109) 3679 * 3680 * @return string Term Name. 3681 */ 3682 function bbp_get_topic_tag_id( $tag = '' ) { 3683 3684 // Get the term 3685 if ( ! empty( $tag ) ) { 3686 $term = get_term_by( 'slug', $tag, bbp_get_topic_tag_tax_id() ); 3687 } else { 3688 $tag = get_query_var( 'term' ); 3689 $term = get_queried_object(); 3690 } 3691 3692 // Get the term ID 3693 $retval = ! empty( $term->term_id ) 3694 ? $term->term_id 3695 : 0; 3696 3697 // Filter & return 3698 return (int) apply_filters( 'bbp_get_topic_tag_id', (int) $retval, $tag, $term ); 3699 } 3700 3701 /** 3702 * Output the name of the current tag. 3662 3703 * 3663 3704 * @since 2.0.0 bbPress (r3109) … … 3666 3707 echo bbp_get_topic_tag_name( $tag ); 3667 3708 } 3668 /** 3669 * Return the name of the current tag 3670 * 3671 * @since 2.0.0 bbPress (r3109) 3672 * 3673 * @return string Term Name 3674 */ 3675 function bbp_get_topic_tag_name( $tag = '' ) { 3676 3677 // Get the term 3678 if ( ! empty( $tag ) ) { 3679 $term = get_term_by( 'slug', $tag, bbp_get_topic_tag_tax_id() ); 3680 } else { 3681 $tag = get_query_var( 'term' ); 3682 $term = get_queried_object(); 3683 } 3684 3685 // Get the term name 3686 $retval = ! empty( $term->name ) 3687 ? $term->name 3688 : ''; 3689 3690 // Filter & return 3691 return apply_filters( 'bbp_get_topic_tag_name', $retval, $tag, $term ); 3692 } 3693 3694 /** 3695 * Output the slug of the current tag 3709 3710 /** 3711 * Return the name of the current tag. 3712 * 3713 * @since 2.0.0 bbPress (r3109) 3714 * 3715 * @return string Term Name. 3716 */ 3717 function bbp_get_topic_tag_name( $tag = '' ) { 3718 3719 // Get the term 3720 if ( ! empty( $tag ) ) { 3721 $term = get_term_by( 'slug', $tag, bbp_get_topic_tag_tax_id() ); 3722 } else { 3723 $tag = get_query_var( 'term' ); 3724 $term = get_queried_object(); 3725 } 3726 3727 // Get the term name 3728 $retval = ! empty( $term->name ) 3729 ? $term->name 3730 : ''; 3731 3732 // Filter & return 3733 return apply_filters( 'bbp_get_topic_tag_name', $retval, $tag, $term ); 3734 } 3735 3736 /** 3737 * Output the slug of the current tag. 3696 3738 * 3697 3739 * @since 2.0.0 bbPress (r3109) … … 3700 3742 echo bbp_get_topic_tag_slug( $tag ); 3701 3743 } 3702 /** 3703 * Return the slug of the current tag 3704 * 3705 * @since 2.0.0 bbPress (r3109) 3706 * 3707 * @return string Term Name 3708 */ 3709 function bbp_get_topic_tag_slug( $tag = '' ) { 3710 3711 // Get the term 3712 if ( ! empty( $tag ) ) { 3713 $term = get_term_by( 'slug', $tag, bbp_get_topic_tag_tax_id() ); 3714 } else { 3715 $tag = get_query_var( 'term' ); 3716 $term = get_queried_object(); 3717 } 3718 3719 // Get the term slug 3720 $retval = ! empty( $term->slug ) 3721 ? $term->slug 3722 : ''; 3723 3724 // Filter & return 3725 return apply_filters( 'bbp_get_topic_tag_slug', $retval, $tag, $term ); 3726 } 3727 3728 /** 3729 * Output the link of the current tag 3744 3745 /** 3746 * Return the slug of the current tag. 3747 * 3748 * @since 2.0.0 bbPress (r3109) 3749 * 3750 * @return string Term Name. 3751 */ 3752 function bbp_get_topic_tag_slug( $tag = '' ) { 3753 3754 // Get the term 3755 if ( ! empty( $tag ) ) { 3756 $term = get_term_by( 'slug', $tag, bbp_get_topic_tag_tax_id() ); 3757 } else { 3758 $tag = get_query_var( 'term' ); 3759 $term = get_queried_object(); 3760 } 3761 3762 // Get the term slug 3763 $retval = ! empty( $term->slug ) 3764 ? $term->slug 3765 : ''; 3766 3767 // Filter & return 3768 return apply_filters( 'bbp_get_topic_tag_slug', $retval, $tag, $term ); 3769 } 3770 3771 /** 3772 * Output the link of the current tag. 3730 3773 * 3731 3774 * @since 2.0.0 bbPress (r3348) … … 3734 3777 echo esc_url( bbp_get_topic_tag_link( $tag ) ); 3735 3778 } 3736 /** 3737 * Return the link of the current tag 3738 * 3739 * @since 2.0.0 bbPress (r3348) 3740 * 3741 * @return string Term Name 3742 */ 3743 function bbp_get_topic_tag_link( $tag = '' ) { 3744 3745 // Get the term 3746 if ( ! empty( $tag ) ) { 3747 $term = get_term_by( 'slug', $tag, bbp_get_topic_tag_tax_id() ); 3748 } else { 3749 $tag = get_query_var( 'term' ); 3750 $term = get_queried_object(); 3751 } 3752 3753 // Get the term link 3754 $retval = ! empty( $term->term_id ) 3755 ? get_term_link( $term, bbp_get_topic_tag_tax_id() ) 3756 : ''; 3757 3758 // Filter & return 3759 return apply_filters( 'bbp_get_topic_tag_link', $retval, $tag, $term ); 3760 } 3761 3762 /** 3763 * Output the link of the current tag 3779 3780 /** 3781 * Return the link of the current tag. 3782 * 3783 * @since 2.0.0 bbPress (r3348) 3784 * 3785 * @return string Term Name. 3786 */ 3787 function bbp_get_topic_tag_link( $tag = '' ) { 3788 3789 // Get the term 3790 if ( ! empty( $tag ) ) { 3791 $term = get_term_by( 'slug', $tag, bbp_get_topic_tag_tax_id() ); 3792 } else { 3793 $tag = get_query_var( 'term' ); 3794 $term = get_queried_object(); 3795 } 3796 3797 // Get the term link 3798 $retval = ! empty( $term->term_id ) 3799 ? get_term_link( $term, bbp_get_topic_tag_tax_id() ) 3800 : ''; 3801 3802 // Filter & return 3803 return apply_filters( 'bbp_get_topic_tag_link', $retval, $tag, $term ); 3804 } 3805 3806 /** 3807 * Output the link of the current tag. 3764 3808 * 3765 3809 * @since 2.0.0 bbPress (r3348) … … 3768 3812 echo esc_url( bbp_get_topic_tag_edit_link( $tag ) ); 3769 3813 } 3770 /** 3771 * Return the link of the current tag 3772 * 3773 * @since 2.0.0 bbPress (r3348) 3774 * 3775 * @return string Term Name 3776 */ 3777 function bbp_get_topic_tag_edit_link( $tag = '' ) { 3778 3779 // Get the term 3780 if ( ! empty( $tag ) ) { 3781 $term = get_term_by( 'slug', $tag, bbp_get_topic_tag_tax_id() ); 3782 } else { 3783 $tag = get_query_var( 'term' ); 3784 $term = get_queried_object(); 3785 } 3786 3787 // Get the term's edit link 3788 if ( ! empty( $term->term_id ) ) { 3789 3790 // Pretty or ugly URL 3791 $retval = bbp_use_pretty_urls() 3792 ? user_trailingslashit( trailingslashit( bbp_get_topic_tag_link() ) . bbp_get_edit_slug() ) 3793 : add_query_arg( array( bbp_get_edit_rewrite_id() => '1' ), bbp_get_topic_tag_link() ); 3794 3795 // No link 3796 } else { 3797 $retval = ''; 3798 } 3799 3800 // Filter & return 3801 return apply_filters( 'bbp_get_topic_tag_edit_link', $retval, $tag, $term ); 3802 } 3803 3804 /** 3805 * Output the description of the current tag 3814 3815 /** 3816 * Return the link of the current tag. 3817 * 3818 * @since 2.0.0 bbPress (r3348) 3819 * 3820 * @return string Term Name. 3821 */ 3822 function bbp_get_topic_tag_edit_link( $tag = '' ) { 3823 3824 // Get the term 3825 if ( ! empty( $tag ) ) { 3826 $term = get_term_by( 'slug', $tag, bbp_get_topic_tag_tax_id() ); 3827 } else { 3828 $tag = get_query_var( 'term' ); 3829 $term = get_queried_object(); 3830 } 3831 3832 // Get the term's edit link 3833 if ( ! empty( $term->term_id ) ) { 3834 3835 // Pretty or ugly URL 3836 $retval = bbp_use_pretty_urls() 3837 ? user_trailingslashit( trailingslashit( bbp_get_topic_tag_link() ) . bbp_get_edit_slug() ) 3838 : add_query_arg( array( bbp_get_edit_rewrite_id() => '1' ), bbp_get_topic_tag_link() ); 3839 3840 // No link 3841 } else { 3842 $retval = ''; 3843 } 3844 3845 // Filter & return 3846 return apply_filters( 'bbp_get_topic_tag_edit_link', $retval, $tag, $term ); 3847 } 3848 3849 /** 3850 * Output the description of the current tag. 3806 3851 * 3807 3852 * @since 2.0.0 bbPress (r3109) … … 3810 3855 echo bbp_get_topic_tag_description( $args ); 3811 3856 } 3812 /** 3813 * Return the description of the current tag 3814 * 3815 * @since 2.0.0 bbPress (r3109) 3816 * 3817 * @param array $args before|after|tag 3818 * 3819 * @return string Term Name 3820 */ 3821 function bbp_get_topic_tag_description( $args = array() ) { 3822 3823 // Parse arguments against default values 3824 $r = bbp_parse_args( 3825 $args, 3826 array( 3827 'before' => '<div class="bbp-topic-tag-description"><p>', 3828 'after' => '</p></div>', 3829 'tag' => '' 3830 ), 3831 'get_topic_tag_description' 3832 ); 3833 3834 // Get the term 3835 if ( ! empty( $r['tag'] ) ) { 3836 $term = get_term_by( 'slug', $r['tag'], bbp_get_topic_tag_tax_id() ); 3837 } else { 3838 $tag = $r['tag'] = get_query_var( 'term' ); 3839 $term = get_queried_object(); 3840 } 3841 3842 // Add before & after if description exists 3843 $retval = ! empty( $term->description ) 3844 ? $r['before'] . $term->description . $r['after'] 3845 : ''; 3846 3847 // Filter & return 3848 return apply_filters( 'bbp_get_topic_tag_description', $retval, $r, $args, $tag, $term ); 3849 } 3857 3858 /** 3859 * Return the description of the current tag. 3860 * 3861 * @since 2.0.0 bbPress (r3109) 3862 * 3863 * @param array $args before|after|tag. 3864 * 3865 * @return string Term Name. 3866 */ 3867 function bbp_get_topic_tag_description( $args = array() ) { 3868 3869 // Parse arguments against default values 3870 $r = bbp_parse_args( 3871 $args, 3872 array( 3873 'before' => '<div class="bbp-topic-tag-description"><p>', 3874 'after' => '</p></div>', 3875 'tag' => '' 3876 ), 3877 'get_topic_tag_description' 3878 ); 3879 3880 // Get the term 3881 if ( ! empty( $r['tag'] ) ) { 3882 $term = get_term_by( 'slug', $r['tag'], bbp_get_topic_tag_tax_id() ); 3883 } else { 3884 $tag = $r['tag'] = get_query_var( 'term' ); 3885 $term = get_queried_object(); 3886 } 3887 3888 // Add before & after if description exists 3889 $retval = ! empty( $term->description ) 3890 ? $r['before'] . $term->description . $r['after'] 3891 : ''; 3892 3893 // Filter & return 3894 return apply_filters( 'bbp_get_topic_tag_description', $retval, $r, $args, $tag, $term ); 3895 } 3850 3896 3851 3897 /** Forms *********************************************************************/ 3852 3898 3853 3899 /** 3854 * Output the value of topic title field 3900 * Output the value of topic title field. 3855 3901 * 3856 3902 * @since 2.0.0 bbPress (r2976) … … 3859 3905 echo bbp_get_form_topic_title(); 3860 3906 } 3861 /** 3862 * Return the value of topic title field 3863 * 3864 * @since 2.0.0 bbPress (r2976) 3865 * 3866 * @return string Value of topic title field 3867 */ 3868 function bbp_get_form_topic_title() { 3869 3870 // Get _POST data 3871 if ( bbp_is_topic_form_post_request() && isset( $_POST['bbp_topic_title'] ) ) { 3872 $topic_title = wp_unslash( $_POST['bbp_topic_title'] ); 3873 3874 // Get edit data 3875 } elseif ( bbp_is_topic_edit() ) { 3876 $topic_title = bbp_get_global_post_field( 'post_title', 'raw' ); 3877 3878 // No data 3879 } else { 3880 $topic_title = ''; 3881 } 3882 3883 // Filter & return 3884 return apply_filters( 'bbp_get_form_topic_title', $topic_title ); 3885 } 3886 3887 /** 3888 * Output the value of topic content field 3907 3908 /** 3909 * Return the value of topic title field. 3910 * 3911 * @since 2.0.0 bbPress (r2976) 3912 * 3913 * @return string Value of topic title field. 3914 */ 3915 function bbp_get_form_topic_title() { 3916 3917 // Get _POST data 3918 if ( bbp_is_topic_form_post_request() && isset( $_POST['bbp_topic_title'] ) ) { 3919 $topic_title = wp_unslash( $_POST['bbp_topic_title'] ); 3920 3921 // Get edit data 3922 } elseif ( bbp_is_topic_edit() ) { 3923 $topic_title = bbp_get_global_post_field( 'post_title', 'raw' ); 3924 3925 // No data 3926 } else { 3927 $topic_title = ''; 3928 } 3929 3930 // Filter & return 3931 return apply_filters( 'bbp_get_form_topic_title', $topic_title ); 3932 } 3933 3934 /** 3935 * Output the value of topic content field. 3889 3936 * 3890 3937 * @since 2.0.0 bbPress (r2976) … … 3893 3940 echo bbp_get_form_topic_content(); 3894 3941 } 3895 /** 3896 * Return the value of topic content field 3897 * 3898 * @since 2.0.0 bbPress (r2976) 3899 * 3900 * @return string Value of topic content field 3901 */ 3902 function bbp_get_form_topic_content() { 3903 3904 // Get _POST data 3905 if ( bbp_is_topic_form_post_request() && isset( $_POST['bbp_topic_content'] ) ) { 3906 $topic_content = wp_unslash( $_POST['bbp_topic_content'] ); 3907 3908 // Get edit data 3909 } elseif ( bbp_is_topic_edit() ) { 3910 $topic_content = bbp_get_global_post_field( 'post_content', 'raw' ); 3911 3912 // No data 3913 } else { 3914 $topic_content = ''; 3915 } 3916 3917 // Filter & return 3918 return apply_filters( 'bbp_get_form_topic_content', $topic_content ); 3919 } 3920 3921 /** 3922 * Allow topic rows to have administrative actions 3942 3943 /** 3944 * Return the value of topic content field. 3945 * 3946 * @since 2.0.0 bbPress (r2976) 3947 * 3948 * @return string Value of topic content field. 3949 */ 3950 function bbp_get_form_topic_content() { 3951 3952 // Get _POST data 3953 if ( bbp_is_topic_form_post_request() && isset( $_POST['bbp_topic_content'] ) ) { 3954 $topic_content = wp_unslash( $_POST['bbp_topic_content'] ); 3955 3956 // Get edit data 3957 } elseif ( bbp_is_topic_edit() ) { 3958 $topic_content = bbp_get_global_post_field( 'post_content', 'raw' ); 3959 3960 // No data 3961 } else { 3962 $topic_content = ''; 3963 } 3964 3965 // Filter & return 3966 return apply_filters( 'bbp_get_form_topic_content', $topic_content ); 3967 } 3968 3969 /** 3970 * Allow topic rows to have administrative actions. 3923 3971 * 3924 3972 * @since 2.1.0 bbPress (r3653) 3925 3973 * 3926 * @todo Links and filter 3974 * @todo Links and filter. 3927 3975 */ 3928 3976 function bbp_topic_row_actions() { … … 3931 3979 3932 3980 /** 3933 * Output value of topic tags field 3981 * Output value of topic tags field. 3934 3982 * 3935 3983 * @since 2.0.0 bbPress (r2976) … … 3938 3986 echo bbp_get_form_topic_tags(); 3939 3987 } 3940 /** 3941 * Return value of topic tags field 3942 * 3943 * @since 2.0.0 bbPress (r2976) 3944 * 3945 * @return string Value of topic tags field 3946 */ 3947 function bbp_get_form_topic_tags() { 3948 3949 // Default return value 3950 $topic_tags = '';3951 3952 // Get _POST data 3953 if ( ( bbp_is_topic_form_post_request() || bbp_is_reply_form_post_request() ) && isset( $_POST['bbp_topic_tags'] ) ) {3954 $topic_tags = wp_unslash( $_POST['bbp_topic_tags'] );3955 3956 // Get edit data 3957 } elseif ( bbp_is_single_topic() || bbp_is_single_reply() || bbp_is_topic_edit() || bbp_is_reply_edit() ) {3958 3959 // Determine the topic id based on the post type 3960 switch ( get_post_type() ) {3961 3962 // Post is a topic 3963 case bbp_get_topic_post_type() :3964 $topic_id = bbp_get_topic_id( get_the_ID() );3965 break;3966 3967 // Post is a reply 3968 case bbp_get_reply_post_type() :3969 $topic_id = bbp_get_reply_topic_id( get_the_ID() );3970 break;3971 }3972 3973 // Topic exists 3974 if ( ! empty( $topic_id ) ) {3975 3976 // Topic is spammed so display pre-spam terms 3977 if ( bbp_is_topic_spam( $topic_id ) ) {3978 3979 // Get pre-spam terms 3980 $spam_terms = get_post_meta( $topic_id, '_bbp_spam_topic_tags', true );3981 $topic_tags = ( ! empty( $spam_terms ) ) ? implode( ', ', $spam_terms ) : '';3982 3983 // Topic is not spam so get real terms 3984 } else {3985 $topic_tags = bbp_get_topic_tag_names( $topic_id );3986 }3988 3989 /** 3990 * Return value of topic tags field. 3991 * 3992 * @since 2.0.0 bbPress (r2976) 3993 * 3994 * @return string Value of topic tags field. 3995 */ 3996 function bbp_get_form_topic_tags() { 3997 3998 // Default return value 3999 $topic_tags = ''; 4000 4001 // Get _POST data 4002 if ( ( bbp_is_topic_form_post_request() || bbp_is_reply_form_post_request() ) && isset( $_POST['bbp_topic_tags'] ) ) { 4003 $topic_tags = wp_unslash( $_POST['bbp_topic_tags'] ); 4004 4005 // Get edit data 4006 } elseif ( bbp_is_single_topic() || bbp_is_single_reply() || bbp_is_topic_edit() || bbp_is_reply_edit() ) { 4007 4008 // Determine the topic id based on the post type 4009 switch ( get_post_type() ) { 4010 4011 // Post is a topic 4012 case bbp_get_topic_post_type() : 4013 $topic_id = bbp_get_topic_id( get_the_ID() ); 4014 break; 4015 4016 // Post is a reply 4017 case bbp_get_reply_post_type() : 4018 $topic_id = bbp_get_reply_topic_id( get_the_ID() ); 4019 break; 4020 } 4021 4022 // Topic exists 4023 if ( ! empty( $topic_id ) ) { 4024 4025 // Topic is spammed so display pre-spam terms 4026 if ( bbp_is_topic_spam( $topic_id ) ) { 4027 4028 // Get pre-spam terms 4029 $spam_terms = get_post_meta( $topic_id, '_bbp_spam_topic_tags', true ); 4030 $topic_tags = ( ! empty( $spam_terms ) ) ? implode( ', ', $spam_terms ) : ''; 4031 4032 // Topic is not spam so get real terms 4033 } else { 4034 $topic_tags = bbp_get_topic_tag_names( $topic_id ); 3987 4035 } 3988 4036 } 3989 3990 // Filter & return 3991 return apply_filters( 'bbp_get_form_topic_tags', $topic_tags ); 3992 } 3993 3994 /** 3995 * Output value of topic forum 4037 } 4038 4039 // Filter & return 4040 return apply_filters( 'bbp_get_form_topic_tags', $topic_tags ); 4041 } 4042 4043 /** 4044 * Output value of topic forum. 3996 4045 * 3997 4046 * @since 2.0.0 bbPress (r2976) … … 4000 4049 echo bbp_get_form_topic_forum(); 4001 4050 } 4002 /** 4003 * Return value of topic forum 4004 * 4005 * @since 2.0.0 bbPress (r2976) 4006 * 4007 * @return string Value of topic content field 4008 */ 4009 function bbp_get_form_topic_forum() { 4010 4011 // Get _POST data 4012 if ( bbp_is_topic_form_post_request() && isset( $_POST['bbp_forum_id'] ) ) { 4013 $topic_forum = (int) $_POST['bbp_forum_id']; 4014 4015 // Get edit data 4016 } elseif ( bbp_is_topic_edit() ) { 4017 $topic_forum = bbp_get_topic_forum_id(); 4018 4019 // No data 4020 } else { 4021 $topic_forum = 0; 4022 } 4023 4024 // Filter & return 4025 return apply_filters( 'bbp_get_form_topic_forum', $topic_forum ); 4026 } 4027 4028 /** 4029 * Output checked value of topic subscription 4051 4052 /** 4053 * Return value of topic forum. 4054 * 4055 * @since 2.0.0 bbPress (r2976) 4056 * 4057 * @return string Value of topic content field. 4058 */ 4059 function bbp_get_form_topic_forum() { 4060 4061 // Get _POST data 4062 if ( bbp_is_topic_form_post_request() && isset( $_POST['bbp_forum_id'] ) ) { 4063 $topic_forum = (int) $_POST['bbp_forum_id']; 4064 4065 // Get edit data 4066 } elseif ( bbp_is_topic_edit() ) { 4067 $topic_forum = bbp_get_topic_forum_id(); 4068 4069 // No data 4070 } else { 4071 $topic_forum = 0; 4072 } 4073 4074 // Filter & return 4075 return apply_filters( 'bbp_get_form_topic_forum', $topic_forum ); 4076 } 4077 4078 /** 4079 * Output checked value of topic subscription. 4030 4080 * 4031 4081 * @since 2.0.0 bbPress (r2976) … … 4034 4084 echo bbp_get_form_topic_subscribed(); 4035 4085 } 4036 /** 4037 * Return checked value of topic subscription 4038 * 4039 * @since 2.0.0 bbPress (r2976) 4040 * 4041 * @return string Checked value of topic subscription 4042 */ 4043 function bbp_get_form_topic_subscribed() { 4044 4045 // Default value 4046 $topic_subscribed = false; 4047 4048 // Get _POST data 4049 if ( bbp_is_topic_form_post_request() && isset( $_POST['bbp_topic_subscription'] ) ) { 4050 $topic_subscribed = (bool) $_POST['bbp_topic_subscription']; 4051 4052 // Get edit data 4053 } elseif ( bbp_is_topic_edit() || bbp_is_reply_edit() ) { 4054 $post_author = (int) bbp_get_global_post_field( 'post_author', 'raw' ); 4055 $topic_subscribed = bbp_is_user_subscribed( $post_author, bbp_get_topic_id() ); 4056 4057 // Get current status 4058 } elseif ( bbp_is_single_topic() ) { 4059 $topic_subscribed = bbp_is_user_subscribed( bbp_get_current_user_id(), bbp_get_topic_id() ); 4060 } 4061 4062 // Get checked output 4063 $checked = checked( $topic_subscribed, true, false ); 4064 4065 // Filter & return 4066 return apply_filters( 'bbp_get_form_topic_subscribed', $checked, $topic_subscribed ); 4067 } 4068 4069 /** 4070 * Output checked value of topic log edit field 4086 4087 /** 4088 * Return checked value of topic subscription. 4089 * 4090 * @since 2.0.0 bbPress (r2976) 4091 * 4092 * @return string Checked value of topic subscription. 4093 */ 4094 function bbp_get_form_topic_subscribed() { 4095 4096 // Default value 4097 $topic_subscribed = false; 4098 4099 // Get _POST data 4100 if ( bbp_is_topic_form_post_request() && isset( $_POST['bbp_topic_subscription'] ) ) { 4101 $topic_subscribed = (bool) $_POST['bbp_topic_subscription']; 4102 4103 // Get edit data 4104 } elseif ( bbp_is_topic_edit() || bbp_is_reply_edit() ) { 4105 $post_author = (int) bbp_get_global_post_field( 'post_author', 'raw' ); 4106 $topic_subscribed = bbp_is_user_subscribed( $post_author, bbp_get_topic_id() ); 4107 4108 // Get current status 4109 } elseif ( bbp_is_single_topic() ) { 4110 $topic_subscribed = bbp_is_user_subscribed( bbp_get_current_user_id(), bbp_get_topic_id() ); 4111 } 4112 4113 // Get checked output 4114 $checked = checked( $topic_subscribed, true, false ); 4115 4116 // Filter & return 4117 return apply_filters( 'bbp_get_form_topic_subscribed', $checked, $topic_subscribed ); 4118 } 4119 4120 /** 4121 * Output checked value of topic log edit field. 4071 4122 * 4072 4123 * @since 2.0.0 bbPress (r2976) … … 4075 4126 echo bbp_get_form_topic_log_edit(); 4076 4127 } 4077 /** 4078 * Return checked value of topic log edit field 4079 * 4080 * @since 2.0.0 bbPress (r2976) 4081 * 4082 * @return string Topic log edit checked value 4083 */ 4084 function bbp_get_form_topic_log_edit() { 4085 4086 // Get _POST data 4087 if ( bbp_is_topic_form_post_request() && isset( $_POST['bbp_log_topic_edit'] ) ) { 4088 $topic_revision = (bool) $_POST['bbp_log_topic_edit']; 4089 4090 // No data 4091 } else { 4092 $topic_revision = true; 4093 } 4094 4095 // Get checked output 4096 $checked = checked( $topic_revision, true, false ); 4097 4098 // Filter & return 4099 return apply_filters( 'bbp_get_form_topic_log_edit', $checked, $topic_revision ); 4100 } 4101 4102 /** 4103 * Output the value of the topic edit reason 4128 4129 /** 4130 * Return checked value of topic log edit field. 4131 * 4132 * @since 2.0.0 bbPress (r2976) 4133 * 4134 * @return string Topic log edit checked value. 4135 */ 4136 function bbp_get_form_topic_log_edit() { 4137 4138 // Get _POST data 4139 if ( bbp_is_topic_form_post_request() && isset( $_POST['bbp_log_topic_edit'] ) ) { 4140 $topic_revision = (bool) $_POST['bbp_log_topic_edit']; 4141 4142 // No data 4143 } else { 4144 $topic_revision = true; 4145 } 4146 4147 // Get checked output 4148 $checked = checked( $topic_revision, true, false ); 4149 4150 // Filter & return 4151 return apply_filters( 'bbp_get_form_topic_log_edit', $checked, $topic_revision ); 4152 } 4153 4154 /** 4155 * Output the value of the topic edit reason. 4104 4156 * 4105 4157 * @since 2.0.0 bbPress (r2976) … … 4108 4160 echo bbp_get_form_topic_edit_reason(); 4109 4161 } 4110 /** 4111 * Return the value of the topic edit reason 4112 * 4113 * @since 2.0.0 bbPress (r2976) 4114 * 4115 * @return string Topic edit reason value 4116 */ 4117 function bbp_get_form_topic_edit_reason() { 4118 4119 // Get _POST data 4120 if ( bbp_is_topic_form_post_request() && isset( $_POST['bbp_topic_edit_reason'] ) ) { 4121 $topic_edit_reason = wp_unslash( $_POST['bbp_topic_edit_reason'] ); 4122 4123 // No data 4124 } else { 4125 $topic_edit_reason = ''; 4126 } 4127 4128 // Filter & return 4129 return apply_filters( 'bbp_get_form_topic_edit_reason', $topic_edit_reason ); 4130 } 4162 4163 /** 4164 * Return the value of the topic edit reason. 4165 * 4166 * @since 2.0.0 bbPress (r2976) 4167 * 4168 * @return string Topic edit reason value. 4169 */ 4170 function bbp_get_form_topic_edit_reason() { 4171 4172 // Get _POST data 4173 if ( bbp_is_topic_form_post_request() && isset( $_POST['bbp_topic_edit_reason'] ) ) { 4174 $topic_edit_reason = wp_unslash( $_POST['bbp_topic_edit_reason'] ); 4175 4176 // No data 4177 } else { 4178 $topic_edit_reason = ''; 4179 } 4180 4181 // Filter & return 4182 return apply_filters( 'bbp_get_form_topic_edit_reason', $topic_edit_reason ); 4183 } 4131 4184 4132 4185 /** … … 4140 4193 * @since 2.6.0 bbPress (r5558) 4141 4194 * 4142 * @return boolean True if is a post request with valid nonce 4195 * @return boolean True if is a post request with valid nonce. 4143 4196 */ 4144 4197 function bbp_is_topic_form_post_request() { … … 4200 4253 4201 4254 /** 4202 * Output the topic lock description 4255 * Output the topic lock description. 4203 4256 * 4204 4257 * @since 2.6.0 bbPress (r6343) 4205 4258 * 4206 * @param int $topic_id Optional. Topic id 4259 * @param int $topic_id Optional. Topic id. 4207 4260 */ 4208 4261 function bbp_topic_lock_description( $topic_id = 0 ) { 4209 4262 echo bbp_get_topic_lock_description( $topic_id ); 4210 4263 } 4211 /** 4212 * Return the topic lock description 4213 * 4214 * @since 2.6.0 bbPress (r6343) 4215 * 4216 * @param int $topic_id Optional. Topic id 4217 */ 4218 function bbp_get_topic_lock_description( $topic_id = 0 ) { 4219 4220 // Check if topic is edit locked 4221 $topic_id = bbp_get_topic_id( $topic_id ); 4222 $user_id = bbp_check_post_lock( $topic_id ); 4223 $person = empty( $user_id ) 4224 ? esc_html__( 'Nobody', 'bbpress' ) 4225 : bbp_get_user_profile_link( $user_id ); 4226 4227 // Get the text 4228 /* translators: %1$s: Person who is editing (user profile link or "Nobody") */ 4229 $text = sprintf( esc_html__( '%1$s is currently editing this topic.', 'bbpress' ), $person ); 4230 4231 // Filter & return 4232 return apply_filters( 'bbp_get_topic_lock_description', $text, $user_id, $topic_id ); 4233 } 4264 4265 /** 4266 * Return the topic lock description. 4267 * 4268 * @since 2.6.0 bbPress (r6343) 4269 * 4270 * @param int $topic_id Optional. Topic id. 4271 */ 4272 function bbp_get_topic_lock_description( $topic_id = 0 ) { 4273 4274 // Check if topic is edit locked 4275 $topic_id = bbp_get_topic_id( $topic_id ); 4276 $user_id = bbp_check_post_lock( $topic_id ); 4277 $person = empty( $user_id ) 4278 ? esc_html__( 'Nobody', 'bbpress' ) 4279 : bbp_get_user_profile_link( $user_id ); 4280 4281 // Get the text 4282 /* translators: %1$s: Person who is editing (user profile link or "Nobody") */ 4283 $text = sprintf( esc_html__( '%1$s is currently editing this topic.', 'bbpress' ), $person ); 4284 4285 // Filter & return 4286 return apply_filters( 'bbp_get_topic_lock_description', $text, $user_id, $topic_id ); 4287 } -
trunk/src/includes/users/capabilities.php
r7378 r7380 2 2 3 3 /** 4 * bbPress User Capabilities 4 * bbPress User Capabilities. 5 5 * 6 6 * Used to map user capabilities to WordPress's existing capabilities. … … 11 11 12 12 /** 13 * Maps primary capabilities 13 * Maps primary capabilities. 14 14 * 15 15 * @since 2.2.0 bbPress (r4242) … … 20 20 * @param array $args Arguments. 21 21 * 22 * @return array Actual capabilities for meta capability 22 * @return array Actual capabilities for meta capability. 23 23 */ 24 24 function bbp_map_primary_meta_caps( $caps = array(), $cap = '', $user_id = 0, $args = array() ) { … … 143 143 144 144 /** 145 * Set a user's role in the forums 145 * Set a user's role in the forums. 146 146 * 147 147 * @since 2.1.0 bbPress (r3860) 148 148 * 149 * @param int $user_id 149 * @param int $user_id User id. 150 150 * 151 151 * @return mixed False if no change. String of new role if changed. … … 191 191 192 192 /** 193 * Return a user's forums role 193 * Return a user's forums role. 194 194 * 195 195 * @since 2.1.0 bbPress (r3860) 196 196 * 197 * @param int $user_id 197 * @param int $user_id User id. 198 198 * 199 199 * @return string … … 228 228 229 229 /** 230 * Return a user's blog role 230 * Return a user's blog role. 231 231 * 232 232 * @since 2.3.0 bbPress (r4446) 233 233 * 234 * @param int $user_id 234 * @param int $user_id User id. 235 235 * 236 236 * @return string … … 270 270 * @since 2.2.0 bbPress (r4235) 271 271 * 272 * @param int $user_id 272 * @param int $user_id User id. 273 273 */ 274 274 function bbp_profile_update_role( $user_id = 0 ) { … … 313 313 314 314 /** 315 * Check if a role ID is valid 315 * Check if a role ID is valid. 316 316 * 317 317 * This helper function accepts a role ID as a string, and compares it against … … 324 324 * @since 2.6.5 325 325 * 326 * @param string $role A well-formed (string) role ID to validate 326 * @param string $role A well-formed (string) role ID to validate. 327 327 * 328 328 * @return bool True if role is valid. False if role is not valid. … … 352 352 353 353 /** 354 * Add the default role to the current user if needed 354 * Add the default role to the current user if needed. 355 355 * 356 356 * This function will bail if the forum is not global in a multisite … … 359 359 * @since 2.0.0 bbPress (r3380) 360 360 * 361 * @return If not multisite, not global, or user is deleted/spammed 361 * @return If not multisite, not global, or user is deleted/spammed. 362 362 */ 363 363 function bbp_set_current_user_default_role() { … … 434 434 * @since 2.2.0 bbPress (r4334) 435 435 * 436 * @return array Filtered array of WordPress roles to bbPress roles 436 * @return array Filtered array of WordPress roles to bbPress roles. 437 437 */ 438 438 function bbp_get_user_role_map() { … … 496 496 497 497 /** 498 * Mark a users topics and replies as spam when the user is marked as spam 498 * Mark a users topics and replies as spam when the user is marked as spam. 499 499 * 500 500 * @since 2.0.0 bbPress (r3405) … … 581 581 582 582 /** 583 * Mark a users topics and replies as spam when the user is marked as spam 583 * Mark a users topics and replies as spam when the user is marked as spam. 584 584 * 585 585 * @since 2.0.0 bbPress (r3405) … … 709 709 710 710 /** 711 * Checks if user is active 711 * Checks if user is active. 712 712 * 713 713 * @since 2.0.0 bbPress (r3502) 714 714 * 715 * @param int $user_id The user ID to check 716 * @return bool True if public, false if not 715 * @param int $user_id The user ID to check. 716 * @return bool True if public, false if not. 717 717 */ 718 718 function bbp_is_user_active( $user_id = 0 ) { … … 743 743 * @since 2.0.0 bbPress (r3502) 744 744 * 745 * @param int $user_id The user ID to check. Defaults to current user ID 746 * @return bool True if inactive, false if active 745 * @param int $user_id The user ID to check. Defaults to current user ID. 746 * @return bool True if inactive, false if active. 747 747 */ 748 748 function bbp_is_user_inactive( $user_id = 0 ) { … … 751 751 752 752 /** 753 * Checks if user is a keymaster 753 * Checks if user is a keymaster. 754 754 * 755 755 * @since 2.3.0 bbPress (r4783) 756 756 * 757 * @param int $user_id 758 * @return bool True if keymaster, false if not 757 * @param int $user_id The user ID to check. Defaults to current user ID. 758 * @return bool True if keymaster, false if not. 759 759 */ 760 760 function bbp_is_user_keymaster( $user_id = 0 ) { … … 767 767 768 768 /** 769 * Does a user have a profile for the current site 769 * Does a user have a profile for the current site. 770 770 * 771 771 * @since 2.2.0 bbPress (r4362) 772 772 * 773 * @param int $user_id User ID to check 773 * @param int $user_id User ID to check. 774 774 * 775 775 * @return bool Whether or not the user has a profile on this blog_id. … … 802 802 803 803 /** 804 * Add a moderator to an object 804 * Add a moderator to an object. 805 805 * 806 806 * @since 2.6.0 bbPress (r6056) 807 807 * 808 * @param int $object_id Traditionally a post ID 809 * @param int $user_id User ID 810 * @param string $object_type Type of meta (post,term,user,comment) 808 * @param int $object_id Traditionally a post ID. 809 * @param int $user_id User ID. 810 * @param string $object_type Type of meta (post,term,user,comment). 811 811 * 812 812 * @return bool … … 817 817 818 818 /** 819 * Remove a moderator user ID from an object 819 * Remove a moderator user ID from an object. 820 820 * 821 821 * @since 2.6.0 bbPress (r6056) 822 822 * 823 * @param int $object_id Traditionally a post ID 824 * @param int $user_id User ID 825 * @param string $object_type Type of meta (post,term,user,comment) 823 * @param int $object_id Traditionally a post ID. 824 * @param int $user_id User ID. 825 * @param string $object_type Type of meta (post,term,user,comment). 826 826 * 827 827 * @return bool … … 832 832 833 833 /** 834 * Get user IDs of moderators for an object 834 * Get user IDs of moderators for an object. 835 835 * 836 836 * @since 2.6.0 bbPress (r6056) 837 837 * 838 * @param int $object_id Traditionally a post ID 839 * @param string $object_type Type of meta (post,term,user,comment) 838 * @param int $object_id Traditionally a post ID. 839 * @param string $object_type Type of meta (post,term,user,comment). 840 840 * 841 841 * @return array … … 851 851 * @since 2.6.0 bbPress (r6056) 852 852 * 853 * @param int $object_id Traditionally a post ID 854 * @param string $object_type Type of meta (post,term,user,comment) 853 * @param int $object_id Traditionally a post ID. 854 * @param string $object_type Type of meta (post,term,user,comment). 855 855 * 856 856 * @return array -
trunk/src/includes/users/engagements.php
r7378 r7380 2 2 3 3 /** 4 * bbPress User Engagement Functions 4 * bbPress User Engagement Functions. 5 5 * 6 6 * @package bbPress … … 14 14 15 15 /** 16 * Add a user id to an object 16 * Add a user id to an object. 17 17 * 18 18 * @since 2.6.0 bbPress (r6109) 19 19 * 20 * @param int $object_id The object id 21 * @param int $user_id The user id 22 * @param string $rel_key The relationship key 23 * @param string $rel_type The relationship type (usually 'post') 24 * @param bool $unique Whether meta key should be unique to the object 25 * 26 * @return bool Returns true on success, false on failure 20 * @param int $object_id The object id. 21 * @param int $user_id The user id. 22 * @param string $rel_key The relationship key. 23 * @param string $rel_type The relationship type (usually 'post'). 24 * @param bool $unique Whether meta key should be unique to the object. 25 * 26 * @return bool Returns true on success, false on failure. 27 27 */ 28 28 function bbp_add_user_to_object( $object_id = 0, $user_id = 0, $rel_key = '', $rel_type = 'post', $unique = false ) { … … 36 36 37 37 /** 38 * Remove a user id from an object 38 * Remove a user id from an object. 39 39 * 40 40 * @since 2.6.0 bbPress (r6109) 41 41 * 42 * @param int $object_id The object id 43 * @param int $user_id The user id 44 * @param string $rel_key The relationship key 45 * @param string $rel_type The relationship type (usually 'post') 46 * 47 * @return bool Returns true on success, false on failure 42 * @param int $object_id The object id. 43 * @param int $user_id The user id. 44 * @param string $rel_key The relationship key. 45 * @param string $rel_type The relationship type (usually 'post'). 46 * 47 * @return bool Returns true on success, false on failure. 48 48 */ 49 49 function bbp_remove_user_from_object( $object_id = 0, $user_id = 0, $rel_key = '', $rel_type = 'post' ) { … … 55 55 56 56 /** 57 * Remove a user id from all objects 57 * Remove a user id from all objects. 58 58 * 59 59 * @since 2.6.0 bbPress (r6109) 60 60 * 61 * @param int $user_id The user id 62 * @param string $rel_key The relationship key 63 * @param string $rel_type The relationship type (usually 'post') 64 * 65 * @return bool Returns true on success, false on failure 61 * @param int $user_id The user id. 62 * @param string $rel_key The relationship key. 63 * @param string $rel_type The relationship type (usually 'post'). 64 * 65 * @return bool Returns true on success, false on failure. 66 66 */ 67 67 function bbp_remove_user_from_all_objects( $user_id = 0, $rel_key = '', $rel_type = 'post' ) { … … 74 74 75 75 /** 76 * Remove an object from all users 76 * Remove an object from all users. 77 77 * 78 78 * @since 2.6.0 bbPress (r6109) 79 79 * 80 * @param int $object_id The object id 81 * @param int $user_id The user id 82 * @param string $rel_key The relationship key 83 * @param string $rel_type The relationship type (usually 'post') 84 * 85 * @return bool Returns true on success, false on failure 80 * @param int $object_id The object id. 81 * @param int $user_id The user id. 82 * @param string $rel_key The relationship key. 83 * @param string $rel_type The relationship type (usually 'post'). 84 * 85 * @return bool Returns true on success, false on failure. 86 86 */ 87 87 function bbp_remove_object_from_all_users( $object_id = 0, $rel_key = '', $rel_type = 'post' ) { … … 94 94 95 95 /** 96 * Remove all users from all objects 96 * Remove all users from all objects. 97 97 * 98 98 * @since 2.6.0 bbPress (r6109) 99 99 * 100 * @param string $rel_key The relationship key 101 * @param string $rel_type The relationship type (usually 'post') 102 * 103 * @return bool Returns true on success, false on failure 100 * @param string $rel_key The relationship key. 101 * @param string $rel_type The relationship type (usually 'post'). 102 * 103 * @return bool Returns true on success, false on failure. 104 104 */ 105 105 function bbp_remove_all_users_from_all_objects( $rel_key = '', $rel_type = 'post' ) { … … 111 111 112 112 /** 113 * Get users of an object 113 * Get users of an object. 114 114 * 115 115 * @since 2.6.0 bbPress (r6109) 116 116 * 117 * @param int $object_id The object id 118 * @param string $rel_key The key used to index this relationship 119 * @param string $rel_type The type of meta to look in 117 * @param int $object_id The object id. 118 * @param string $rel_key The key used to index this relationship. 119 * @param string $rel_type The type of meta to look in. 120 120 * 121 121 * @return array Returns ids of users … … 130 130 131 131 /** 132 * Check if an object has a specific user 132 * Check if an object has a specific user. 133 133 * 134 134 * @since 2.6.0 bbPress (r6109) 135 135 * 136 * @param int $object_id The object id 137 * @param int $user_id The user id 138 * @param string $rel_key The relationship key 139 * @param string $rel_type The relationship type (usually 'post') 140 * 141 * @return bool Returns true if object has a user, false if not 136 * @param int $object_id The object id. 137 * @param int $user_id The user id. 138 * @param string $rel_key The relationship key. 139 * @param string $rel_type The relationship type (usually 'post'). 140 * 141 * @return bool Returns true if object has a user, false if not. 142 142 */ 143 143 function bbp_is_object_of_user( $object_id = 0, $user_id = 0, $rel_key = '', $rel_type = 'post' ) { … … 152 152 153 153 /** 154 * Get the query part responsible for JOINing objects to user IDs 154 * Get the query part responsible for JOINing objects to user IDs. 155 155 * 156 156 * @since 2.6.0 bbPress (r6747) 157 157 * 158 * @param array $args Default query arguments 159 * @param string $context Additional context 160 * @param string $rel_key The relationship key 161 * @param string $rel_type The relationship type (usually 'post') 158 * @param array $args Default query arguments. 159 * @param string $context Additional context. 160 * @param string $rel_key The relationship key. 161 * @param string $rel_type The relationship type (usually 'post'). 162 162 * 163 163 * @return array … … 173 173 174 174 /** 175 * Get the users who have engaged in a topic 175 * Get the users who have engaged in a topic. 176 176 * 177 177 * @since 2.6.0 bbPress (r6320) 178 178 * 179 * @param int $topic_id Optional. Topic id 180 * 181 * @return array|bool Results if the topic has any engagements, otherwise false 179 * @param int $topic_id Optional. Topic id. 180 * 181 * @return array|bool Results if the topic has any engagements, otherwise false. 182 182 */ 183 183 function bbp_get_topic_engagements( $topic_id = 0 ) { … … 190 190 191 191 /** 192 * Return the users who have engaged in a topic, directly with a database query 192 * Return the users who have engaged in a topic, directly with a database query. 193 193 * 194 194 * See: https://bbpress.trac.wordpress.org/ticket/3083 … … 196 196 * @since 2.6.0 bbPress (r6522) 197 197 * 198 * @param int $topic_id 198 * @param int $topic_id Optional. Topic id. 199 199 * 200 200 * @return array … … 231 231 232 232 /** 233 * Get a user's topic engagements 233 * Get a user's topic engagements. 234 234 * 235 235 * @since 2.6.0 bbPress (r6320) 236 236 * @since 2.6.0 bbPress (r6618) Signature changed to accept an array of arguments 237 237 * 238 * @param array $args Optional. Arguments to pass into bbp_has_replies() 239 * 240 * @return bool True if user has engaged, otherwise false 238 * @param array $args Optional. Arguments to pass into bbp_has_replies(). 239 * 240 * @return bool True if user has engaged, otherwise false. 241 241 */ 242 242 function bbp_get_user_engagements( $args = array() ) { … … 249 249 250 250 /** 251 * Check if a user is engaged in a topic or not 251 * Check if a user is engaged in a topic or not. 252 252 * 253 253 * @since 2.6.0 bbPress (r6320) 254 254 * 255 * @param int $user_id Optional. User id 256 * @param int $topic_id Optional. Topic id 257 * 258 * @return bool True if the topic is in user's engagements, otherwise false 255 * @param int $user_id Optional. User id. 256 * @param int $topic_id Optional. Topic id. 257 * 258 * @return bool True if the topic is in user's engagements, otherwise false. 259 259 */ 260 260 function bbp_is_user_engaged( $user_id = 0, $topic_id = 0 ) { … … 268 268 269 269 /** 270 * Add a topic to user's engagements 270 * Add a topic to user's engagements. 271 271 * 272 272 * Note that both the User and Topic should be verified to exist before using … … 277 277 * @since 2.6.0 bbPress (r6320) 278 278 * 279 * @param int $user_id Optional. User id 280 * @param int $topic_id Optional. Topic id 279 * @param int $user_id Optional. User id. 280 * @param int $topic_id Optional. Topic id. 281 281 * 282 282 * @return bool Always true … … 305 305 306 306 /** 307 * Remove a topic from user's engagements 307 * Remove a topic from user's engagements. 308 308 * 309 309 * @since 2.6.0 bbPress (r6320) 310 310 * 311 * @param int $user_id Optional. User id 312 * @param int $topic_id Optional. Topic id 311 * @param int $user_id Optional. User id. 312 * @param int $topic_id Optional. Topic id. 313 313 * 314 314 * @return bool True if the topic was removed from user's engagements, otherwise 315 * false 315 * false. 316 316 */ 317 317 function bbp_remove_user_engagement( $user_id = 0, $topic_id = 0 ) { … … 348 348 * @since 2.6.0 bbPress (r6522) 349 349 * 350 * @param int $topic_id 351 * @param bool $force 350 * @param int $topic_id Topic id. 351 * @param bool $force Force remove & add, even if old equals new. 352 352 * 353 353 * @return boolean True if any engagements are added, false otherwise … … 400 400 * @since 2.6.0 bbPress (r6526) 401 401 * 402 * @param int $topic_id 402 * @param int $topic_id Topic id. 403 403 */ 404 404 function bbp_update_topic_engagements( $topic_id = 0 ) { … … 443 443 444 444 /** 445 * Get the users who have made the topic favorite 445 * Get the users who have made the topic favorite. 446 446 * 447 447 * @since 2.0.0 bbPress (r2658) 448 448 * 449 * @param int $topic_id Optional. Topic id 450 * 451 * @return array|bool Results if the topic has any favoriters, otherwise false 449 * @param int $topic_id Optional. Topic id. 450 * 451 * @return array|bool Results if the topic has any favoriters, otherwise false. 452 452 */ 453 453 function bbp_get_topic_favoriters( $topic_id = 0 ) { … … 460 460 461 461 /** 462 * Get a user's favorite topics 462 * Get a user's favorite topics. 463 463 * 464 464 * @since 2.0.0 bbPress (r2652) 465 465 * @since 2.6.0 bbPress (r6618) Signature changed to accept an array of arguments 466 466 * 467 * @param array $args Optional. Arguments to pass into bbp_has_topics() 468 * 469 * @return array Array of topics if user has favorites, otherwise empty array 467 * @param array $args Optional. Arguments to pass into bbp_has_topics(). 468 * 469 * @return array Array of topics if user has favorites, otherwise empty array. 470 470 */ 471 471 function bbp_get_user_favorites( $args = array() ) { … … 480 480 481 481 /** 482 * Check if a topic is in user's favorites or not 482 * Check if a topic is in user's favorites or not. 483 483 * 484 484 * @since 2.0.0 bbPress (r2652) 485 485 * 486 * @param int $user_id Optional. User id 487 * @param int $topic_id Optional. Topic id 488 * 489 * @return bool True if the topic is in user's favorites, otherwise false 486 * @param int $user_id Optional. User id. 487 * @param int $topic_id Optional. Topic id. 488 * 489 * @return bool True if the topic is in user's favorites, otherwise false. 490 490 */ 491 491 function bbp_is_user_favorite( $user_id = 0, $topic_id = 0 ) { … … 497 497 498 498 /** 499 * Add a topic to user's favorites 499 * Add a topic to user's favorites. 500 500 * 501 501 * Note that both the User and Topic should be verified to exist before using … … 506 506 * @since 2.0.0 bbPress (r2652) 507 507 * 508 * @param int $user_id Optional. User id 509 * @param int $topic_id Optional. Topic id 510 * 511 * @return bool True if the topic was added to user's favorites, otherwise false 508 * @param int $user_id Optional. User id. 509 * @param int $topic_id Optional. Topic id. 510 * 511 * @return bool True if the topic was added to user's favorites, otherwise false. 512 512 */ 513 513 function bbp_add_user_favorite( $user_id = 0, $topic_id = 0 ) { … … 536 536 537 537 /** 538 * Remove a topic from user's favorites 538 * Remove a topic from user's favorites. 539 539 * 540 540 * @since 2.0.0 bbPress (r2652) 541 541 * 542 * @param int $user_id Optional. User id 543 * @param int $topic_id Optional. Topic id 544 * 545 * @return bool True if the topic was removed from user's favorites, otherwise false 542 * @param int $user_id Optional. User id. 543 * @param int $topic_id Optional. Topic id. 544 * 545 * @return bool True if the topic was removed from user's favorites, otherwise false. 546 546 */ 547 547 function bbp_remove_user_favorite( $user_id, $topic_id ) { … … 570 570 571 571 /** 572 * Handles the front end adding and removing of favorite topics 573 * 574 * @param string $action The requested action to compare this function to 572 * Handles the front end adding and removing of favorite topics. 573 * 574 * @since 2.0.0 bbPress (r2652) 575 * 576 * @param string $action The requested action to compare this function to. 575 577 */ 576 578 function bbp_favorites_handler( $action = '' ) { … … 666 668 667 669 /** 668 * Get the users who have subscribed 670 * Get the users who have subscribed. 669 671 * 670 672 * @since 2.6.0 bbPress (r5156) 671 673 * 672 * @param int $object_id Optional. ID of object (forum, topic, or something else) 674 * @param int $object_id Optional. ID of object (forum, topic, or something else). 673 675 */ 674 676 function bbp_get_subscribers( $object_id = 0, $type = 'post' ) { … … 680 682 681 683 /** 682 * Get a user's subscribed topics 684 * Get a user's subscribed topics. 683 685 * 684 686 * @since 2.0.0 bbPress (r2668) 685 687 * @since 2.6.0 bbPress (r6618) Signature changed to accept an array of arguments 686 688 * 687 * @param array $args Optional. Arguments to pass into bbp_has_topics() 688 * 689 * @return array Array of topics if user has topic subscriptions, otherwise empty array 689 * @param array $args Optional. Arguments to pass into bbp_has_topics(). 690 * 691 * @return array Array of topics if user has topic subscriptions, otherwise empty array. 690 692 */ 691 693 function bbp_get_user_topic_subscriptions( $args = array() ) { … … 700 702 701 703 /** 702 * Get a user's subscribed forums 704 * Get a user's subscribed forums. 703 705 * 704 706 * @since 2.5.0 bbPress (r5156) 705 707 * @since 2.6.0 bbPress (r6618) Signature changed to accept an array of arguments 706 708 * 707 * @param array $args Optional. Arguments to pass into bbp_has_forums() 708 * 709 * @return array Array of forums if user has forum subscriptions, otherwise empty array 709 * @param array $args Optional. Arguments to pass into bbp_has_forums(). 710 * 711 * @return array Array of forums if user has forum subscriptions, otherwise empty array. 710 712 */ 711 713 function bbp_get_user_forum_subscriptions( $args = array() ) { … … 720 722 721 723 /** 722 * Check if an object (forum or topic) is in user's subscription list or not 724 * Check if an object (forum or topic) is in user's subscription list or not. 723 725 * 724 726 * @since 2.5.0 bbPress (r5156) 725 727 * 726 * @param int $user_id Optional. User id 727 * @param int $object_id Optional. Object id 728 * 729 * @return bool True if the object (forum or topic) is in user's subscriptions, otherwise false 728 * @param int $user_id Optional. User id. 729 * @param int $object_id Optional. Object id. 730 * 731 * @return bool True if the object (forum or topic) is in user's subscriptions, otherwise false. 730 732 */ 731 733 function bbp_is_user_subscribed( $user_id = 0, $object_id = 0, $type = 'post' ) { … … 737 739 738 740 /** 739 * Add a user subscription 741 * Add a user subscription. 740 742 * 741 743 * @since 2.5.0 bbPress (r5156) 742 744 * @since 2.6.0 bbPress (r6544) Added $type parameter 743 745 * 744 * @param int $user_id Optional. User id 745 * @param int $object_id Optional. Object id 746 * @param string $type Optional. Type of object being subscribed to 747 * 748 * @return bool True if the object was added to user subscriptions, otherwise false 746 * @param int $user_id Optional. User id. 747 * @param int $object_id Optional. Object id. 748 * @param string $type Optional. Type of object being subscribed to. 749 * 750 * @return bool True if the object was added to user subscriptions, otherwise false. 749 751 */ 750 752 function bbp_add_user_subscription( $user_id = 0, $object_id = 0, $type = 'post' ) { … … 771 773 772 774 /** 773 * Remove a user subscription 775 * Remove a user subscription. 774 776 * 775 777 * @since 2.5.0 bbPress (r5156) 776 778 * @since 2.6.0 bbPress (r6544) Added $type parameter 777 779 * 778 * @param int $user_id Optional. User id 779 * @param int $object_id Optional. Object id 780 * @param string $type Optional. Type of object being subscribed to 781 * 782 * @return bool True if the object was removed from user subscriptions, otherwise false 780 * @param int $user_id Optional. User id. 781 * @param int $object_id Optional. Object id. 782 * @param string $type Optional. Type of object being subscribed to. 783 * 784 * @return bool True if the object was removed from user subscriptions, otherwise false. 783 785 */ 784 786 function bbp_remove_user_subscription( $user_id = 0, $object_id = 0, $type = 'post' ) { … … 805 807 806 808 /** 807 * Handles the front end toggling of user subscriptions 809 * Handles the front end toggling of user subscriptions. 808 810 * 809 811 * @since 2.0.0 bbPress (r2790) 810 812 * @since 2.6.l bbPress (r6543) 811 813 * 812 * @param string $action The requested action to compare this function to 814 * @param string $action The requested action to compare this function to. 813 815 */ 814 816 function bbp_subscriptions_handler( $action = '' ) { … … 924 926 * @since 2.6.0 bbPress (r6606) 925 927 * 926 * @param int $user_id The user id 927 * @param string $rel_key The relationship key 928 * @param string $rel_type The relationship type (usually 'post') 929 * @param array $args The arguments to override defaults 930 * 931 * @return array|bool Results if user has objects, otherwise null 928 * @param int $user_id The user id. 929 * @param string $rel_key The relationship key. 930 * @param string $rel_type The relationship type (usually 'post'). 931 * @param array $args The arguments to override defaults. 932 * 933 * @return array|bool Results if user has objects, otherwise null. 932 934 */ 933 935 function bbp_get_user_object_ids( $args = array() ) { … … 992 994 993 995 /** 994 * Get array of forum IDs that a user can moderate 996 * Get array of forum IDs that a user can moderate. 995 997 * 996 998 * @since 2.6.0 bbPress (r5834) … … 998 1000 * @param int $user_id User id. 999 1001 * 1000 * @return array Return array of forum ids, or empty array 1002 * @return array Return array of forum ids, or empty array. 1001 1003 */ 1002 1004 function bbp_get_moderator_forum_ids( $user_id = 0 ) { … … 1012 1014 1013 1015 /** 1014 * Get a user's engaged topic ids 1016 * Get a user's engaged topic ids. 1015 1017 * 1016 1018 * @since 2.6.0 bbPress (r6320) 1017 1019 * 1018 * @param int $user_id Optional. User id 1019 * 1020 * @return array Return array of topic ids, or empty array 1020 * @param int $user_id Optional. User id. 1021 * 1022 * @return array Return array of topic ids, or empty array. 1021 1023 */ 1022 1024 function bbp_get_user_engaged_topic_ids( $user_id = 0 ) { … … 1031 1033 1032 1034 /** 1033 * Get a user's favorite topic ids 1035 * Get a user's favorite topic ids. 1034 1036 * 1035 1037 * @since 2.0.0 bbPress (r2652) 1036 1038 * 1037 * @param int $user_id Optional. User id 1038 * 1039 * @return array Return array of favorite topic ids, or empty array 1039 * @param int $user_id Optional. User id. 1040 * 1041 * @return array Return array of favorite topic ids, or empty array. 1040 1042 */ 1041 1043 function bbp_get_user_favorites_topic_ids( $user_id = 0 ) { … … 1050 1052 1051 1053 /** 1052 * Get a user's subscribed forum ids 1054 * Get a user's subscribed forum ids. 1053 1055 * 1054 1056 * @since 2.5.0 bbPress (r5156) 1055 1057 * 1056 * @param int $user_id Optional. User id 1057 * 1058 * @return array Return array of subscribed forum ids, or empty array 1058 * @param int $user_id Optional. User id. 1059 * 1060 * @return array Return array of subscribed forum ids, or empty array. 1059 1061 */ 1060 1062 function bbp_get_user_subscribed_forum_ids( $user_id = 0 ) { … … 1070 1072 1071 1073 /** 1072 * Get a user's subscribed topic ids 1074 * Get a user's subscribed topic ids. 1073 1075 * 1074 1076 * @since 2.0.0 bbPress (r2668) 1075 1077 * 1076 * @param int $user_id Optional. User id 1077 * 1078 * @return array Return array of subscribed topic ids, or empty array 1078 * @param int $user_id Optional. User id. 1079 * 1080 * @return array Return array of subscribed topic ids, or empty array. 1079 1081 */ 1080 1082 function bbp_get_user_subscribed_topic_ids( $user_id = 0 ) { … … 1091 1093 1092 1094 /** 1093 * Get a user's subscribed topics 1095 * Get a user's subscribed topics. 1094 1096 * 1095 1097 * @since 2.0.0 bbPress (r2668) 1096 1098 * @deprecated 2.5.0 bbPress (r5156) 1097 1099 * 1098 * @param int $user_id Optional. User id 1099 * 1100 * @return array|bool Results if user has subscriptions, otherwise false 1100 * @param int $user_id Optional. User id. 1101 * 1102 * @return array|bool Results if user has subscriptions, otherwise false. 1101 1103 */ 1102 1104 function bbp_get_user_subscriptions( $user_id = 0 ) { … … 1109 1111 1110 1112 /** 1111 * Get the users who have subscribed to the forum 1113 * Get the users who have subscribed to the forum. 1112 1114 * 1113 1115 * @since 2.5.0 bbPress (r5156) 1114 1116 * @deprecated 2.6.0 bbPress (r6543) 1115 1117 * 1116 * @param int $forum_id Optional. forum id 1117 * 1118 * @return array|bool Results if the forum has any subscribers, otherwise false 1118 * @param int $forum_id Optional. forum id. 1119 * 1120 * @return array|bool Results if the forum has any subscribers, otherwise false. 1119 1121 */ 1120 1122 function bbp_get_forum_subscribers( $forum_id = 0 ) { … … 1126 1128 1127 1129 /** 1128 * Get the users who have subscribed to the topic 1130 * Get the users who have subscribed to the topic. 1129 1131 * 1130 1132 * @since 2.0.0 bbPress (r2668) 1131 1133 * @deprecated 2.6.0 bbPress (r6543) 1132 1134 * 1133 * @param int $topic_id Optional. Topic id 1134 * 1135 * @return array|bool Results if the topic has any subscribers, otherwise false 1135 * @param int $topic_id Optional. Topic id. 1136 * 1137 * @return array|bool Results if the topic has any subscribers, otherwise false. 1136 1138 */ 1137 1139 function bbp_get_topic_subscribers( $topic_id = 0 ) { … … 1143 1145 1144 1146 /** 1145 * Check if a forum is in user's subscription list or not 1147 * Check if a forum is in user's subscription list or not. 1146 1148 * 1147 1149 * @since 2.5.0 bbPress (r5156) 1148 1150 * @deprecated 2.6.0 bbPress (r6543) 1149 1151 * 1150 * @param int $user_id Optional. User id 1151 * @param int $forum_id Optional. Forum id 1152 * 1153 * @return bool True if the forum is in user's subscriptions, otherwise false 1152 * @param int $user_id Optional. User id. 1153 * @param int $forum_id Optional. Forum id. 1154 * 1155 * @return bool True if the forum is in user's subscriptions, otherwise false. 1154 1156 */ 1155 1157 function bbp_is_user_subscribed_to_forum( $user_id = 0, $forum_id = 0 ) { … … 1158 1160 1159 1161 /** 1160 * Check if a topic is in user's subscription list or not 1162 * Check if a topic is in user's subscription list or not. 1161 1163 * 1162 1164 * @since 2.5.0 bbPress (r5156) 1163 1165 * @deprecated 2.6.0 bbPress (r6543) Use bbp_is_user_subscribed() 1164 1166 * 1165 * @param int $user_id Optional. User id 1166 * @param int $topic_id Optional. Topic id 1167 * @return bool True if the topic is in user's subscriptions, otherwise false 1167 * @param int $user_id Optional. User id. 1168 * @param int $topic_id Optional. Topic id. 1169 * @return bool True if the topic is in user's subscriptions, otherwise false. 1168 1170 */ 1169 1171 function bbp_is_user_subscribed_to_topic( $user_id = 0, $topic_id = 0 ) { … … 1172 1174 1173 1175 /** 1174 * Remove a forum from user's subscriptions 1176 * Remove a forum from user's subscriptions. 1175 1177 * 1176 1178 * @since 2.5.0 bbPress (r5156) 1177 1179 * @deprecated 2.6.0 bbPress (r6543) 1178 1180 * 1179 * @param int $user_id Optional. User id 1180 * @param int $forum_id Optional. forum id 1181 * @param int $user_id Optional. User id. 1182 * @param int $forum_id Optional. forum id. 1181 1183 * @return bool True if the forum was removed from user's subscriptions, 1182 * otherwise false 1184 * otherwise false. 1183 1185 */ 1184 1186 function bbp_remove_user_forum_subscription( $user_id = 0, $forum_id = 0 ) { … … 1187 1189 1188 1190 /** 1189 * Remove a topic from user's subscriptions 1191 * Remove a topic from user's subscriptions. 1190 1192 * 1191 1193 * @since 2.5.0 bbPress (r5156) 1192 1194 * @deprecated 2.6.0 bbPress (r6543) 1193 1195 * 1194 * @param int $user_id Optional. User id 1195 * @param int $topic_id Optional. Topic id 1196 * @param int $user_id Optional. User id. 1197 * @param int $topic_id Optional. Topic id. 1196 1198 * @return bool True if the topic was removed from user's subscriptions, 1197 * otherwise false 1199 * otherwise false. 1198 1200 */ 1199 1201 function bbp_remove_user_topic_subscription( $user_id = 0, $topic_id = 0 ) { … … 1202 1204 1203 1205 /** 1204 * Add a forum to user's subscriptions 1206 * Add a forum to user's subscriptions. 1205 1207 * 1206 1208 * @since 2.5.0 bbPress (r5156) 1207 1209 * @deprecated 2.6.0 bbPress (r6543) 1208 1210 * 1209 * @param int $user_id Optional. User id 1210 * @param int $forum_id Optional. forum id 1211 * @return bool Always true 1211 * @param int $user_id Optional. User id. 1212 * @param int $forum_id Optional. forum id. 1213 * @return bool Always true. 1212 1214 */ 1213 1215 function bbp_add_user_forum_subscription( $user_id = 0, $forum_id = 0 ) { … … 1216 1218 1217 1219 /** 1218 * Add a topic to user's subscriptions 1220 * Add a topic to user's subscriptions. 1219 1221 * 1220 1222 * Note that both the User and Topic should be verified to exist before using … … 1226 1228 * @deprecated 2.6.0 bbPress (r6543) 1227 1229 * 1228 * @param int $user_id Optional. User id 1229 * @param int $topic_id Optional. Topic id 1230 * @return bool Always true 1230 * @param int $user_id Optional. User id. 1231 * @param int $topic_id Optional. Topic id. 1232 * @return bool Always true. 1231 1233 */ 1232 1234 function bbp_add_user_topic_subscription( $user_id = 0, $topic_id = 0 ) { … … 1235 1237 1236 1238 /** 1237 * Handles the front end toggling of forum subscriptions 1239 * Handles the front end toggling of forum subscriptions. 1238 1240 * 1239 1241 * @since 2.5.0 bbPress (r5156) -
trunk/src/includes/users/functions.php
r7378 r7380 2 2 3 3 /** 4 * bbPress User Functions 4 * bbPress User Functions. 5 5 * 6 6 * @package bbPress … … 12 12 13 13 /** 14 * Redirect back to $url when attempting to use the login page 14 * Redirect back to $url when attempting to use the login page. 15 15 * 16 16 * @since 2.0.0 bbPress (r2815) 17 17 * 18 * @param string $url The url 19 * @param string $raw_url Raw url 20 * @param object $user User object 18 * @param string $url The url. 19 * @param string $raw_url Raw url. 20 * @param object $user User object. 21 21 */ 22 22 function bbp_redirect_login( $url = '', $raw_url = '', $user = '' ) { … … 45 45 * 46 46 * @return bool True if anonymous is allowed and user is not logged in, false if 47 * anonymous is not allowed or user is logged in 47 * anonymous is not allowed or user is logged in. 48 48 */ 49 49 function bbp_is_anonymous() { … … 55 55 56 56 /** 57 * Echoes the values for current poster (uses WP comment cookies) 57 * Echoes the values for current poster (uses WP comment cookies). 58 58 * 59 59 * @since 2.0.0 bbPress (r2734) … … 65 65 } 66 66 67 /**68 * Get the cookies for current poster (uses WP comment cookies).69 *70 * @since 2.0.0 bbPress (r2734)71 *72 * @param string $key Optional. Which value to get? If not given, then73 * an array is returned.74 * @return string|array Cookie(s) for current poster 75 */76 function bbp_get_current_anonymous_user_data( $key = '' ) {77 78 // Array of allowed cookie names79 $cookie_names = array(80 'name' => 'comment_author',81 'email' => 'comment_author_email',82 'url' => 'comment_author_url',83 84 // Here just for the sake of them, use the above ones85 'comment_author' => 'comment_author',86 'comment_author_email' => 'comment_author_email',87 'comment_author_url' => 'comment_author_url',88 );89 90 // Get the current poster's info from the cookies91 $bbp_current_poster = wp_get_current_commenter();92 93 // Sanitize the cookie key being retrieved94 $key = sanitize_key( $key );95 96 // Maybe return a specific key97 if ( ! empty( $key ) && in_array( $key, array_keys( $cookie_names ), true ) ) {98 return $bbp_current_poster[ $cookie_names[ $key ] ];99 }100 101 // Return all keys102 return $bbp_current_poster;103 }104 105 /** 106 * Set the cookies for current poster (uses WP comment cookies) 67 /** 68 * Get the cookies for current poster (uses WP comment cookies). 69 * 70 * @since 2.0.0 bbPress (r2734) 71 * 72 * @param string $key Optional. Which value to get? If not given, then 73 * an array is returned. 74 * @return string|array Cookie(s) for current poster. 75 */ 76 function bbp_get_current_anonymous_user_data( $key = '' ) { 77 78 // Array of allowed cookie names 79 $cookie_names = array( 80 'name' => 'comment_author', 81 'email' => 'comment_author_email', 82 'url' => 'comment_author_url', 83 84 // Here just for the sake of them, use the above ones 85 'comment_author' => 'comment_author', 86 'comment_author_email' => 'comment_author_email', 87 'comment_author_url' => 'comment_author_url', 88 ); 89 90 // Get the current poster's info from the cookies 91 $bbp_current_poster = wp_get_current_commenter(); 92 93 // Sanitize the cookie key being retrieved 94 $key = sanitize_key( $key ); 95 96 // Maybe return a specific key 97 if ( ! empty( $key ) && in_array( $key, array_keys( $cookie_names ), true ) ) { 98 return $bbp_current_poster[ $cookie_names[ $key ] ]; 99 } 100 101 // Return all keys 102 return $bbp_current_poster; 103 } 104 105 /** 106 * Set the cookies for current poster (uses WP comment cookies). 107 107 * 108 108 * @since 2.0.0 bbPress (r2734) … … 110 110 * @param array $anonymous_data Optional - if it's an anonymous post. Do not 111 111 * supply if supplying $author_id. Should be 112 * sanitized (see {@link bbp_filter_anonymous_post_data()} 112 * sanitized (see {@link bbp_filter_anonymous_post_data()}. 113 113 */ 114 114 function bbp_set_current_anonymous_user_data( $anonymous_data = array() ) { … … 131 131 132 132 /** 133 * Get the poster IP address 133 * Get the poster IP address. 134 134 * 135 135 * @since 2.0.0 bbPress (r3120) … … 153 153 154 154 /** 155 * Get the poster user agent 155 * Get the poster user agent. 156 156 * 157 157 * @since 2.0.0 bbPress (r3446) … … 171 171 172 172 /** 173 * Handles the front end user editing from POST requests 173 * Handles the front end user editing from POST requests. 174 174 * 175 175 * @since 2.0.0 bbPress (r2790) 176 176 * 177 * @param string $action The requested action to compare this function to 177 * @param string $action The requested action to compare this function to. 178 178 */ 179 179 function bbp_edit_user_handler( $action = '' ) { … … 288 288 289 289 /** 290 * Handles user email address updating from GET requests 290 * Handles user email address updating from GET requests. 291 291 * 292 292 * @since 2.6.0 bbPress (r5660) … … 388 388 389 389 /** 390 * Sends an email when an email address change occurs on POST requests 390 * Sends an email when an email address change occurs on POST requests. 391 391 * 392 392 * @since 2.6.0 bbPress (r5660) … … 470 470 /** 471 471 * Conditionally hook the core WordPress output actions to the end of the 472 * default user's edit profile template 472 * default user's edit profile template. 473 473 * 474 474 * This allows clever plugin authors to conditionally unhook the WordPress core … … 487 487 488 488 /** 489 * Get the topics that a user created 489 * Get the topics that a user created. 490 490 * 491 491 * @since 2.0.0 bbPress (r2660) 492 492 * @since 2.6.0 bbPress (r6618) Signature changed to accept an array of arguments 493 493 * 494 * @param array $args Optional. Arguments to pass into bbp_has_topics() 495 * 496 * @return bool True if user has started topics, otherwise false 494 * @param array $args Optional. Arguments to pass into bbp_has_topics(). 495 * 496 * @return bool True if user has started topics, otherwise false. 497 497 */ 498 498 function bbp_get_user_topics_started( $args = array() ) { … … 522 522 523 523 /** 524 * Get the replies that a user created 524 * Get the replies that a user created. 525 525 * 526 526 * @since 2.2.0 bbPress (r4225) 527 527 * @since 2.6.0 bbPress (r6618) Signature changed to accept an array of arguments 528 528 * 529 * @param array $args Optional. Arguments to pass into bbp_has_replies() 530 * 531 * @return bool True if user has created replies, otherwise false 529 * @param array $args Optional. Arguments to pass into bbp_has_replies(). 530 * 531 * @return bool True if user has created replies, otherwise false. 532 532 */ 533 533 function bbp_get_user_replies_created( $args = array() ) { … … 561 561 562 562 /** 563 * Get user IDs from nicenames 564 * 565 * This function is primarily used when saving object moderators 563 * Get user IDs from nicenames. 564 * 565 * This function is primarily used when saving object moderators. 566 566 * 567 567 * @since 2.6.0 bbPress … … 604 604 605 605 /** 606 * Get user nicenames from IDs 607 * 608 * This function is primarily used when saving object moderators 606 * Get user nicenames from IDs. 607 * 608 * This function is primarily used when saving object moderators. 609 609 * 610 610 * @since 2.6.0 bbPress 611 611 * 612 * @param mixed $user_ids 612 * @param mixed $user_ids User ids. 613 613 * @return array 614 614 */ … … 641 641 642 642 /** 643 * Return the raw database count of topics by a user 643 * Return the raw database count of topics by a user. 644 644 * 645 645 * @since 2.1.0 bbPress (r3633) 646 646 * 647 * @param int $user_id User ID to get count for 648 * 649 * @return int Raw DB count of topics 647 * @param int $user_id User ID to get count for. 648 * 649 * @return int Raw DB count of topics. 650 650 */ 651 651 function bbp_get_user_topic_count_raw( $user_id = 0 ) { … … 667 667 668 668 /** 669 * Return the raw database count of replies by a user 669 * Return the raw database count of replies by a user. 670 670 * 671 671 * @since 2.1.0 bbPress (r3633) 672 672 * 673 * @param int $user_id User ID to get count for 674 * 675 * @return int Raw DB count of replies 673 * @param int $user_id User ID to get count for. 674 * 675 * @return int Raw DB count of replies. 676 676 */ 677 677 function bbp_get_user_reply_count_raw( $user_id = 0 ) { … … 697 697 * @since 2.6.0 bbPress (r5309) 698 698 * 699 * @param int $user_id 700 * @param int $difference 699 * @param int $user_id User id. 700 * @param int $difference Optional. Default 1. Number to bump. 701 701 */ 702 702 function bbp_bump_user_topic_count( $user_id = 0, $difference = 1 ) { … … 733 733 * @since 2.6.0 bbPress (r5309) 734 734 * 735 * @param int $user_id 736 * @param int $difference 735 * @param int $user_id User id. 736 * @param int $difference Optional. Default 1. Number to bump. 737 737 */ 738 738 function bbp_bump_user_reply_count( $user_id = 0, $difference = 1 ) { … … 785 785 * a reply is published. 786 786 * 787 * This is a helper function, hooked to `bbp_new_reply` 787 * This is a helper function, hooked to `bbp_new_reply`. 788 788 * 789 789 * @since 2.6.0 bbPress (r5309) … … 828 828 829 829 /** 830 * Redirect if unauthorized user is attempting to edit another user 830 * Redirect if unauthorized user is attempting to edit another user. 831 831 * 832 832 * This is hooked to 'bbp_template_redirect' and controls the conditions under -
trunk/src/includes/users/options.php
r7378 r7380 2 2 3 3 /** 4 * bbPress User Options 4 * bbPress User Options. 5 5 * 6 6 * @package bbPress … … 12 12 13 13 /** 14 * Get the default user options and their values 15 * 16 * @since 2.1.0 bbPress (r3910) 17 * 18 * @return array Filtered user option names and values 14 * Get the default user options and their values. 15 * 16 * @since 2.1.0 bbPress (r3910) 17 * 18 * @return array Filtered user option names and values. 19 19 */ 20 20 function bbp_get_default_user_options() { … … 32 32 33 33 /** 34 * Add default user options 34 * Add default user options. 35 35 * 36 36 * This is destructive, so existing bbPress user options will be overridden. … … 56 56 57 57 /** 58 * Delete default user options 58 * Delete default user options. 59 59 * 60 60 * Hooked to bbp_uninstall, it is only called once when bbPress is uninstalled. … … 103 103 * @since 2.1.0 bbPress (r3910) 104 104 * 105 * @param bool $value Optional. Default value false 106 * @return mixed false if not overloaded, mixed if set 105 * @param bool $value Optional. Default value false. 106 * @return mixed false if not overloaded, mixed if set. 107 107 */ 108 108 function bbp_filter_get_user_option( $value = false, $option = '', $user = 0 ) { … … 121 121 122 122 /** 123 * Update the topic count for a user 123 * Update the topic count for a user. 124 124 * 125 125 * @since 2.6.0 bbPress (r5309) … … 150 150 151 151 /** 152 * Update the reply count for a user 152 * Update the reply count for a user. 153 153 * 154 154 * @since 2.6.0 bbPress (r5309) 155 155 * 156 * @param int $user_id 156 * @param int $user_id User id. 157 157 * @param mixed $count 158 158 * @return boolean … … 179 179 180 180 /** 181 * Output a users topic count 182 * 183 * @since 2.1.0 bbPress (r3632) 184 * 185 * @param int $user_id 186 * @param boolean $integer Optional. Whether or not to format the result 181 * Output a users topic count. 182 * 183 * @since 2.1.0 bbPress (r3632) 184 * 185 * @param int $user_id User id. 186 * @param boolean $integer Optional. Whether or not to format the result. 187 187 * 188 188 * @return string … … 191 191 echo esc_html( bbp_get_user_topic_count( $user_id, $integer ) ); 192 192 } 193 /** 194 * Return a users reply count 195 * 196 * @since 2.1.0 bbPress (r3632) 197 * 198 * @param int $user_id 199 * @param boolean $integer Optional. Whether or not to format the result 200 * 201 * @return string 202 */ 203 function bbp_get_user_topic_count( $user_id = 0, $integer = false ) { 204 205 // Validate user id 206 $user_id = bbp_get_user_id( $user_id ); 207 if ( empty( $user_id ) ) { 208 return false; 209 } 210 211 $count = get_user_option( '_bbp_topic_count', $user_id ); 212 $filter = ( true === $integer ) 213 ? 'bbp_get_user_topic_count_int' 214 : 'bbp_get_user_topic_count'; 215 216 // Filter & return 217 return apply_filters( $filter, $count, $user_id ); 218 } 219 220 /** 221 * Output a users reply count 222 * 223 * @since 2.1.0 bbPress (r3632) 224 * 225 * @param int $user_id 226 * @param boolean $integer Optional. Whether or not to format the result 193 194 /** 195 * Return a users reply count. 196 * 197 * @since 2.1.0 bbPress (r3632) 198 * 199 * @param int $user_id User id. 200 * @param boolean $integer Optional. Whether or not to format the result. 201 * 202 * @return string 203 */ 204 function bbp_get_user_topic_count( $user_id = 0, $integer = false ) { 205 206 // Validate user id 207 $user_id = bbp_get_user_id( $user_id ); 208 if ( empty( $user_id ) ) { 209 return false; 210 } 211 212 $count = get_user_option( '_bbp_topic_count', $user_id ); 213 $filter = ( true === $integer ) 214 ? 'bbp_get_user_topic_count_int' 215 : 'bbp_get_user_topic_count'; 216 217 // Filter & return 218 return apply_filters( $filter, $count, $user_id ); 219 } 220 221 /** 222 * Output a users reply count. 223 * 224 * @since 2.1.0 bbPress (r3632) 225 * 226 * @param int $user_id User id. 227 * @param boolean $integer Optional. Whether or not to format the result. 227 228 * 228 229 * @return string … … 231 232 echo esc_html( bbp_get_user_reply_count( $user_id, $integer ) ); 232 233 } 233 /** 234 * Return a users reply count 235 * 236 * @since 2.1.0 bbPress (r3632) 237 * 238 * @param int $user_id 239 * @param boolean $integer Optional. Whether or not to format the result 240 * 241 * @return string 242 */ 243 function bbp_get_user_reply_count( $user_id = 0, $integer = false ) { 244 245 // Validate user id 246 $user_id = bbp_get_user_id( $user_id ); 247 if ( empty( $user_id ) ) { 248 return false; 249 } 250 251 $count = get_user_option( '_bbp_reply_count', $user_id ); 252 $filter = ( true === $integer ) 253 ? 'bbp_get_user_reply_count_int' 254 : 'bbp_get_user_reply_count'; 255 256 return apply_filters( $filter, $count, $user_id ); 257 } 258 259 /** 260 * Output a users total post count 261 * 262 * @since 2.1.0 bbPress (r3632) 263 * 264 * @param int $user_id 234 235 /** 236 * Return a users reply count. 237 * 238 * @since 2.1.0 bbPress (r3632) 239 * 240 * @param int $user_id User id. 241 * @param boolean $integer Optional. Whether or not to format the result. 242 * 243 * @return string 244 */ 245 function bbp_get_user_reply_count( $user_id = 0, $integer = false ) { 246 247 // Validate user id 248 $user_id = bbp_get_user_id( $user_id ); 249 if ( empty( $user_id ) ) { 250 return false; 251 } 252 253 $count = get_user_option( '_bbp_reply_count', $user_id ); 254 $filter = ( true === $integer ) 255 ? 'bbp_get_user_reply_count_int' 256 : 'bbp_get_user_reply_count'; 257 258 return apply_filters( $filter, $count, $user_id ); 259 } 260 261 /** 262 * Output a users total post count. 263 * 264 * @since 2.1.0 bbPress (r3632) 265 * 266 * @param int $user_id User id. 265 267 * @param boolean $integer Optional. Whether or not to format the result 266 268 * … … 270 272 echo esc_html( bbp_get_user_post_count( $user_id, $integer ) ); 271 273 } 272 /** 273 * Return a users total post count 274 * 275 * @since 2.1.0 bbPress (r3632) 276 * 277 * @param int $user_id 278 * @param boolean $integer Optional. Whether or not to format the result 279 * 280 * @return string 281 */ 282 function bbp_get_user_post_count( $user_id = 0, $integer = false ) { 283 284 // Validate user id 285 $user_id = bbp_get_user_id( $user_id ); 286 if ( empty( $user_id ) ) { 287 return false; 288 } 289 290 $topics = bbp_get_user_topic_count( $user_id, true ); 291 $replies = bbp_get_user_reply_count( $user_id, true ); 292 $count = $topics + $replies; 293 $filter = ( true === $integer ) 294 ? 'bbp_get_user_post_count_int' 295 : 'bbp_get_user_post_count'; 296 297 return apply_filters( $filter, $count, $user_id ); 298 } 274 275 /** 276 * Return a users total post count. 277 * 278 * @since 2.1.0 bbPress (r3632) 279 * 280 * @param int $user_id User id. 281 * @param boolean $integer Optional. Whether or not to format the result. 282 * 283 * @return string 284 */ 285 function bbp_get_user_post_count( $user_id = 0, $integer = false ) { 286 287 // Validate user id 288 $user_id = bbp_get_user_id( $user_id ); 289 if ( empty( $user_id ) ) { 290 return false; 291 } 292 293 $topics = bbp_get_user_topic_count( $user_id, true ); 294 $replies = bbp_get_user_reply_count( $user_id, true ); 295 $count = $topics + $replies; 296 $filter = ( true === $integer ) 297 ? 'bbp_get_user_post_count_int' 298 : 'bbp_get_user_post_count'; 299 300 return apply_filters( $filter, $count, $user_id ); 301 } 299 302 300 303 /** Last Posted ***************************************************************/ 301 304 302 305 /** 303 * Update a users last posted time, for use with post throttling 304 * 305 * @since 2.1.0 bbPress (r3910) 306 * 307 * @param int $user_id User ID to update 308 * @param int $time Time in time() format 309 * @return bool False if no user or failure, true if successful 306 * Update a users last posted time, for use with post throttling. 307 * 308 * @since 2.1.0 bbPress (r3910) 309 * 310 * @param int $user_id User ID to update. 311 * @param int $time Time in time() format. 312 * @return bool False if no user or failure, true if successful. 310 313 */ 311 314 function bbp_update_user_last_posted( $user_id = 0, $time = 0 ) { … … 330 333 * @since 2.1.0 bbPress (r3910) 331 334 * 332 * @param int $user_id User ID to retrieve value for 335 * @param int $user_id User ID to retrieve value for. 333 336 */ 334 337 function bbp_user_last_posted( $user_id = 0 ) { … … 336 339 } 337 340 338 /**339 * Return the raw value of the last posted time.340 *341 * @since 2.1.0 bbPress (r3910)342 *343 * @param int $user_id User ID to retrieve value for 344 * @return mixed False if no user, time() format if exists 345 */346 function bbp_get_user_last_posted( $user_id = 0 ) {347 348 // Validate user id349 $user_id = bbp_get_user_id( $user_id );350 if ( empty( $user_id ) ) {351 return false;352 }353 354 $time = get_user_option( '_bbp_last_posted', $user_id );355 356 // Filter & return357 return apply_filters( 'bbp_get_user_last_posted', $time, $user_id );358 }341 /** 342 * Return the raw value of the last posted time. 343 * 344 * @since 2.1.0 bbPress (r3910) 345 * 346 * @param int $user_id User ID to retrieve value for. 347 * @return mixed False if no user, time() format if exists. 348 */ 349 function bbp_get_user_last_posted( $user_id = 0 ) { 350 351 // Validate user id 352 $user_id = bbp_get_user_id( $user_id ); 353 if ( empty( $user_id ) ) { 354 return false; 355 } 356 357 $time = get_user_option( '_bbp_last_posted', $user_id ); 358 359 // Filter & return 360 return apply_filters( 'bbp_get_user_last_posted', $time, $user_id ); 361 } -
trunk/src/includes/users/signups.php
r7361 r7380 15 15 16 16 /** 17 * Output the forum-role field when adding a new user 17 * Output the forum-role field when adding a new user. 18 18 * 19 19 * @since 2.6.0 bbPress (r6674) … … 61 61 62 62 /** 63 * Maybe add forum role to signup meta array 64 * 65 * @since 2.6.0 bbPress (r6674) 66 * 67 * @param array $meta 63 * Maybe add forum role to signup meta array. 64 * 65 * @since 2.6.0 bbPress (r6674) 66 * 67 * @param array $meta The signup meta. 68 68 * 69 69 * @return array … … 97 97 98 98 /** 99 * Add forum meta data when inviting a user to a site 99 * Add forum meta data when inviting a user to a site. 100 100 * 101 101 * @since 2.6.0 bbPress (r6674) … … 141 141 142 142 /** 143 * Single-site handler for adding a new user 144 * 145 * @since 2.6.0 bbPress (r6674) 146 * 147 * @param int $user_id 143 * Single-site handler for adding a new user. 144 * 145 * @since 2.6.0 bbPress (r6674) 146 * 147 * @param int $user_id The user ID. 148 148 * 149 149 * @return void … … 169 169 170 170 /** 171 * Multi-site handler for adding a new user 172 * 173 * @since 2.6.0 bbPress (r6674) 174 * 175 * @param int $user_id User ID 176 * @param string $password User password 177 * @param array $meta Array of metadata 171 * Multi-site handler for adding a new user. 172 * 173 * @since 2.6.0 bbPress (r6674) 174 * 175 * @param int $user_id User ID. 176 * @param string $password User password. 177 * @param array $meta Array of metadata. 178 178 * 179 179 * @return void … … 210 210 * @since 2.6.5 211 211 * 212 * @param string $to_validate A role ID to validate 213 * 214 * @return string A valid role ID, or empty string on error 212 * @param string $to_validate A role ID to validate. 213 * 214 * @return string A valid role ID, or empty string on error. 215 215 */ 216 216 function bbp_validate_signup_role( $to_validate = '' ) { … … 246 246 247 247 /** 248 * Validate the Forum role during the registration process 248 * Validate the Forum role during the registration process. 249 249 * 250 250 * @since 2.6.5 251 251 * 252 * @param string $to_validate A role ID to validate 253 * 254 * @return string A valid role ID, or empty string on error 252 * @param string $to_validate A role ID to validate. 253 * 254 * @return string A valid role ID, or empty string on error. 255 255 */ 256 256 function bbp_validate_registration_role( $to_validate = '' ) { … … 273 273 274 274 /** 275 * Validate the Forum role during multisite activation 275 * Validate the Forum role during multisite activation. 276 276 * 277 277 * This function exists simply for parity with registrations, and to maintain an … … 283 283 * @since 2.6.5 284 284 * 285 * @param string $to_validate A role ID to validate 286 * 287 * @return string A valid role ID, or empty string on error 285 * @param string $to_validate A role ID to validate. 286 * 287 * @return string A valid role ID, or empty string on error. 288 288 */ 289 289 function bbp_validate_activation_role( $to_validate = '' ) { -
trunk/src/includes/users/template.php
r7378 r7380 2 2 3 3 /** 4 * bbPress User Template Tags 4 * bbPress User Template Tags. 5 5 * 6 6 * @package bbPress … … 14 14 15 15 /** 16 * Extension of WP_User_Query to allow easy looping 16 * Extension of WP_User_Query to allow easy looping. 17 17 * 18 18 * @since 2.6.0 bbPress (r6330) … … 169 169 * @since 2.6.0 bbPress (r6330) 170 170 * 171 * @param array $args All the arguments supported by {@link WP_User_Query} 172 * @return object Multidimensional array of user information 171 * @param array $args All the arguments supported by {@link WP_User_Query}. 172 * @return object Multidimensional array of user information. 173 173 */ 174 174 function bbp_has_users( $args = array() ) { … … 196 196 197 197 /** 198 * Whether there are more users available in the loop 198 * Whether there are more users available in the loop. 199 199 * 200 200 * @since 2.6.0 bbPress (r2464) 201 201 * 202 * @return object User information 202 * @return object User information. 203 203 */ 204 204 function bbp_users() { … … 207 207 208 208 /** 209 * Loads up the current user in the loop 209 * Loads up the current user in the loop. 210 210 * 211 211 * @since 2.6.0 bbPress (r2464) 212 212 * 213 * @return object User information 213 * @return object User information. 214 214 */ 215 215 function bbp_the_user() { … … 220 220 221 221 /** 222 * Output a validated user id 222 * Output a validated user id. 223 223 * 224 224 * @since 2.0.0 bbPress (r2729) 225 225 * 226 * @param int $user_id Optional. User id 226 * @param int $user_id Optional. User id. 227 227 * @param bool $displayed_user_fallback Fallback on displayed user? 228 228 * @param bool $current_user_fallback Fallback on current user? … … 231 231 echo bbp_get_user_id( $user_id, $displayed_user_fallback, $current_user_fallback ); 232 232 } 233 /** 234 * Return a validated user id 235 * 236 * @since 2.0.0 bbPress (r2729) 237 * 238 * @param int $user_id Optional. User id 239 * @param bool $displayed_user_fallback Fallback on displayed user? 240 * @param bool $current_user_fallback Fallback on current user? 241 * @return int Validated user id 242 */ 243 function bbp_get_user_id( $user_id = 0, $displayed_user_fallback = true, $current_user_fallback = false ) { 244 $bbp = bbpress(); 245 246 // Easy empty checking 247 if ( ! empty( $user_id ) && is_numeric( $user_id ) ) { 248 $bbp_user_id = $user_id; 249 250 // Currently inside a user loop 251 } elseif ( ! empty( $bbp->user_query->in_the_loop ) && isset( $bbp->user_query->user->ID ) ) { 252 $bbp_user_id = $bbp->user_query->user->ID; 253 254 // Currently viewing or editing a user 255 } elseif ( ( true === $displayed_user_fallback ) && ! empty( $bbp->displayed_user->ID ) ) { 256 $bbp_user_id = $bbp->displayed_user->ID; 257 258 // Maybe fallback on the current_user ID 259 } elseif ( ( true === $current_user_fallback ) && ! empty( $bbp->current_user->ID ) ) { 260 $bbp_user_id = $bbp->current_user->ID; 261 262 // Failsafe 263 } else { 264 $bbp_user_id = 0; 265 } 266 267 // Filter & return 268 return (int) apply_filters( 'bbp_get_user_id', (int) $bbp_user_id, $displayed_user_fallback, $current_user_fallback ); 269 } 270 271 /** 272 * Output ID of current user 233 234 /** 235 * Return a validated user id. 236 * 237 * @since 2.0.0 bbPress (r2729) 238 * 239 * @param int $user_id Optional. User id. 240 * @param bool $displayed_user_fallback Fallback on displayed user? 241 * @param bool $current_user_fallback Fallback on current user? 242 * @return int Validated user id. 243 */ 244 function bbp_get_user_id( $user_id = 0, $displayed_user_fallback = true, $current_user_fallback = false ) { 245 $bbp = bbpress(); 246 247 // Easy empty checking 248 if ( ! empty( $user_id ) && is_numeric( $user_id ) ) { 249 $bbp_user_id = $user_id; 250 251 // Currently inside a user loop 252 } elseif ( ! empty( $bbp->user_query->in_the_loop ) && isset( $bbp->user_query->user->ID ) ) { 253 $bbp_user_id = $bbp->user_query->user->ID; 254 255 // Currently viewing or editing a user 256 } elseif ( ( true === $displayed_user_fallback ) && ! empty( $bbp->displayed_user->ID ) ) { 257 $bbp_user_id = $bbp->displayed_user->ID; 258 259 // Maybe fallback on the current_user ID 260 } elseif ( ( true === $current_user_fallback ) && ! empty( $bbp->current_user->ID ) ) { 261 $bbp_user_id = $bbp->current_user->ID; 262 263 // Failsafe 264 } else { 265 $bbp_user_id = 0; 266 } 267 268 // Filter & return 269 return (int) apply_filters( 'bbp_get_user_id', (int) $bbp_user_id, $displayed_user_fallback, $current_user_fallback ); 270 } 271 272 /** 273 * Output ID of current user. 273 274 * 274 275 * @since 2.0.0 bbPress (r2574) … … 277 278 echo bbp_get_current_user_id(); 278 279 } 279 /** 280 * Return ID of current user 281 * 282 * @since 2.0.0 bbPress (r2574) 283 * 284 * @return int Current user id 285 */ 286 function bbp_get_current_user_id() { 287 288 // Filter & return 289 return (int) apply_filters( 'bbp_get_current_user_id', bbp_get_user_id( 0, false, true ) ); 290 } 291 292 /** 293 * Output ID of displayed user 280 281 /** 282 * Return ID of current user. 283 * 284 * @since 2.0.0 bbPress (r2574) 285 * 286 * @return int Current user id. 287 */ 288 function bbp_get_current_user_id() { 289 290 // Filter & return 291 return (int) apply_filters( 'bbp_get_current_user_id', bbp_get_user_id( 0, false, true ) ); 292 } 293 294 /** 295 * Output ID of displayed user. 294 296 * 295 297 * @since 2.0.0 bbPress (r2688) … … 298 300 echo bbp_get_displayed_user_id(); 299 301 } 300 /** 301 * Return ID of displayed user 302 * 303 * @since 2.0.0 bbPress (r2688) 304 * 305 * @return int Displayed user id 306 */ 307 function bbp_get_displayed_user_id() { 308 309 // Filter & return 310 return apply_filters( 'bbp_get_displayed_user_id', bbp_get_user_id( 0, true, false ) ); 311 } 312 313 /** 314 * Output a sanitized user field value 302 303 /** 304 * Return ID of displayed user. 305 * 306 * @since 2.0.0 bbPress (r2688) 307 * 308 * @return int Displayed user id. 309 */ 310 function bbp_get_displayed_user_id() { 311 312 // Filter & return 313 return apply_filters( 'bbp_get_displayed_user_id', bbp_get_user_id( 0, true, false ) ); 314 } 315 316 /** 317 * Output a sanitized user field value. 315 318 * 316 319 * This function relies on the $filter parameter to decide how to sanitize … … 320 323 * @since 2.0.0 bbPress (r2688) 321 324 * 322 * @param string $field Field to get 323 * @param string $filter How to filter the field value (null|raw|db|display|edit) 325 * @param string $field Field to get. 326 * @param string $filter How to filter the field value (null|raw|db|display|edit). 324 327 */ 325 328 function bbp_displayed_user_field( $field = '', $filter = 'display' ) { 326 329 echo bbp_get_displayed_user_field( $field, $filter ); 327 330 } 328 /** 329 * Return a sanitized user field value 330 * 331 * This function relies on the $filter parameter to decide how to sanitize 332 * the field value that it finds. Since it uses the WP_User object's magic 333 * __get() method, it can also be used to get user_meta values. 334 * 335 * @since 2.0.0 bbPress (r2688) 336 * 337 * @param string $field Field to get 338 * @param string $filter How to filter the field value (null|raw|db|display|edit) 339 * @see WP_User::__get() for more on how the value is retrieved 340 * @see sanitize_user_field() for more on how the value is sanitized 341 * @return string|bool Value of the field if it exists, else false 342 */ 343 function bbp_get_displayed_user_field( $field = '', $filter = 'display' ) { 344 345 // Get the displayed user 346 $user = bbpress()->displayed_user; 347 348 // Juggle the user filter property because we don't want to muck up how 349 // other code might interact with this object. 350 $old_filter = $user->filter; 351 $user->filter = $filter; 352 353 // Get the field value from the WP_User object. We don't need to perform 354 // an isset() because the WP_User::__get() does it for us. 355 $value = $user->$field; 356 357 // Put back the user filter property that was previously juggled above. 358 $user->filter = $old_filter; 359 360 // Filter & return 361 return apply_filters( 'bbp_get_displayed_user_field', $value, $field, $filter ); 362 } 363 364 /** 365 * Output name of current user 331 332 /** 333 * Return a sanitized user field value. 334 * 335 * This function relies on the $filter parameter to decide how to sanitize 336 * the field value that it finds. Since it uses the WP_User object's magic 337 * __get() method, it can also be used to get user_meta values. 338 * 339 * @since 2.0.0 bbPress (r2688) 340 * 341 * @see WP_User::__get() for more on how the value is retrieved. 342 * @see sanitize_user_field() for more on how the value is sanitized. 343 * 344 * @param string $field Field to get. 345 * @param string $filter How to filter the field value (null|raw|db|display|edit). 346 * @return string|bool Value of the field if it exists, else false. 347 */ 348 function bbp_get_displayed_user_field( $field = '', $filter = 'display' ) { 349 350 // Get the displayed user 351 $user = bbpress()->displayed_user; 352 353 // Juggle the user filter property because we don't want to muck up how 354 // other code might interact with this object. 355 $old_filter = $user->filter; 356 $user->filter = $filter; 357 358 // Get the field value from the WP_User object. We don't need to perform 359 // an isset() because the WP_User::__get() does it for us. 360 $value = $user->$field; 361 362 // Put back the user filter property that was previously juggled above. 363 $user->filter = $old_filter; 364 365 // Filter & return 366 return apply_filters( 'bbp_get_displayed_user_field', $value, $field, $filter ); 367 } 368 369 /** 370 * Output name of current user. 366 371 * 367 372 * @since 2.0.0 bbPress (r2574) … … 370 375 echo esc_attr( bbp_get_current_user_name() ); 371 376 } 372 /** 373 * Return name of current user 374 * 375 * @since 2.0.0 bbPress (r2574) 376 * 377 * @return string 378 */ 379 function bbp_get_current_user_name() { 380 381 // Default current user name 382 $default = bbp_get_fallback_display_name(); 383 384 // Check the $user_identity global 385 $current_user_name = is_user_logged_in() 386 ? bbp_get_global_object( 'user_identity', false, $default ) 387 : $default; 388 389 // Filter & return 390 return apply_filters( 'bbp_get_current_user_name', $current_user_name ); 391 } 392 393 /** 394 * Output avatar of current user 377 378 /** 379 * Return name of current user. 395 380 * 396 381 * @since 2.0.0 bbPress (r2574) 397 382 * 398 * @param int $size Size of the avatar. Defaults to 40 383 * @return string 384 */ 385 function bbp_get_current_user_name() { 386 387 // Default current user name 388 $default = bbp_get_fallback_display_name(); 389 390 // Check the $user_identity global 391 $current_user_name = is_user_logged_in() 392 ? bbp_get_global_object( 'user_identity', false, $default ) 393 : $default; 394 395 // Filter & return 396 return apply_filters( 'bbp_get_current_user_name', $current_user_name ); 397 } 398 399 /** 400 * Output avatar of current user. 401 * 402 * @since 2.0.0 bbPress (r2574) 403 * 404 * @param int $size Size of the avatar. Defaults to 40. 399 405 */ 400 406 function bbp_current_user_avatar( $size = 40 ) { … … 402 408 } 403 409 404 /**405 * Return avatar of current user 406 *407 * @since 2.0.0 bbPress (r2574)408 *409 * @param int $size Size of the avatar. Defaults to 40 410 * @return string Current user avatar 411 */412 function bbp_get_current_user_avatar( $size = 40 ) {413 414 $user = bbp_get_current_user_id();415 if ( empty( $user ) ) {416 $user = bbp_get_current_anonymous_user_data( 'email' );417 }418 419 $avatar = get_avatar( $user, $size );420 421 // Filter & return422 return apply_filters( 'bbp_get_current_user_avatar', $avatar, $size );423 }424 425 /** 426 * Output link to the profile page of a user 410 /** 411 * Return avatar of current user. 412 * 413 * @since 2.0.0 bbPress (r2574) 414 * 415 * @param int $size Size of the avatar. Defaults to 40. 416 * @return string Current user avatar. 417 */ 418 function bbp_get_current_user_avatar( $size = 40 ) { 419 420 $user = bbp_get_current_user_id(); 421 if ( empty( $user ) ) { 422 $user = bbp_get_current_anonymous_user_data( 'email' ); 423 } 424 425 $avatar = get_avatar( $user, $size ); 426 427 // Filter & return 428 return apply_filters( 'bbp_get_current_user_avatar', $avatar, $size ); 429 } 430 431 /** 432 * Output link to the profile page of a user. 427 433 * 428 434 * @since 2.0.0 bbPress (r2688) 429 435 * 430 * @param int $user_id Optional. User id 436 * @param int $user_id Optional. User id. 431 437 */ 432 438 function bbp_user_profile_link( $user_id = 0 ) { 433 439 echo bbp_get_user_profile_link( $user_id ); 434 440 } 435 /** 436 * Return link to the profile page of a user 437 * 438 * @since 2.0.0 bbPress (r2688) 439 * 440 * @param int $user_id Optional. User id 441 * @return string User profile link 442 */ 443 function bbp_get_user_profile_link( $user_id = 0 ) { 444 445 // Validate user id 446 $user_id = bbp_get_user_id( $user_id ); 447 if ( empty( $user_id ) ) { 448 return false; 449 } 450 451 // Get the user 452 $user = get_userdata( $user_id ); 453 if ( empty( $user ) ) { 454 return false; 455 } 456 457 // Display Name 458 $name = ! empty( $user->display_name ) 459 ? $user->display_name 460 : bbp_get_fallback_display_name(); 461 462 // URL 463 $url = bbp_get_user_profile_url( $user_id ); 464 465 // Link 466 $link = ! empty( $url ) 467 ? '<a href="' . esc_url( $url ) . '">' . esc_html( $name ) . '</a>' 468 : esc_html( $name ); 469 470 // Filter & return 471 return (string) apply_filters( 'bbp_get_user_profile_link', $link, $user_id ); 472 } 473 474 /** 475 * Output a users nicename to the screen 441 442 /** 443 * Return link to the profile page of a user. 444 * 445 * @since 2.0.0 bbPress (r2688) 446 * 447 * @param int $user_id Optional. User id. 448 * @return string User profile link. 449 */ 450 function bbp_get_user_profile_link( $user_id = 0 ) { 451 452 // Validate user id 453 $user_id = bbp_get_user_id( $user_id ); 454 if ( empty( $user_id ) ) { 455 return false; 456 } 457 458 // Get the user 459 $user = get_userdata( $user_id ); 460 if ( empty( $user ) ) { 461 return false; 462 } 463 464 // Display Name 465 $name = ! empty( $user->display_name ) 466 ? $user->display_name 467 : bbp_get_fallback_display_name(); 468 469 // URL 470 $url = bbp_get_user_profile_url( $user_id ); 471 472 // Link 473 $link = ! empty( $url ) 474 ? '<a href="' . esc_url( $url ) . '">' . esc_html( $name ) . '</a>' 475 : esc_html( $name ); 476 477 // Filter & return 478 return (string) apply_filters( 'bbp_get_user_profile_link', $link, $user_id ); 479 } 480 481 /** 482 * Output a users nicename to the screen. 476 483 * 477 484 * @since 2.3.0 bbPress (r4671) 478 485 * 479 * @param int $user_id User ID whose nicename to get 480 * @param array $args before|after|user_id|force 486 * @param int $user_id User ID whose nicename to get. 487 * @param array $args before|after|user_id|force. 481 488 */ 482 489 function bbp_user_nicename( $user_id = 0, $args = array() ) { 483 490 echo bbp_get_user_nicename( $user_id, $args ); 484 491 } 485 /** 486 * Return a users nicename to the screen 487 * 488 * @since 2.3.0 bbPress (r4671) 489 * 490 * @param int $user_id User ID whose nicename to get 491 * @param array $args before|after|user_id|force 492 * @return string User nicename, maybe wrapped in before/after strings 493 */ 494 function bbp_get_user_nicename( $user_id = 0, $args = array() ) { 495 496 // Bail if no user ID passed 497 $user_id = bbp_get_user_id( $user_id ); 498 if ( empty( $user_id ) ) { 499 return false; 500 } 501 502 // Parse default arguments 503 $r = bbp_parse_args( 504 $args, 505 array( 506 'user_id' => $user_id, 507 'before' => '', 508 'after' => '', 509 'force' => '' 510 ), 511 'get_user_nicename' 512 ); 513 514 // Force the nicename (likely from a previous user query) 515 if ( ! empty( $r['force'] ) ) { 516 $nicename = (string) $r['force']; 517 518 // Maybe fallback to getting the nicename from user data 519 } elseif ( ! empty( $r['user_id'] ) ) { 520 $user = get_userdata( $r['user_id'] ); 521 $nicename = ! empty( $user ) 522 ? $user->user_nicename 523 : ''; 524 525 // Maybe fallback to empty string so filter still applies 526 } else { 527 $nicename = ''; 528 } 529 530 // Maybe wrap the nicename 531 $retval = ! empty( $nicename ) 532 ? $r['before'] . esc_html( $nicename ) . $r['after'] 492 493 /** 494 * Return a users nicename to the screen. 495 * 496 * @since 2.3.0 bbPress (r4671) 497 * 498 * @param int $user_id User ID whose nicename to get. 499 * @param array $args before|after|user_id|force. 500 * @return string User nicename, maybe wrapped in before/after strings. 501 */ 502 function bbp_get_user_nicename( $user_id = 0, $args = array() ) { 503 504 // Bail if no user ID passed 505 $user_id = bbp_get_user_id( $user_id ); 506 if ( empty( $user_id ) ) { 507 return false; 508 } 509 510 // Parse default arguments 511 $r = bbp_parse_args( 512 $args, 513 array( 514 'user_id' => $user_id, 515 'before' => '', 516 'after' => '', 517 'force' => '' 518 ), 519 'get_user_nicename' 520 ); 521 522 // Force the nicename (likely from a previous user query) 523 if ( ! empty( $r['force'] ) ) { 524 $nicename = (string) $r['force']; 525 526 // Maybe fallback to getting the nicename from user data 527 } elseif ( ! empty( $r['user_id'] ) ) { 528 $user = get_userdata( $r['user_id'] ); 529 $nicename = ! empty( $user ) 530 ? $user->user_nicename 533 531 : ''; 534 532 535 // Filter & return 536 return (string) apply_filters( 'bbp_get_user_nicename', $retval, $user_id, $r, $args ); 537 } 538 539 /** 540 * Output URL to the profile page of a user 533 // Maybe fallback to empty string so filter still applies 534 } else { 535 $nicename = ''; 536 } 537 538 // Maybe wrap the nicename 539 $retval = ! empty( $nicename ) 540 ? $r['before'] . esc_html( $nicename ) . $r['after'] 541 : ''; 542 543 // Filter & return 544 return (string) apply_filters( 'bbp_get_user_nicename', $retval, $user_id, $r, $args ); 545 } 546 547 /** 548 * Output URL to the profile page of a user. 541 549 * 542 550 * @since 2.0.0 bbPress (r2688) 543 551 * 544 * @param int $user_id Optional. User id 545 * @param string $user_nicename Optional. User nicename 552 * @param int $user_id Optional. User id. 553 * @param string $user_nicename Optional. User nicename. 546 554 */ 547 555 function bbp_user_profile_url( $user_id = 0, $user_nicename = '' ) { 548 556 echo esc_url( bbp_get_user_profile_url( $user_id, $user_nicename ) ); 549 557 } 550 /** 551 * Return URL to the profile page of a user 552 * 553 * @since 2.0.0 bbPress (r2688) 554 * 555 * @param int $user_id Optional. User id 556 * @param string $user_nicename Optional. User nicename 557 * @return string User profile url 558 */ 559 function bbp_get_user_profile_url( $user_id = 0, $user_nicename = '' ) { 560 561 // Use displayed user ID if there is one, and one isn't requested 562 $user_id = bbp_get_user_id( $user_id ); 563 if ( empty( $user_id ) ) { 564 return false; 558 559 /** 560 * Return URL to the profile page of a user. 561 * 562 * @since 2.0.0 bbPress (r2688) 563 * 564 * @param int $user_id Optional. User id. 565 * @param string $user_nicename Optional. User nicename. 566 * @return string User profile url. 567 */ 568 function bbp_get_user_profile_url( $user_id = 0, $user_nicename = '' ) { 569 570 // Use displayed user ID if there is one, and one isn't requested 571 $user_id = bbp_get_user_id( $user_id ); 572 if ( empty( $user_id ) ) { 573 return false; 574 } 575 576 // Bail if intercepted 577 $intercept = bbp_maybe_intercept( 'bbp_pre_get_user_profile_url', func_get_args() ); 578 if ( bbp_is_intercepted( $intercept ) ) { 579 return $intercept; 580 } 581 582 // Pretty permalinks 583 if ( bbp_use_pretty_urls() ) { 584 585 // Get username if not passed 586 if ( empty( $user_nicename ) ) { 587 $user_nicename = bbp_get_user_nicename( $user_id ); 565 588 } 566 589 567 // Bail if intercepted 568 $intercept = bbp_maybe_intercept( 'bbp_pre_get_user_profile_url', func_get_args() ); 569 if ( bbp_is_intercepted( $intercept ) ) { 570 return $intercept; 571 } 572 573 // Pretty permalinks 574 if ( bbp_use_pretty_urls() ) { 575 576 // Get username if not passed 577 if ( empty( $user_nicename ) ) { 578 $user_nicename = bbp_get_user_nicename( $user_id ); 579 } 580 581 // Run through home_url() 582 $url = trailingslashit( bbp_get_root_url() . bbp_get_user_slug() ) . $user_nicename; 583 $url = user_trailingslashit( $url ); 584 $url = home_url( $url ); 585 586 // Unpretty permalinks 587 } else { 588 $url = add_query_arg( 589 array( 590 bbp_get_user_rewrite_id() => $user_id 591 ), 592 home_url( '/' ) 593 ); 594 } 595 596 // Filter & return 597 return apply_filters( 'bbp_get_user_profile_url', $url, $user_id, $user_nicename ); 598 } 599 600 /** 601 * Output link to the profile edit page of a user 590 // Run through home_url() 591 $url = trailingslashit( bbp_get_root_url() . bbp_get_user_slug() ) . $user_nicename; 592 $url = user_trailingslashit( $url ); 593 $url = home_url( $url ); 594 595 // Unpretty permalinks 596 } else { 597 $url = add_query_arg( 598 array( 599 bbp_get_user_rewrite_id() => $user_id 600 ), 601 home_url( '/' ) 602 ); 603 } 604 605 // Filter & return 606 return apply_filters( 'bbp_get_user_profile_url', $url, $user_id, $user_nicename ); 607 } 608 609 /** 610 * Output link to the profile edit page of a user. 602 611 * 603 612 * @since 2.0.0 bbPress (r2688) 604 613 * 605 * @param int $user_id Optional. User id 614 * @param int $user_id Optional. User id. 606 615 */ 607 616 function bbp_user_profile_edit_link( $user_id = 0 ) { 608 617 echo bbp_get_user_profile_edit_link( $user_id ); 609 618 } 610 /** 611 * Return link to the profile edit page of a user 612 * 613 * @since 2.0.0 bbPress (r2688) 614 * 615 * @param int $user_id Optional. User id 616 * @return string User profile edit link 617 */ 618 function bbp_get_user_profile_edit_link( $user_id = 0 ) { 619 620 // Validate user id 621 $user_id = bbp_get_user_id( $user_id ); 622 if ( empty( $user_id ) ) { 623 return false; 624 } 625 626 // Get the user 627 $user = get_userdata( $user_id ); 628 if ( empty( $user ) ) { 629 return false; 630 } 631 632 // Display Name 633 $name = ! empty( $user->display_name ) 634 ? $user->display_name 635 : bbp_get_fallback_display_name(); 636 637 // URL 638 $url = bbp_get_user_profile_edit_url( $user_id ); 639 640 // Link 641 $link = ! empty( $url ) 642 ? '<a href="' . esc_url( $url ) . '">' . esc_html( $name ) . '</a>' 643 : esc_html( $name ); 644 645 // Filter & return 646 return (string) apply_filters( 'bbp_get_user_profile_edit_link', $link, $user_id ); 647 } 648 649 /** 650 * Output URL to the profile edit page of a user 619 620 /** 621 * Return link to the profile edit page of a user. 651 622 * 652 623 * @since 2.0.0 bbPress (r2688) 653 624 * 654 * @param int $user_id Optional. User id 655 * @param string $user_nicename Optional. User nicename 625 * @param int $user_id Optional. User id. 626 * @return string User profile edit link. 627 */ 628 function bbp_get_user_profile_edit_link( $user_id = 0 ) { 629 630 // Validate user id 631 $user_id = bbp_get_user_id( $user_id ); 632 if ( empty( $user_id ) ) { 633 return false; 634 } 635 636 // Get the user 637 $user = get_userdata( $user_id ); 638 if ( empty( $user ) ) { 639 return false; 640 } 641 642 // Display Name 643 $name = ! empty( $user->display_name ) 644 ? $user->display_name 645 : bbp_get_fallback_display_name(); 646 647 // URL 648 $url = bbp_get_user_profile_edit_url( $user_id ); 649 650 // Link 651 $link = ! empty( $url ) 652 ? '<a href="' . esc_url( $url ) . '">' . esc_html( $name ) . '</a>' 653 : esc_html( $name ); 654 655 // Filter & return 656 return (string) apply_filters( 'bbp_get_user_profile_edit_link', $link, $user_id ); 657 } 658 659 /** 660 * Output URL to the profile edit page of a user. 661 * 662 * @since 2.0.0 bbPress (r2688) 663 * 664 * @param int $user_id Optional. User id. 665 * @param string $user_nicename Optional. User nicename. 656 666 */ 657 667 function bbp_user_profile_edit_url( $user_id = 0, $user_nicename = '' ) { 658 668 echo esc_url( bbp_get_user_profile_edit_url( $user_id, $user_nicename ) ); 659 669 } 660 /** 661 * Return URL to the profile edit page of a user 662 * 663 * @since 2.0.0 bbPress (r2688) 664 * 665 * @param int $user_id Optional. User id 666 * @param string $user_nicename Optional. User nicename 667 * @return string 668 */ 669 function bbp_get_user_profile_edit_url( $user_id = 0, $user_nicename = '' ) { 670 671 $user_id = bbp_get_user_id( $user_id ); 672 if ( empty( $user_id ) ) { 673 return false; 674 } 675 676 // Bail if intercepted 677 $intercept = bbp_maybe_intercept( 'bbp_pre_get_user_profile_edit_url', func_get_args() ); 678 if ( bbp_is_intercepted( $intercept ) ) { 679 return $intercept; 680 } 681 682 // Get user profile URL 683 $profile_url = bbp_get_user_profile_url( $user_id, $user_nicename ); 684 685 // Pretty permalinks 686 if ( bbp_use_pretty_urls() ) { 687 $url = trailingslashit( $profile_url ) . bbp_get_edit_slug(); 688 $url = user_trailingslashit( $url ); 689 690 // Unpretty permalinks 691 } else { 692 $url = add_query_arg( 693 array( 694 bbp_get_edit_rewrite_id() => '1' 695 ), 696 $profile_url 697 ); 698 } 699 700 // Filter & return 701 return apply_filters( 'bbp_get_user_edit_profile_url', $url, $user_id, $user_nicename ); 702 } 703 704 /** 705 * Output a user's main role for display 670 671 /** 672 * Return URL to the profile edit page of a user. 673 * 674 * @since 2.0.0 bbPress (r2688) 675 * 676 * @param int $user_id Optional. User id. 677 * @param string $user_nicename Optional. User nicename. 678 * @return string 679 */ 680 function bbp_get_user_profile_edit_url( $user_id = 0, $user_nicename = '' ) { 681 682 $user_id = bbp_get_user_id( $user_id ); 683 if ( empty( $user_id ) ) { 684 return false; 685 } 686 687 // Bail if intercepted 688 $intercept = bbp_maybe_intercept( 'bbp_pre_get_user_profile_edit_url', func_get_args() ); 689 if ( bbp_is_intercepted( $intercept ) ) { 690 return $intercept; 691 } 692 693 // Get user profile URL 694 $profile_url = bbp_get_user_profile_url( $user_id, $user_nicename ); 695 696 // Pretty permalinks 697 if ( bbp_use_pretty_urls() ) { 698 $url = trailingslashit( $profile_url ) . bbp_get_edit_slug(); 699 $url = user_trailingslashit( $url ); 700 701 // Unpretty permalinks 702 } else { 703 $url = add_query_arg( 704 array( 705 bbp_get_edit_rewrite_id() => '1' 706 ), 707 $profile_url 708 ); 709 } 710 711 // Filter & return 712 return apply_filters( 'bbp_get_user_edit_profile_url', $url, $user_id, $user_nicename ); 713 } 714 715 /** 716 * Output a user's main role for display. 706 717 * 707 718 * @since 2.1.0 bbPress (r3860) 708 719 * 709 * @param int $user_id 720 * @param int $user_id User id. 710 721 */ 711 722 function bbp_user_display_role( $user_id = 0 ) { 712 723 echo esc_attr( bbp_get_user_display_role( $user_id ) ); 713 724 } 714 /** 715 * Return a user's main role for display 716 * 717 * @since 2.1.0 bbPress (r3860) 718 * 719 * @param int $user_id 720 * @return string 721 */ 722 function bbp_get_user_display_role( $user_id = 0 ) { 723 724 // Validate user id 725 $user_id = bbp_get_user_id( $user_id ); 726 727 // User is not registered 728 if ( empty( $user_id ) ) { 729 $role = esc_html__( 'Guest', 'bbpress' ); 730 731 // User is not active 732 } elseif ( bbp_is_user_inactive( $user_id ) ) { 733 $role = esc_html__( 'Inactive', 'bbpress' ); 734 735 // User have a role 736 } else { 737 $role_id = bbp_get_user_role( $user_id ); 738 $role = bbp_get_dynamic_role_name( $role_id ); 739 } 740 741 // No role found so default to generic "Member" 742 if ( empty( $role ) ) { 743 $role = esc_html__( 'Member', 'bbpress' ); 744 } 745 746 // Filter & return 747 return apply_filters( 'bbp_get_user_display_role', $role, $user_id ); 748 } 749 750 /** 751 * Output the link to the admin section 725 726 /** 727 * Return a user's main role for display. 728 * 729 * @since 2.1.0 bbPress (r3860) 730 * 731 * @param int $user_id User id. 732 * @return string 733 */ 734 function bbp_get_user_display_role( $user_id = 0 ) { 735 736 // Validate user id 737 $user_id = bbp_get_user_id( $user_id ); 738 739 // User is not registered 740 if ( empty( $user_id ) ) { 741 $role = esc_html__( 'Guest', 'bbpress' ); 742 743 // User is not active 744 } elseif ( bbp_is_user_inactive( $user_id ) ) { 745 $role = esc_html__( 'Inactive', 'bbpress' ); 746 747 // User have a role 748 } else { 749 $role_id = bbp_get_user_role( $user_id ); 750 $role = bbp_get_dynamic_role_name( $role_id ); 751 } 752 753 // No role found so default to generic "Member" 754 if ( empty( $role ) ) { 755 $role = esc_html__( 'Member', 'bbpress' ); 756 } 757 758 // Filter & return 759 return apply_filters( 'bbp_get_user_display_role', $role, $user_id ); 760 } 761 762 /** 763 * Output the link to the admin section. 752 764 * 753 765 * @since 2.0.0 bbPress (r2827) 754 766 * 755 * @param array $args Optional. See {@link bbp_get_admin_link()} 767 * @param array $args Optional. See {@link bbp_get_admin_link()}. 756 768 */ 757 769 function bbp_admin_link( $args = array() ) { 758 770 echo bbp_get_admin_link( $args ); 759 771 } 760 /** 761 * Return the link to the admin section 762 * 763 * @since 2.0.0 bbPress (r2827) 764 * 765 * @param array $args Optional. This function supports these arguments: 766 * - text: The text 767 * - before: Before the lnk 768 * - after: After the link 769 * @return The link 770 */ 771 function bbp_get_admin_link( $args = array() ) { 772 773 // Bail if user cannot globally moderate 774 if ( ! current_user_can( 'moderate' ) ) { 775 return; 776 } 777 778 if ( ! empty( $args ) && is_string( $args ) && ( false === strpos( $args, '=' ) ) ) { 779 $args = array( 'text' => $args ); 780 } 781 782 // Parse arguments against default values 783 $r = bbp_parse_args( 784 $args, 785 array( 786 'text' => esc_html__( 'Admin', 'bbpress' ), 787 'before' => '', 788 'after' => '' 789 ), 790 'get_admin_link' 791 ); 792 793 $retval = $r['before'] . '<a href="' . esc_url( admin_url() ) . '">' . $r['text'] . '</a>' . $r['after']; 794 795 // Filter & return 796 return apply_filters( 'bbp_get_admin_link', $retval, $r, $args ); 797 } 772 773 /** 774 * Return the link to the admin section. 775 * 776 * @since 2.0.0 bbPress (r2827) 777 * 778 * @param array $args Optional. This function supports these arguments: 779 * - text: The text 780 * - before: Before the lnk 781 * - after: After the link 782 * @return The link. 783 */ 784 function bbp_get_admin_link( $args = array() ) { 785 786 // Bail if user cannot globally moderate 787 if ( ! current_user_can( 'moderate' ) ) { 788 return; 789 } 790 791 if ( ! empty( $args ) && is_string( $args ) && ( false === strpos( $args, '=' ) ) ) { 792 $args = array( 'text' => $args ); 793 } 794 795 // Parse arguments against default values 796 $r = bbp_parse_args( 797 $args, 798 array( 799 'text' => esc_html__( 'Admin', 'bbpress' ), 800 'before' => '', 801 'after' => '' 802 ), 803 'get_admin_link' 804 ); 805 806 $retval = $r['before'] . '<a href="' . esc_url( admin_url() ) . '">' . $r['text'] . '</a>' . $r['after']; 807 808 // Filter & return 809 return apply_filters( 'bbp_get_admin_link', $retval, $r, $args ); 810 } 798 811 799 812 /** User IP *******************************************************************/ 800 813 801 814 /** 802 * Output the author IP address of a post 815 * Output the author IP address of a post. 803 816 * 804 817 * @since 2.0.0 bbPress (r3120) … … 809 822 echo bbp_get_author_ip( $args ); 810 823 } 811 /** 812 * Return the author IP address of a post 813 * 814 * @since 2.0.0 bbPress (r3120) 815 * 816 * @param array $args Optional. If an integer, it is used as reply id. 817 * @return string Author link of reply 818 */ 819 function bbp_get_author_ip( $args = array() ) { 820 821 // Used as post id 822 $post_id = is_numeric( $args ) ? (int) $args : 0; 823 824 // Parse arguments against default values 825 $r = bbp_parse_args( 826 $args, 827 array( 828 'post_id' => $post_id, 829 'before' => '<span class="bbp-author-ip">(', 830 'after' => ')</span>' 831 ), 832 'get_author_ip' 833 ); 834 835 // Get the author IP meta value 836 $author_ip = get_post_meta( $r['post_id'], '_bbp_author_ip', true ); 837 $author_ip = ! empty( $author_ip ) 838 ? $r['before'] . esc_html( $author_ip ) . $r['after'] 839 : ''; 840 841 // Filter & return 842 return apply_filters( 'bbp_get_author_ip', $author_ip, $r, $args ); 843 } 824 825 /** 826 * Return the author IP address of a post. 827 * 828 * @since 2.0.0 bbPress (r3120) 829 * 830 * @param array $args Optional. If an integer, it is used as reply id. 831 * @return string Author link of reply. 832 */ 833 function bbp_get_author_ip( $args = array() ) { 834 835 // Used as post id 836 $post_id = is_numeric( $args ) ? (int) $args : 0; 837 838 // Parse arguments against default values 839 $r = bbp_parse_args( 840 $args, 841 array( 842 'post_id' => $post_id, 843 'before' => '<span class="bbp-author-ip">(', 844 'after' => ')</span>' 845 ), 846 'get_author_ip' 847 ); 848 849 // Get the author IP meta value 850 $author_ip = get_post_meta( $r['post_id'], '_bbp_author_ip', true ); 851 $author_ip = ! empty( $author_ip ) 852 ? $r['before'] . esc_html( $author_ip ) . $r['after'] 853 : ''; 854 855 // Filter & return 856 return apply_filters( 'bbp_get_author_ip', $author_ip, $r, $args ); 857 } 844 858 845 859 /** Anonymous Fields **********************************************************/ … … 853 867 * @since 2.6.0 bbPress (r6561) 854 868 * 855 * @param int $object_id For additional context only, usually a post ID 869 * @param int $object_id For additional context only, usually a post ID. 856 870 * 857 871 * @return string … … 873 887 * @since 2.5.0 bbPress (r5119) 874 888 * 875 * @param int $post_id 889 * @param int $post_id Post id. 876 890 */ 877 891 function bbp_author_display_name( $post_id = 0 ) { … … 879 893 } 880 894 881 /**882 * Return the author display-name of a topic or reply.883 *884 * Convenience function to ensure proper template functions are called885 * and correct filters are executed. Used primarily to display topic886 * and reply author information in the anonymous form template-part.887 *888 * @since 2.5.0 bbPress (r5119)889 *890 * @param int $post_id 891 *892 * @return string The name of the author 893 */894 function bbp_get_author_display_name( $post_id = 0 ) {895 896 // Define local variable(s)897 $retval = '';898 899 // Topic edit900 if ( bbp_is_topic_edit() ) {901 $retval = bbp_get_topic_author_display_name( $post_id );902 903 // Reply edit904 } elseif ( bbp_is_reply_edit() ) {905 $retval = bbp_get_reply_author_display_name( $post_id );906 907 // Not an edit, so rely on current user cookie data908 } else {909 $retval = bbp_get_current_anonymous_user_data( 'name' );910 }911 912 // Filter & return913 return apply_filters( 'bbp_get_author_display_name', $retval, $post_id );914 }895 /** 896 * Return the author display-name of a topic or reply. 897 * 898 * Convenience function to ensure proper template functions are called 899 * and correct filters are executed. Used primarily to display topic 900 * and reply author information in the anonymous form template-part. 901 * 902 * @since 2.5.0 bbPress (r5119) 903 * 904 * @param int $post_id Post id. 905 * 906 * @return string The name of the author. 907 */ 908 function bbp_get_author_display_name( $post_id = 0 ) { 909 910 // Define local variable(s) 911 $retval = ''; 912 913 // Topic edit 914 if ( bbp_is_topic_edit() ) { 915 $retval = bbp_get_topic_author_display_name( $post_id ); 916 917 // Reply edit 918 } elseif ( bbp_is_reply_edit() ) { 919 $retval = bbp_get_reply_author_display_name( $post_id ); 920 921 // Not an edit, so rely on current user cookie data 922 } else { 923 $retval = bbp_get_current_anonymous_user_data( 'name' ); 924 } 925 926 // Filter & return 927 return apply_filters( 'bbp_get_author_display_name', $retval, $post_id ); 928 } 915 929 916 930 /** … … 923 937 * @since 2.5.0 bbPress (r5119) 924 938 * 925 * @param int $post_id 939 * @param int $post_id Post id. 926 940 */ 927 941 function bbp_author_email( $post_id = 0 ) { … … 929 943 } 930 944 931 /** 932 * Return the author email of a topic or reply. 933 * 934 * Convenience function to ensure proper template functions are called 935 * and correct filters are executed. Used primarily to display topic 936 * and reply author information in the anonymous user form template-part. 937 * 938 * @since 2.5.0 bbPress (r5119) 939 * 940 * @param int $post_id 941 * 942 * @return string The email of the author 943 */ 944 function bbp_get_author_email( $post_id = 0 ) { 945 946 // Define local variable(s) 947 $retval = ''; 948 949 // Topic edit 950 if ( bbp_is_topic_edit() ) { 951 $retval = bbp_get_topic_author_email( $post_id ); 952 953 // Reply edit 954 } elseif ( bbp_is_reply_edit() ) { 955 $retval = bbp_get_reply_author_email( $post_id ); 956 957 // Not an edit, so rely on current user cookie data 958 } else { 959 $retval = bbp_get_current_anonymous_user_data( 'email' ); 960 } 961 962 // Filter & return 963 return apply_filters( 'bbp_get_author_email', $retval, $post_id ); 964 } 965 966 /** 967 * Output the author url of a topic or reply. 945 /** 946 * Return the author email of a topic or reply. 968 947 * 969 948 * Convenience function to ensure proper template functions are called … … 973 952 * @since 2.5.0 bbPress (r5119) 974 953 * 975 * @param int $post_id 954 * @param int $post_id Post id. 955 * 956 * @return string The email of the author. 957 */ 958 function bbp_get_author_email( $post_id = 0 ) { 959 960 // Define local variable(s) 961 $retval = ''; 962 963 // Topic edit 964 if ( bbp_is_topic_edit() ) { 965 $retval = bbp_get_topic_author_email( $post_id ); 966 967 // Reply edit 968 } elseif ( bbp_is_reply_edit() ) { 969 $retval = bbp_get_reply_author_email( $post_id ); 970 971 // Not an edit, so rely on current user cookie data 972 } else { 973 $retval = bbp_get_current_anonymous_user_data( 'email' ); 974 } 975 976 // Filter & return 977 return apply_filters( 'bbp_get_author_email', $retval, $post_id ); 978 } 979 980 /** 981 * Output the author url of a topic or reply. 982 * 983 * Convenience function to ensure proper template functions are called 984 * and correct filters are executed. Used primarily to display topic 985 * and reply author information in the anonymous user form template-part. 986 * 987 * @since 2.5.0 bbPress (r5119) 988 * 989 * @param int $post_id Post id. 976 990 */ 977 991 function bbp_author_url( $post_id = 0 ) { … … 979 993 } 980 994 981 /**982 * Return the author url of a topic or reply.983 *984 * Convenience function to ensure proper template functions are called985 * and correct filters are executed. Used primarily to display topic986 * and reply author information in the anonymous user form template-part.987 *988 * @since 2.5.0 bbPress (r5119)989 *990 * @param int $post_id 991 *992 * @return string The url of the author 993 */994 function bbp_get_author_url( $post_id = 0 ) {995 996 // Define local variable(s)997 $retval = '';998 999 // Topic edit1000 if ( bbp_is_topic_edit() ) {1001 $retval = bbp_get_topic_author_url( $post_id );1002 1003 // Reply edit1004 } elseif ( bbp_is_reply_edit() ) {1005 $retval = bbp_get_reply_author_url( $post_id );1006 1007 // Not an edit, so rely on current user cookie data1008 } else {1009 $retval = bbp_get_current_anonymous_user_data( 'url' );1010 }1011 1012 // Filter & return1013 return apply_filters( 'bbp_get_author_url', $retval, $post_id );1014 }995 /** 996 * Return the author url of a topic or reply. 997 * 998 * Convenience function to ensure proper template functions are called 999 * and correct filters are executed. Used primarily to display topic 1000 * and reply author information in the anonymous user form template-part. 1001 * 1002 * @since 2.5.0 bbPress (r5119) 1003 * 1004 * @param int $post_id Post id. 1005 * 1006 * @return string The url of the author. 1007 */ 1008 function bbp_get_author_url( $post_id = 0 ) { 1009 1010 // Define local variable(s) 1011 $retval = ''; 1012 1013 // Topic edit 1014 if ( bbp_is_topic_edit() ) { 1015 $retval = bbp_get_topic_author_url( $post_id ); 1016 1017 // Reply edit 1018 } elseif ( bbp_is_reply_edit() ) { 1019 $retval = bbp_get_reply_author_url( $post_id ); 1020 1021 // Not an edit, so rely on current user cookie data 1022 } else { 1023 $retval = bbp_get_current_anonymous_user_data( 'url' ); 1024 } 1025 1026 // Filter & return 1027 return apply_filters( 'bbp_get_author_url', $retval, $post_id ); 1028 } 1015 1029 1016 1030 /** Favorites *****************************************************************/ 1017 1031 1018 1032 /** 1019 * Output the link to the user's favorites page (profile page) 1033 * Output the link to the user's favorites page (profile page). 1020 1034 * 1021 1035 * @since 2.0.0 bbPress (r2652) 1022 1036 * @since 2.6.0 bbPress (r6308) Add pagination if in the loop 1023 1037 * 1024 * @param int $user_id Optional. User id 1038 * @param int $user_id Optional. User id. 1025 1039 */ 1026 1040 function bbp_favorites_permalink( $user_id = 0 ) { 1027 1041 echo esc_url( bbp_get_favorites_permalink( $user_id ) ); 1028 1042 } 1029 /** 1030 * Return the link to the user's favorites page (profile page) 1031 * 1032 * @since 2.0.0 bbPress (r2652) 1033 * @since 2.6.0 bbPress (r6308) Add pagination if in the loop 1034 * 1035 * @param int $user_id Optional. User id 1036 * @return string Permanent link to user profile page 1037 */ 1038 function bbp_get_favorites_permalink( $user_id = 0 ) { 1039 1040 // Use displayed user ID if there is one, and one isn't requested 1041 $user_id = bbp_get_user_id( $user_id ); 1042 if ( empty( $user_id ) ) { 1043 return false; 1043 1044 /** 1045 * Return the link to the user's favorites page (profile page). 1046 * 1047 * @since 2.0.0 bbPress (r2652) 1048 * @since 2.6.0 bbPress (r6308) Add pagination if in the loop 1049 * 1050 * @param int $user_id Optional. User id. 1051 * @return string Permanent link to user profile page. 1052 */ 1053 function bbp_get_favorites_permalink( $user_id = 0 ) { 1054 1055 // Use displayed user ID if there is one, and one isn't requested 1056 $user_id = bbp_get_user_id( $user_id ); 1057 if ( empty( $user_id ) ) { 1058 return false; 1059 } 1060 1061 // Bail if intercepted 1062 $intercept = bbp_maybe_intercept( 'bbp_pre_get_favorites_permalink', func_get_args() ); 1063 if ( bbp_is_intercepted( $intercept ) ) { 1064 return $intercept; 1065 } 1066 1067 // Get user profile URL & page 1068 $profile_url = bbp_get_user_profile_url( $user_id ); 1069 $page = (int) bbpress()->topic_query->paged; 1070 $paged = (bool) bbpress()->topic_query->in_the_loop; 1071 1072 // Pretty permalinks 1073 if ( bbp_use_pretty_urls() ) { 1074 1075 // Base URL 1076 $url = trailingslashit( $profile_url ) . bbp_get_user_favorites_slug(); 1077 1078 // Add page 1079 if ( ( true === $paged ) && ( $page > 1 ) ) { 1080 $url = trailingslashit( $url ) . bbp_get_paged_slug() . '/' . $page; 1044 1081 } 1045 1082 1046 // Bail if intercepted 1047 $intercept = bbp_maybe_intercept( 'bbp_pre_get_favorites_permalink', func_get_args() ); 1048 if ( bbp_is_intercepted( $intercept ) ) { 1049 return $intercept; 1083 // Ensure correct trailing slash 1084 $url = user_trailingslashit( $url ); 1085 1086 // Unpretty permalinks 1087 } else { 1088 1089 // Base arguments 1090 $args = array( 1091 bbp_get_user_favorites_rewrite_id() => bbp_get_user_favorites_slug(), 1092 ); 1093 1094 // Add page 1095 if ( ( true === $paged ) && ( $page > 1 ) ) { 1096 $args['page'] = $page; 1050 1097 } 1051 1098 1052 // Get user profile URL & page 1053 $profile_url = bbp_get_user_profile_url( $user_id ); 1054 $page = (int) bbpress()->topic_query->paged; 1055 $paged = (bool) bbpress()->topic_query->in_the_loop; 1056 1057 // Pretty permalinks 1058 if ( bbp_use_pretty_urls() ) { 1059 1060 // Base URL 1061 $url = trailingslashit( $profile_url ) . bbp_get_user_favorites_slug(); 1062 1063 // Add page 1064 if ( ( true === $paged ) && ( $page > 1 ) ) { 1065 $url = trailingslashit( $url ) . bbp_get_paged_slug() . '/' . $page; 1066 } 1067 1068 // Ensure correct trailing slash 1069 $url = user_trailingslashit( $url ); 1070 1071 // Unpretty permalinks 1072 } else { 1073 1074 // Base arguments 1075 $args = array( 1076 bbp_get_user_favorites_rewrite_id() => bbp_get_user_favorites_slug(), 1077 ); 1078 1079 // Add page 1080 if ( ( true === $paged ) && ( $page > 1 ) ) { 1081 $args['page'] = $page; 1082 } 1083 1084 // Add arguments 1085 $url = add_query_arg( $args, $profile_url ); 1086 } 1087 1088 // Filter & return 1089 return apply_filters( 'bbp_get_favorites_permalink', $url, $user_id ); 1090 } 1091 1092 /** 1093 * Output the link to make a topic favorite/remove a topic from favorites 1099 // Add arguments 1100 $url = add_query_arg( $args, $profile_url ); 1101 } 1102 1103 // Filter & return 1104 return apply_filters( 'bbp_get_favorites_permalink', $url, $user_id ); 1105 } 1106 1107 /** 1108 * Output the link to make a topic favorite/remove a topic from favorites. 1094 1109 * 1095 1110 * @since 2.0.0 bbPress (r2652) 1096 1111 * @since 2.6.0 bbPress (r6308) Add 'redirect_to' support 1097 1112 * 1098 * @param array $args See {@link bbp_get_user_favorites_link()} 1099 * @param int $user_id Optional. User id 1113 * @param array $args See {@link bbp_get_user_favorites_link()}. 1114 * @param int $user_id Optional. User id. 1100 1115 * @param bool $wrap Optional. If you want to wrap the link in <span id="favorite-toggle">. 1101 1116 */ … … 1103 1118 echo bbp_get_user_favorites_link( $args, $user_id, $wrap ); 1104 1119 } 1105 /** 1106 * User favorites link 1107 * 1108 * Return the link to make a topic favorite/remove a topic from 1109 * favorites 1110 * 1111 * @since 2.0.0 bbPress (r2652) 1112 * @since 2.6.0 bbPress (r6308) Add 'redirect_to' support 1113 * 1114 * @param array $args This function supports these arguments: 1115 * - subscribe: Favorite text 1116 * - unsubscribe: Unfavorite text 1117 * - user_id: User id 1118 * - topic_id: Topic id 1119 * - before: Before the link 1120 * - after: After the link 1121 * @param int $user_id Optional. User id 1122 * @param int $topic_id Optional. Topic id 1123 * @param bool $wrap Optional. If you want to wrap the link in <span id="favorite-toggle">. See ajax_favorite() 1124 * @return string User favorites link 1125 */ 1126 function bbp_get_user_favorites_link( $args = array(), $user_id = 0, $wrap = true ) { 1127 1128 // Bail if favorites are inactive 1129 if ( ! bbp_is_favorites_active() ) { 1130 return false; 1131 } 1132 1133 // Parse arguments against default values 1134 $r = bbp_parse_args( 1135 $args, 1136 array( 1137 'favorite' => esc_html__( 'Favorite', 'bbpress' ), 1138 'favorited' => esc_html__( 'Unfavorite', 'bbpress' ), 1139 'user_id' => 0, 1140 'object_id' => 0, 1141 'object_type' => 'post', 1142 'before' => '', 1143 'after' => '', 1144 'redirect_to' => '', 1145 1146 // Deprecated. Use object_id. 1147 'forum_id' => 0, 1148 'topic_id' => 0 1149 ), 1150 'get_user_favorites_link' 1120 1121 /** 1122 * User favorites link. 1123 * 1124 * Return the link to make a topic favorite/remove a topic from 1125 * favorites. 1126 * 1127 * @since 2.0.0 bbPress (r2652) 1128 * @since 2.6.0 bbPress (r6308) Add 'redirect_to' support 1129 * 1130 * @param array $args This function supports these arguments: 1131 * - subscribe: Favorite text 1132 * - unsubscribe: Unfavorite text 1133 * - user_id: User id 1134 * - topic_id: Topic id 1135 * - before: Before the link 1136 * - after: After the link 1137 * @param int $user_id Optional. User id. 1138 * @param int $topic_id Optional. Topic id. 1139 * @param bool $wrap Optional. If you want to wrap the link in <span id="favorite-toggle">. See ajax_favorite(). 1140 * @return string User favorites link. 1141 */ 1142 function bbp_get_user_favorites_link( $args = array(), $user_id = 0, $wrap = true ) { 1143 1144 // Bail if favorites are inactive 1145 if ( ! bbp_is_favorites_active() ) { 1146 return false; 1147 } 1148 1149 // Parse arguments against default values 1150 $r = bbp_parse_args( 1151 $args, 1152 array( 1153 'favorite' => esc_html__( 'Favorite', 'bbpress' ), 1154 'favorited' => esc_html__( 'Unfavorite', 'bbpress' ), 1155 'user_id' => 0, 1156 'object_id' => 0, 1157 'object_type' => 'post', 1158 'before' => '', 1159 'after' => '', 1160 'redirect_to' => '', 1161 1162 // Deprecated. Use object_id. 1163 'forum_id' => 0, 1164 'topic_id' => 0 1165 ), 1166 'get_user_favorites_link' 1167 ); 1168 1169 // Validate user and object ID's 1170 $user_id = bbp_get_user_id( $r['user_id'], true, true ); 1171 $object_type = sanitize_key( $r['object_type'] ); 1172 1173 // Back-compat for deprecated arguments 1174 if ( ! empty( $r['topic_id'] ) ) { 1175 $object_id = absint( $r['topic_id'] ); 1176 } elseif ( ! empty( $r['forum_id'] ) ) { 1177 $object_id = absint( $r['forum_id'] ); 1178 } else { 1179 $object_id = absint( $r['object_id'] ); 1180 } 1181 1182 // Bail if empty 1183 if ( empty( $user_id ) || empty( $object_id ) || empty( $object_type ) ) { 1184 return false; 1185 } 1186 1187 // No link if you can't edit yourself 1188 if ( ! current_user_can( 'edit_user', $user_id ) ) { 1189 return false; 1190 } 1191 1192 // Decide which link to show 1193 $is_fav = bbp_is_user_favorite( $user_id, $object_id ); 1194 if ( ! empty( $is_fav ) ) { 1195 $text = $r['favorited']; 1196 $q_args = array( 1197 'action' => 'bbp_favorite_remove', 1198 'object_id' => $object_id 1151 1199 ); 1152 1153 // Validate user and object ID's 1154 $user_id = bbp_get_user_id( $r['user_id'], true, true ); 1155 $object_type = sanitize_key( $r['object_type'] ); 1156 1157 // Back-compat for deprecated arguments 1158 if ( ! empty( $r['topic_id'] ) ) { 1159 $object_id = absint( $r['topic_id'] ); 1160 } elseif ( ! empty( $r['forum_id'] ) ) { 1161 $object_id = absint( $r['forum_id'] ); 1162 } else { 1163 $object_id = absint( $r['object_id'] ); 1164 } 1165 1166 // Bail if empty 1167 if ( empty( $user_id ) || empty( $object_id ) || empty( $object_type ) ) { 1168 return false; 1169 } 1170 1171 // No link if you can't edit yourself 1172 if ( ! current_user_can( 'edit_user', $user_id ) ) { 1173 return false; 1174 } 1175 1176 // Decide which link to show 1177 $is_fav = bbp_is_user_favorite( $user_id, $object_id ); 1178 if ( ! empty( $is_fav ) ) { 1179 $text = $r['favorited']; 1180 $q_args = array( 1181 'action' => 'bbp_favorite_remove', 1182 'object_id' => $object_id 1183 ); 1184 } else { 1185 $text = $r['favorite']; 1186 $q_args = array( 1187 'action' => 'bbp_favorite_add', 1188 'object_id' => $object_id 1189 ); 1190 } 1191 1192 // Custom redirect 1193 if ( ! empty( $r['redirect_to'] ) ) { 1194 $q_args['redirect_to'] = urlencode( $r['redirect_to'] ); 1195 } 1196 1197 // URL 1198 $url = esc_url( wp_nonce_url( add_query_arg( $q_args ), 'toggle-favorite_' . $object_id ) ); 1199 $sub = $is_fav ? ' class="is-favorite"' : ''; 1200 $html = sprintf( '%s<span id="favorite-%d" %s><a href="%s" class="favorite-toggle" data-bbp-object-id="%d" data-bbp-object-type="%s" data-bbp-nonce="%s">%s</a></span>%s', $r['before'], $object_id, $sub, $url, $object_id, $object_type, wp_create_nonce( 'toggle-favorite_' . $object_id ), $text, $r['after'] ); 1201 1202 // Initial output is wrapped in a span, ajax output is hooked to this 1203 if ( ! empty( $wrap ) ) { 1204 $html = '<span id="favorite-toggle">' . $html . '</span>'; 1205 } 1206 1207 // Filter & return 1208 return apply_filters( 'bbp_get_user_favorites_link', $html, $r, $user_id, $object_id ); 1209 } 1200 } else { 1201 $text = $r['favorite']; 1202 $q_args = array( 1203 'action' => 'bbp_favorite_add', 1204 'object_id' => $object_id 1205 ); 1206 } 1207 1208 // Custom redirect 1209 if ( ! empty( $r['redirect_to'] ) ) { 1210 $q_args['redirect_to'] = urlencode( $r['redirect_to'] ); 1211 } 1212 1213 // URL 1214 $url = esc_url( wp_nonce_url( add_query_arg( $q_args ), 'toggle-favorite_' . $object_id ) ); 1215 $sub = $is_fav ? ' class="is-favorite"' : ''; 1216 $html = sprintf( '%s<span id="favorite-%d" %s><a href="%s" class="favorite-toggle" data-bbp-object-id="%d" data-bbp-object-type="%s" data-bbp-nonce="%s">%s</a></span>%s', $r['before'], $object_id, $sub, $url, $object_id, $object_type, wp_create_nonce( 'toggle-favorite_' . $object_id ), $text, $r['after'] ); 1217 1218 // Initial output is wrapped in a span, ajax output is hooked to this 1219 if ( ! empty( $wrap ) ) { 1220 $html = '<span id="favorite-toggle">' . $html . '</span>'; 1221 } 1222 1223 // Filter & return 1224 return apply_filters( 'bbp_get_user_favorites_link', $html, $r, $user_id, $object_id ); 1225 } 1210 1226 1211 1227 /** Subscriptions *************************************************************/ 1212 1228 1213 1229 /** 1214 * Output the link to the user's subscriptions page (profile page) 1230 * Output the link to the user's subscriptions page (profile page). 1215 1231 * 1216 1232 * @since 2.0.0 bbPress (r2688) 1217 1233 * @since 2.6.0 bbPress (r6308) Add pagination if in the loop 1218 1234 * 1219 * @param int $user_id Optional. User id 1235 * @param int $user_id Optional. User id. 1220 1236 */ 1221 1237 function bbp_subscriptions_permalink( $user_id = 0 ) { 1222 1238 echo esc_url( bbp_get_subscriptions_permalink( $user_id ) ); 1223 1239 } 1224 /** 1225 * Return the link to the user's subscriptions page (profile page) 1226 * 1227 * @since 2.0.0 bbPress (r2688) 1228 * @since 2.6.0 bbPress (r6308) Add pagination if in the loop 1229 * 1230 * @param int $user_id Optional. User id 1231 * @return string Permanent link to user subscriptions page 1232 */ 1233 function bbp_get_subscriptions_permalink( $user_id = 0 ) { 1234 1235 // Use displayed user ID if there is one, and one isn't requested 1236 $user_id = bbp_get_user_id( $user_id ); 1237 if ( empty( $user_id ) ) { 1238 return false; 1240 1241 /** 1242 * Return the link to the user's subscriptions page (profile page). 1243 * 1244 * @since 2.0.0 bbPress (r2688) 1245 * @since 2.6.0 bbPress (r6308) Add pagination if in the loop 1246 * 1247 * @param int $user_id Optional. User id. 1248 * @return string Permanent link to user subscriptions page. 1249 */ 1250 function bbp_get_subscriptions_permalink( $user_id = 0 ) { 1251 1252 // Use displayed user ID if there is one, and one isn't requested 1253 $user_id = bbp_get_user_id( $user_id ); 1254 if ( empty( $user_id ) ) { 1255 return false; 1256 } 1257 1258 // Bail if intercepted 1259 $intercept = bbp_maybe_intercept( 'bbp_pre_get_subscriptions_permalink', func_get_args() ); 1260 if ( bbp_is_intercepted( $intercept ) ) { 1261 return $intercept; 1262 } 1263 1264 // Get user profile URL 1265 $profile_url = bbp_get_user_profile_url( $user_id ); 1266 $page = 0; 1267 $paged = false; 1268 1269 // Get pagination data 1270 if ( bbpress()->topic_query->in_the_loop ) { 1271 $page = (int) bbpress()->topic_query->paged; 1272 $paged = (bool) bbpress()->topic_query->in_the_loop; 1273 1274 } elseif ( bbpress()->forum_query->in_the_loop ) { 1275 $page = (int) bbpress()->forum_query->paged; 1276 $paged = (bool) bbpress()->forum_query->in_the_loop; 1277 } 1278 1279 // Pretty permalinks 1280 if ( bbp_use_pretty_urls() ) { 1281 1282 // Base URL 1283 $url = trailingslashit( $profile_url ) . bbp_get_user_subscriptions_slug(); 1284 1285 // Add page 1286 if ( ( true === $paged ) && ( $page > 1 ) ) { 1287 $url = trailingslashit( $url ) . bbp_get_paged_slug() . '/' . $page; 1239 1288 } 1240 1289 1241 // Bail if intercepted 1242 $intercept = bbp_maybe_intercept( 'bbp_pre_get_subscriptions_permalink', func_get_args() ); 1243 if ( bbp_is_intercepted( $intercept ) ) { 1244 return $intercept; 1290 // Ensure correct trailing slash 1291 $url = user_trailingslashit( $url ); 1292 1293 // Unpretty permalinks 1294 } else { 1295 1296 // Base arguments 1297 $args = array( 1298 bbp_get_user_subscriptions_rewrite_id() => bbp_get_user_subscriptions_slug(), 1299 ); 1300 1301 // Add page 1302 if ( ( true === $paged ) && ( $page > 1 ) ) { 1303 $args['page'] = $page; 1245 1304 } 1246 1305 1247 // Get user profile URL 1248 $profile_url = bbp_get_user_profile_url( $user_id ); 1249 $page = 0; 1250 $paged = false; 1251 1252 // Get pagination data 1253 if ( bbpress()->topic_query->in_the_loop ) { 1254 $page = (int) bbpress()->topic_query->paged; 1255 $paged = (bool) bbpress()->topic_query->in_the_loop; 1256 1257 } elseif ( bbpress()->forum_query->in_the_loop ) { 1258 $page = (int) bbpress()->forum_query->paged; 1259 $paged = (bool) bbpress()->forum_query->in_the_loop; 1260 } 1261 1262 // Pretty permalinks 1263 if ( bbp_use_pretty_urls() ) { 1264 1265 // Base URL 1266 $url = trailingslashit( $profile_url ) . bbp_get_user_subscriptions_slug(); 1267 1268 // Add page 1269 if ( ( true === $paged ) && ( $page > 1 ) ) { 1270 $url = trailingslashit( $url ) . bbp_get_paged_slug() . '/' . $page; 1271 } 1272 1273 // Ensure correct trailing slash 1274 $url = user_trailingslashit( $url ); 1275 1276 // Unpretty permalinks 1277 } else { 1278 1279 // Base arguments 1280 $args = array( 1281 bbp_get_user_subscriptions_rewrite_id() => bbp_get_user_subscriptions_slug(), 1282 ); 1283 1284 // Add page 1285 if ( ( true === $paged ) && ( $page > 1 ) ) { 1286 $args['page'] = $page; 1287 } 1288 1289 // Add arguments 1290 $url = add_query_arg( $args, $profile_url ); 1291 } 1292 1293 // Filter & return 1294 return apply_filters( 'bbp_get_subscriptions_permalink', $url, $user_id ); 1295 } 1296 1297 /** 1298 * Output the link to subscribe/unsubscribe from a topic 1306 // Add arguments 1307 $url = add_query_arg( $args, $profile_url ); 1308 } 1309 1310 // Filter & return 1311 return apply_filters( 'bbp_get_subscriptions_permalink', $url, $user_id ); 1312 } 1313 1314 /** 1315 * Output the link to subscribe/unsubscribe from a topic. 1299 1316 * 1300 1317 * @since 2.0.0 bbPress (r2668) 1301 1318 * @since 2.6.0 bbPress (r6308) Add 'redirect_to' support 1302 1319 * 1303 * @param array $args See {@link bbp_get_user_subscribe_link()} 1304 * @param int $user_id Optional. User id 1320 * @param array $args See {@link bbp_get_user_subscribe_link()}. 1321 * @param int $user_id Optional. User id. 1305 1322 * @param bool $wrap Optional. If you want to wrap the link in <span id="subscription-toggle">. 1306 1323 */ … … 1308 1325 echo bbp_get_user_subscribe_link( $args, $user_id, $wrap ); 1309 1326 } 1310 /** 1311 * Return the link to subscribe/unsubscribe from a forum or topic 1312 * 1313 * @since 2.0.0 bbPress (r2668) 1314 * @since 2.6.0 bbPress (r6308) Add 'redirect_to' support 1315 * 1316 * @param array $args This function supports these arguments: 1317 * - subscribe: Subscribe text 1318 * - unsubscribe: Unsubscribe text 1319 * - user_id: User id 1320 * - topic_id: Topic id 1321 * - forum_id: Forum id 1322 * - before: Before the link 1323 * - after: After the link 1324 * @param int $user_id Optional. User id 1325 * @param bool $wrap Optional. If you want to wrap the link in <span id="subscription-toggle">. 1326 * @return string Permanent link to topic 1327 */ 1328 function bbp_get_user_subscribe_link( $args = array(), $user_id = 0, $wrap = true ) { 1329 1330 // Bail if subscriptions are inactive 1331 if ( ! bbp_is_subscriptions_active() ) { 1332 return; 1333 } 1334 1335 // Parse arguments against default values 1336 $r = bbp_parse_args( 1337 $args, 1338 array( 1339 'subscribe' => esc_html__( 'Subscribe', 'bbpress' ), 1340 'unsubscribe' => esc_html__( 'Unsubscribe', 'bbpress' ), 1341 'user_id' => 0, 1342 'object_id' => 0, 1343 'object_type' => 'post', 1344 'before' => '', 1345 'after' => '', 1346 'redirect_to' => '', 1347 1348 // Deprecated. Use object_id. 1349 'forum_id' => 0, 1350 'topic_id' => 0 1351 ), 1352 'get_user_subscribe_link' 1327 1328 /** 1329 * Return the link to subscribe/unsubscribe from a forum or topic. 1330 * 1331 * @since 2.0.0 bbPress (r2668) 1332 * @since 2.6.0 bbPress (r6308) Add 'redirect_to' support 1333 * 1334 * @param array $args This function supports these arguments: 1335 * - subscribe: Subscribe text 1336 * - unsubscribe: Unsubscribe text 1337 * - user_id: User id 1338 * - topic_id: Topic id 1339 * - forum_id: Forum id 1340 * - before: Before the link 1341 * - after: After the link 1342 * @param int $user_id Optional. User id. 1343 * @param bool $wrap Optional. If you want to wrap the link in <span id="subscription-toggle">. 1344 * @return string Permanent link to topic. 1345 */ 1346 function bbp_get_user_subscribe_link( $args = array(), $user_id = 0, $wrap = true ) { 1347 1348 // Bail if subscriptions are inactive 1349 if ( ! bbp_is_subscriptions_active() ) { 1350 return; 1351 } 1352 1353 // Parse arguments against default values 1354 $r = bbp_parse_args( 1355 $args, 1356 array( 1357 'subscribe' => esc_html__( 'Subscribe', 'bbpress' ), 1358 'unsubscribe' => esc_html__( 'Unsubscribe', 'bbpress' ), 1359 'user_id' => 0, 1360 'object_id' => 0, 1361 'object_type' => 'post', 1362 'before' => '', 1363 'after' => '', 1364 'redirect_to' => '', 1365 1366 // Deprecated. Use object_id. 1367 'forum_id' => 0, 1368 'topic_id' => 0 1369 ), 1370 'get_user_subscribe_link' 1371 ); 1372 1373 // Validate user 1374 $user_id = bbp_get_user_id( $r['user_id'], true, true ); 1375 $object_type = sanitize_key( $r['object_type'] ); 1376 1377 // Back-compat for deprecated arguments 1378 if ( ! empty( $r['topic_id'] ) ) { 1379 $object_id = absint( $r['topic_id'] ); 1380 } elseif ( ! empty( $r['forum_id'] ) ) { 1381 $object_id = absint( $r['forum_id'] ); 1382 } else { 1383 $object_id = absint( $r['object_id'] ); 1384 } 1385 1386 // Bail if anything is missing 1387 if ( empty( $user_id ) || empty( $object_id ) || empty( $object_type ) ) { 1388 return false; 1389 } 1390 1391 // No link if you can't edit yourself 1392 if ( ! current_user_can( 'edit_user', $user_id ) ) { 1393 return false; 1394 } 1395 1396 // Decide which link to show 1397 $is_subscribed = bbp_is_user_subscribed( $user_id, $object_id ); 1398 if ( ! empty( $is_subscribed ) ) { 1399 $text = $r['unsubscribe']; 1400 $q_args = array( 1401 'action' => 'bbp_unsubscribe', 1402 'object_id' => $object_id, 1403 'object_type' => $object_type 1353 1404 ); 1354 1355 // Validate user 1356 $user_id = bbp_get_user_id( $r['user_id'], true, true ); 1357 $object_type = sanitize_key( $r['object_type'] ); 1358 1359 // Back-compat for deprecated arguments 1360 if ( ! empty( $r['topic_id'] ) ) { 1361 $object_id = absint( $r['topic_id'] ); 1362 } elseif ( ! empty( $r['forum_id'] ) ) { 1363 $object_id = absint( $r['forum_id'] ); 1364 } else { 1365 $object_id = absint( $r['object_id'] ); 1366 } 1367 1368 // Bail if anything is missing 1369 if ( empty( $user_id ) || empty( $object_id ) || empty( $object_type ) ) { 1370 return false; 1371 } 1372 1373 // No link if you can't edit yourself 1374 if ( ! current_user_can( 'edit_user', $user_id ) ) { 1375 return false; 1376 } 1377 1378 // Decide which link to show 1379 $is_subscribed = bbp_is_user_subscribed( $user_id, $object_id ); 1380 if ( ! empty( $is_subscribed ) ) { 1381 $text = $r['unsubscribe']; 1382 $q_args = array( 1383 'action' => 'bbp_unsubscribe', 1384 'object_id' => $object_id, 1385 'object_type' => $object_type 1386 ); 1387 } else { 1388 $text = $r['subscribe']; 1389 $q_args = array( 1390 'action' => 'bbp_subscribe', 1391 'object_id' => $object_id, 1392 'object_type' => $object_type 1393 ); 1394 } 1395 1396 // Custom redirect 1397 if ( ! empty( $r['redirect_to'] ) ) { 1398 $q_args['redirect_to'] = urlencode( $r['redirect_to'] ); 1399 } 1400 1401 // URL 1402 $url = esc_url( wp_nonce_url( add_query_arg( $q_args ), 'toggle-subscription_' . $object_id ) ); 1403 $sub = $is_subscribed ? ' class="is-subscribed"' : ''; 1404 $html = sprintf( '%s<span id="subscribe-%d" %s><a href="%s" class="subscription-toggle" data-bbp-object-id="%d" data-bbp-object-type="%d" data-bbp-nonce="%s">%s</a></span>%s', $r['before'], $object_id, $sub, $url, $object_id, $object_type, wp_create_nonce( 'toggle-subscription_' . $object_id ), $text, $r['after'] ); 1405 1406 // Initial output is wrapped in a span, ajax output is hooked to this 1407 if ( ! empty( $wrap ) ) { 1408 $html = '<span id="subscription-toggle">' . $html . '</span>'; 1409 } 1410 1411 // Filter & return 1412 return apply_filters( 'bbp_get_user_subscribe_link', $html, $r, $user_id, $object_id ); 1413 } 1414 1405 } else { 1406 $text = $r['subscribe']; 1407 $q_args = array( 1408 'action' => 'bbp_subscribe', 1409 'object_id' => $object_id, 1410 'object_type' => $object_type 1411 ); 1412 } 1413 1414 // Custom redirect 1415 if ( ! empty( $r['redirect_to'] ) ) { 1416 $q_args['redirect_to'] = urlencode( $r['redirect_to'] ); 1417 } 1418 1419 // URL 1420 $url = esc_url( wp_nonce_url( add_query_arg( $q_args ), 'toggle-subscription_' . $object_id ) ); 1421 $sub = $is_subscribed ? ' class="is-subscribed"' : ''; 1422 $html = sprintf( '%s<span id="subscribe-%d" %s><a href="%s" class="subscription-toggle" data-bbp-object-id="%d" data-bbp-object-type="%d" data-bbp-nonce="%s">%s</a></span>%s', $r['before'], $object_id, $sub, $url, $object_id, $object_type, wp_create_nonce( 'toggle-subscription_' . $object_id ), $text, $r['after'] ); 1423 1424 // Initial output is wrapped in a span, ajax output is hooked to this 1425 if ( ! empty( $wrap ) ) { 1426 $html = '<span id="subscription-toggle">' . $html . '</span>'; 1427 } 1428 1429 // Filter & return 1430 return apply_filters( 'bbp_get_user_subscribe_link', $html, $r, $user_id, $object_id ); 1431 } 1415 1432 1416 1433 /** Edit User *****************************************************************/ 1417 1434 1418 1435 /** 1419 * Display profile edit success notice on user edit page 1436 * Display profile edit success notice on user edit page. 1420 1437 * 1421 1438 * @since 2.0.0 bbPress (r2688) … … 1443 1460 1444 1461 /** 1445 * Display pending email change notice on user edit page 1462 * Display pending email change notice on user edit page. 1446 1463 * 1447 1464 * @since 2.6.0 bbPress (r5660) … … 1495 1512 1496 1513 /** 1497 * Super admin privileges notice 1514 * Super admin privileges notice. 1498 1515 * 1499 1516 * @since 2.0.0 bbPress (r2688) … … 1512 1529 1513 1530 /** 1514 * Drop down for selecting the user's display name 1531 * Drop down for selecting the user's display name. 1515 1532 * 1516 1533 * @since 2.0.0 bbPress (r2688) … … 1560 1577 1561 1578 /** 1562 * Output blog role selector (for user edit) 1579 * Output blog role selector (for user edit). 1563 1580 * 1564 1581 * @since 2.0.0 bbPress (r2688) … … 1592 1609 1593 1610 /** 1594 * Output forum role selector (for user edit) 1611 * Output forum role selector (for user edit). 1595 1612 * 1596 1613 * @since 2.2.0 bbPress (r4284) … … 1629 1646 1630 1647 /** 1631 * Return user contact methods select box 1648 * Return user contact methods select box. 1632 1649 * 1633 1650 * @since 2.0.0 bbPress (r2688) 1634 * @return string User contact methods 1651 * 1652 * @return string User contact methods. 1635 1653 */ 1636 1654 function bbp_edit_user_contact_methods() { … … 1644 1662 1645 1663 /** 1646 * Output the language chooser (for user edit) 1664 * Output the language chooser (for user edit). 1647 1665 * 1648 1666 * @since 2.6.0 bbPress (r6488) 1649 1667 * 1650 * @param array $args See wp_dropdown_languages() 1668 * @param array $args See wp_dropdown_languages(). 1651 1669 * @return string 1652 1670 */ … … 1665 1683 1666 1684 /** 1667 * Output the link to the user's topics 1685 * Output the link to the user's topics. 1668 1686 * 1669 1687 * @since 2.2.0 bbPress (r4225) 1670 1688 * 1671 * @param int $user_id Optional. User id 1689 * @param int $user_id Optional. User id. 1672 1690 */ 1673 1691 function bbp_user_topics_created_url( $user_id = 0 ) { 1674 1692 echo esc_url( bbp_get_user_topics_created_url( $user_id ) ); 1675 1693 } 1676 /** 1677 * Return the link to the user's topics 1678 * 1679 * @since 2.2.0 bbPress (r4225) 1680 * 1681 * @param int $user_id Optional. User id 1682 * @return string Permanent link to user profile page 1683 */ 1684 function bbp_get_user_topics_created_url( $user_id = 0 ) { 1685 1686 // Use displayed user ID if there is one, and one isn't requested 1687 $user_id = bbp_get_user_id( $user_id ); 1688 if ( empty( $user_id ) ) { 1689 return false; 1690 } 1691 1692 // Bail if intercepted 1693 $intercept = bbp_maybe_intercept( 'bbp_pre_get_user_topics_created_url', func_get_args() ); 1694 if ( bbp_is_intercepted( $intercept ) ) { 1695 return $intercept; 1696 } 1697 1698 // Get user profile URL 1699 $profile_url = bbp_get_user_profile_url( $user_id ); 1700 1701 // Pretty permalinks 1702 if ( bbp_use_pretty_urls() ) { 1703 $url = trailingslashit( $profile_url ) . bbp_get_topic_archive_slug(); 1704 $url = user_trailingslashit( $url ); 1705 1706 // Unpretty permalinks 1707 } else { 1708 $url = add_query_arg( 1709 array( 1710 bbp_get_user_topics_rewrite_id() => '1', 1711 ), 1712 $profile_url 1713 ); 1714 } 1715 1716 // Filter & return 1717 return apply_filters( 'bbp_get_user_topics_created_url', $url, $user_id ); 1718 } 1694 1695 /** 1696 * Return the link to the user's topics. 1697 * 1698 * @since 2.2.0 bbPress (r4225) 1699 * 1700 * @param int $user_id Optional. User id. 1701 * @return string Permanent link to user profile page. 1702 */ 1703 function bbp_get_user_topics_created_url( $user_id = 0 ) { 1704 1705 // Use displayed user ID if there is one, and one isn't requested 1706 $user_id = bbp_get_user_id( $user_id ); 1707 if ( empty( $user_id ) ) { 1708 return false; 1709 } 1710 1711 // Bail if intercepted 1712 $intercept = bbp_maybe_intercept( 'bbp_pre_get_user_topics_created_url', func_get_args() ); 1713 if ( bbp_is_intercepted( $intercept ) ) { 1714 return $intercept; 1715 } 1716 1717 // Get user profile URL 1718 $profile_url = bbp_get_user_profile_url( $user_id ); 1719 1720 // Pretty permalinks 1721 if ( bbp_use_pretty_urls() ) { 1722 $url = trailingslashit( $profile_url ) . bbp_get_topic_archive_slug(); 1723 $url = user_trailingslashit( $url ); 1724 1725 // Unpretty permalinks 1726 } else { 1727 $url = add_query_arg( 1728 array( 1729 bbp_get_user_topics_rewrite_id() => '1', 1730 ), 1731 $profile_url 1732 ); 1733 } 1734 1735 // Filter & return 1736 return apply_filters( 'bbp_get_user_topics_created_url', $url, $user_id ); 1737 } 1719 1738 1720 1739 /** Replies Created ************************************************************/ 1721 1740 1722 1741 /** 1723 * Output the link to the user's replies 1742 * Output the link to the user's replies. 1724 1743 * 1725 1744 * @since 2.2.0 bbPress (r4225) 1726 1745 * 1727 * @param int $user_id Optional. User id 1746 * @param int $user_id Optional. User id. 1728 1747 */ 1729 1748 function bbp_user_replies_created_url( $user_id = 0 ) { 1730 1749 echo esc_url( bbp_get_user_replies_created_url( $user_id ) ); 1731 1750 } 1732 /** 1733 * Return the link to the user's replies 1734 * 1735 * @since 2.2.0 bbPress (r4225) 1736 * 1737 * @param int $user_id Optional. User id 1738 * @return string Permanent link to user profile page 1739 */ 1740 function bbp_get_user_replies_created_url( $user_id = 0 ) { 1741 1742 // Use displayed user ID if there is one, and one isn't requested 1743 $user_id = bbp_get_user_id( $user_id ); 1744 if ( empty( $user_id ) ) { 1745 return false; 1746 } 1747 1748 // Bail if intercepted 1749 $intercept = bbp_maybe_intercept( 'bbp_pre_get_user_replies_created_url', func_get_args() ); 1750 if ( bbp_is_intercepted( $intercept ) ) { 1751 return $intercept; 1752 } 1753 1754 // Get user profile URL 1755 $profile_url = bbp_get_user_profile_url( $user_id ); 1756 1757 // Pretty permalinks 1758 if ( bbp_use_pretty_urls() ) { 1759 $url = trailingslashit( $profile_url ) . bbp_get_reply_archive_slug(); 1760 $url = user_trailingslashit( $url ); 1761 1762 // Unpretty permalinks 1763 } else { 1764 $url = add_query_arg( 1765 array( 1766 bbp_get_user_replies_rewrite_id() => '1', 1767 ), 1768 $profile_url 1769 ); 1770 } 1771 1772 // Filter & return 1773 return apply_filters( 'bbp_get_user_replies_created_url', $url, $user_id ); 1774 } 1751 1752 /** 1753 * Return the link to the user's replies. 1754 * 1755 * @since 2.2.0 bbPress (r4225) 1756 * 1757 * @param int $user_id Optional. User id. 1758 * @return string Permanent link to user profile page. 1759 */ 1760 function bbp_get_user_replies_created_url( $user_id = 0 ) { 1761 1762 // Use displayed user ID if there is one, and one isn't requested 1763 $user_id = bbp_get_user_id( $user_id ); 1764 if ( empty( $user_id ) ) { 1765 return false; 1766 } 1767 1768 // Bail if intercepted 1769 $intercept = bbp_maybe_intercept( 'bbp_pre_get_user_replies_created_url', func_get_args() ); 1770 if ( bbp_is_intercepted( $intercept ) ) { 1771 return $intercept; 1772 } 1773 1774 // Get user profile URL 1775 $profile_url = bbp_get_user_profile_url( $user_id ); 1776 1777 // Pretty permalinks 1778 if ( bbp_use_pretty_urls() ) { 1779 $url = trailingslashit( $profile_url ) . bbp_get_reply_archive_slug(); 1780 $url = user_trailingslashit( $url ); 1781 1782 // Unpretty permalinks 1783 } else { 1784 $url = add_query_arg( 1785 array( 1786 bbp_get_user_replies_rewrite_id() => '1', 1787 ), 1788 $profile_url 1789 ); 1790 } 1791 1792 // Filter & return 1793 return apply_filters( 'bbp_get_user_replies_created_url', $url, $user_id ); 1794 } 1775 1795 1776 1796 /** Engagements ***************************************************************/ 1777 1797 1778 1798 /** 1779 * Output the link to the user's engagements 1799 * Output the link to the user's engagements. 1780 1800 * 1781 1801 * @since 2.6.0 bbPress (r6320) 1782 1802 * 1783 * @param int $user_id Optional. User id 1803 * @param int $user_id Optional. User id. 1784 1804 */ 1785 1805 function bbp_user_engagements_url( $user_id = 0 ) { 1786 1806 echo esc_url( bbp_get_user_engagements_url( $user_id ) ); 1787 1807 } 1788 /** 1789 * Return the link to the user's engagements 1790 * 1791 * @since 2.6.0 bbPress (r6320) 1792 * 1793 * @param int $user_id Optional. User id 1794 * @return string Permanent link to user profile page 1795 */ 1796 function bbp_get_user_engagements_url( $user_id = 0 ) { 1797 1798 // Use displayed user ID if there is one, and one isn't requested 1799 $user_id = bbp_get_user_id( $user_id ); 1800 if ( empty( $user_id ) ) { 1801 return false; 1802 } 1803 1804 // Bail if intercepted 1805 $intercept = bbp_maybe_intercept( 'bbp_pre_get_user_engagements_url', func_get_args() ); 1806 if ( bbp_is_intercepted( $intercept ) ) { 1807 return $intercept; 1808 } 1809 1810 // Get user profile URL 1811 $profile_url = bbp_get_user_profile_url( $user_id ); 1812 1813 // Pretty permalinks 1814 if ( bbp_use_pretty_urls() ) { 1815 $url = trailingslashit( $profile_url ) . bbp_get_user_engagements_slug(); 1816 $url = user_trailingslashit( $url ); 1817 1818 // Unpretty permalinks 1819 } else { 1820 $url = add_query_arg( 1821 array( 1822 bbp_get_user_engagements_rewrite_id() => '1', 1823 ), 1824 $profile_url 1825 ); 1826 } 1827 1828 // Filter & return 1829 return apply_filters( 'bbp_get_user_engagements_url', $url, $user_id ); 1830 } 1808 1809 /** 1810 * Return the link to the user's engagements. 1811 * 1812 * @since 2.6.0 bbPress (r6320) 1813 * 1814 * @param int $user_id Optional. User id. 1815 * @return string Permanent link to user profile page. 1816 */ 1817 function bbp_get_user_engagements_url( $user_id = 0 ) { 1818 1819 // Use displayed user ID if there is one, and one isn't requested 1820 $user_id = bbp_get_user_id( $user_id ); 1821 if ( empty( $user_id ) ) { 1822 return false; 1823 } 1824 1825 // Bail if intercepted 1826 $intercept = bbp_maybe_intercept( 'bbp_pre_get_user_engagements_url', func_get_args() ); 1827 if ( bbp_is_intercepted( $intercept ) ) { 1828 return $intercept; 1829 } 1830 1831 // Get user profile URL 1832 $profile_url = bbp_get_user_profile_url( $user_id ); 1833 1834 // Pretty permalinks 1835 if ( bbp_use_pretty_urls() ) { 1836 $url = trailingslashit( $profile_url ) . bbp_get_user_engagements_slug(); 1837 $url = user_trailingslashit( $url ); 1838 1839 // Unpretty permalinks 1840 } else { 1841 $url = add_query_arg( 1842 array( 1843 bbp_get_user_engagements_rewrite_id() => '1', 1844 ), 1845 $profile_url 1846 ); 1847 } 1848 1849 // Filter & return 1850 return apply_filters( 'bbp_get_user_engagements_url', $url, $user_id ); 1851 } 1831 1852 1832 1853 /** Language ******************************************************************/ 1833 1854 1834 1855 /** 1835 * Output the select element used to save a user's language 1856 * Output the select element used to save a user's language. 1836 1857 * 1837 1858 * @since 2.6.0 bbPress (r6488) 1838 1859 * 1839 * @param array $args See wp_dropdown_languages() 1860 * @param array $args See wp_dropdown_languages(). 1840 1861 */ 1841 1862 function bbp_user_languages_dropdown( $args = array() ) { … … 1843 1864 } 1844 1865 1845 /**1846 * Return the select element used to save a user's language.1847 *1848 * @since 2.6.0 bbPress (r6488)1849 *1850 * @param array $args See wp_dropdown_languages() 1851 * @return string1852 */1853 function bbp_get_user_languages_dropdown( $args = array() ) {1854 1855 // Get user language1856 $user_id = ! empty( $args['user_id'] )1857 ? bbp_get_user_id( $args['user_id'], false, false )1858 : bbp_get_displayed_user_id();1859 1860 // Get user locale1861 $user_locale = ! empty( $user_id )1862 ? get_userdata( $user_id )->locale1863 : 'site-default';1864 1865 // Get all languages1866 $languages = get_available_languages();1867 1868 // No locale for English1869 if ( 'en_US' === $user_locale ) {1870 $user_locale = '';1871 1872 // Fallback to site-default if there is a mismatch1873 } elseif ( '' === $user_locale || ! in_array( $user_locale, $languages, true ) ) {1874 $user_locale = 'site-default';1875 }1876 1877 // Don't pass user ID in1878 unset( $args['user_id'] );1879 1880 // Parse arguments1881 $r = bbp_parse_args(1882 $args,1883 array(1884 'name' => 'locale',1885 'id' => 'locale',1886 'selected' => $user_locale,1887 'languages' => $languages,1888 'echo' => false,1889 'show_available_translations' => false,1890 'show_option_site_default' => true1891 ),1892 'user_languages_dropdown'1893 );1894 1895 // Get the markup for the languages drop-down1896 $retval = wp_dropdown_languages( $r );1897 1898 // Filter & return1899 return apply_filters( 'bbp_get_user_languages_dropdown', $retval, $r, $args );1900 }1866 /** 1867 * Return the select element used to save a user's language. 1868 * 1869 * @since 2.6.0 bbPress (r6488) 1870 * 1871 * @param array $args See wp_dropdown_languages(). 1872 * @return string 1873 */ 1874 function bbp_get_user_languages_dropdown( $args = array() ) { 1875 1876 // Get user language 1877 $user_id = ! empty( $args['user_id'] ) 1878 ? bbp_get_user_id( $args['user_id'], false, false ) 1879 : bbp_get_displayed_user_id(); 1880 1881 // Get user locale 1882 $user_locale = ! empty( $user_id ) 1883 ? get_userdata( $user_id )->locale 1884 : 'site-default'; 1885 1886 // Get all languages 1887 $languages = get_available_languages(); 1888 1889 // No locale for English 1890 if ( 'en_US' === $user_locale ) { 1891 $user_locale = ''; 1892 1893 // Fallback to site-default if there is a mismatch 1894 } elseif ( '' === $user_locale || ! in_array( $user_locale, $languages, true ) ) { 1895 $user_locale = 'site-default'; 1896 } 1897 1898 // Don't pass user ID in 1899 unset( $args['user_id'] ); 1900 1901 // Parse arguments 1902 $r = bbp_parse_args( 1903 $args, 1904 array( 1905 'name' => 'locale', 1906 'id' => 'locale', 1907 'selected' => $user_locale, 1908 'languages' => $languages, 1909 'echo' => false, 1910 'show_available_translations' => false, 1911 'show_option_site_default' => true 1912 ), 1913 'user_languages_dropdown' 1914 ); 1915 1916 // Get the markup for the languages drop-down 1917 $retval = wp_dropdown_languages( $r ); 1918 1919 // Filter & return 1920 return apply_filters( 'bbp_get_user_languages_dropdown', $retval, $r, $args ); 1921 } 1901 1922 1902 1923 /** Login *********************************************************************/ 1903 1924 1904 1925 /** 1905 * Handle the login and registration template notices 1926 * Handle the login and registration template notices. 1906 1927 * 1907 1928 * @since 2.0.0 bbPress (r2970) … … 1948 1969 * @since 2.0.0 bbPress (r2815) 1949 1970 * 1950 * @param string $url The URL to redirect to 1971 * @param string $url The URL to redirect to. 1951 1972 */ 1952 1973 function bbp_logged_in_redirect( $url = '' ) { … … 1965 1986 1966 1987 /** 1967 * Output the required hidden fields when logging in 1988 * Output the required hidden fields when logging in. 1968 1989 * 1969 1990 * @since 2.0.0 bbPress (r2815) … … 1987 2008 1988 2009 /** 1989 * Output the required hidden fields when registering 2010 * Output the required hidden fields when registering. 1990 2011 * 1991 2012 * @since 2.0.0 bbPress (r2815) … … 2010 2031 2011 2032 /** 2012 * Output the required hidden fields when user lost password 2033 * Output the required hidden fields when user lost password. 2013 2034 * 2014 2035 * @since 2.0.0 bbPress (r2815) … … 2032 2053 2033 2054 /** 2034 * Output the author link of a post 2055 * Output the author link of a post. 2035 2056 * 2036 2057 * @since 2.0.0 bbPress (r2875) … … 2041 2062 echo bbp_get_author_link( $args ); 2042 2063 } 2043 /** 2044 * Return the author link of the post 2045 * 2046 * @since 2.0.0 bbPress (r2875) 2047 * 2048 * @param array $args Optional. If an integer, it is used as reply id. 2049 * @return string Author link of reply 2050 */ 2051 function bbp_get_author_link( $args = array() ) { 2052 2053 $post_id = is_numeric( $args ) ? (int) $args : 0; 2054 2055 // Parse arguments against default values 2056 $r = bbp_parse_args( 2057 $args, 2058 array( 2059 'post_id' => $post_id, 2060 'link_title' => '', 2061 'type' => 'both', 2062 'size' => 80, 2063 'sep' => '' 2064 ), 2065 'get_author_link' 2066 ); 2067 2068 // Confirmed topic 2069 if ( bbp_is_topic( $r['post_id'] ) ) { 2070 return bbp_get_topic_author_link( $r ); 2071 2072 // Confirmed reply 2073 } elseif ( bbp_is_reply( $r['post_id'] ) ) { 2074 return bbp_get_reply_author_link( $r ); 2064 2065 /** 2066 * Return the author link of the post. 2067 * 2068 * @since 2.0.0 bbPress (r2875) 2069 * 2070 * @param array $args Optional. If an integer, it is used as reply id. 2071 * @return string Author link of reply. 2072 */ 2073 function bbp_get_author_link( $args = array() ) { 2074 2075 $post_id = is_numeric( $args ) ? (int) $args : 0; 2076 2077 // Parse arguments against default values 2078 $r = bbp_parse_args( 2079 $args, 2080 array( 2081 'post_id' => $post_id, 2082 'link_title' => '', 2083 'type' => 'both', 2084 'size' => 80, 2085 'sep' => '' 2086 ), 2087 'get_author_link' 2088 ); 2089 2090 // Confirmed topic 2091 if ( bbp_is_topic( $r['post_id'] ) ) { 2092 return bbp_get_topic_author_link( $r ); 2093 2094 // Confirmed reply 2095 } elseif ( bbp_is_reply( $r['post_id'] ) ) { 2096 return bbp_get_reply_author_link( $r ); 2097 } 2098 2099 // Default return value 2100 $author_link = ''; 2101 2102 // Neither a reply nor a topic, so could be a revision 2103 if ( ! empty( $r['post_id'] ) ) { 2104 2105 // Get some useful reply information 2106 $user_id = get_post_field( 'post_author', $r['post_id'] ); 2107 $author_url = bbp_get_user_profile_url( $user_id ); 2108 $anonymous = bbp_is_reply_anonymous( $r['post_id'] ); 2109 2110 // Generate title with the display name of the author 2111 if ( empty( $r['link_title'] ) ) { 2112 $author = get_the_author_meta( 'display_name', $user_id ); 2113 $title = empty( $anonymous ) 2114 /* translators: %s: Author's display name */ 2115 ? esc_attr__( "View %s's profile", 'bbpress' ) 2116 /* translators: %s: Author's display name */ 2117 : esc_attr__( "Visit %s's website", 'bbpress' ); 2118 2119 $r['link_title'] = sprintf( $title, $author ); 2075 2120 } 2076 2121 2077 // Default return value 2078 $author_link = ''; 2079 2080 // Neither a reply nor a topic, so could be a revision 2081 if ( ! empty( $r['post_id'] ) ) { 2082 2083 // Get some useful reply information 2084 $user_id = get_post_field( 'post_author', $r['post_id'] ); 2085 $author_url = bbp_get_user_profile_url( $user_id ); 2086 $anonymous = bbp_is_reply_anonymous( $r['post_id'] ); 2087 2088 // Generate title with the display name of the author 2089 if ( empty( $r['link_title'] ) ) { 2090 $author = get_the_author_meta( 'display_name', $user_id ); 2091 $title = empty( $anonymous ) 2092 /* translators: %s: Author's display name */ 2093 ? esc_attr__( "View %s's profile", 'bbpress' ) 2094 /* translators: %s: Author's display name */ 2095 : esc_attr__( "Visit %s's website", 'bbpress' ); 2096 2097 $r['link_title'] = sprintf( $title, $author ); 2098 } 2099 2100 // Setup title and author_links array 2101 $author_links = array(); 2102 $link_title = ! empty( $r['link_title'] ) 2103 ? ' title="' . esc_attr( $r['link_title'] ) . '"' 2104 : ''; 2105 2106 // Get avatar (unescaped, because HTML) 2107 if ( ( 'avatar' === $r['type'] ) || ( 'both' === $r['type'] ) ) { 2108 $author_links['avatar'] = get_avatar( $user_id, $r['size'] ); 2109 } 2110 2111 // Get display name (escaped, because never HTML) 2112 if ( ( 'name' === $r['type'] ) || ( 'both' === $r['type'] ) ) { 2113 $author_links['name'] = esc_html( get_the_author_meta( 'display_name', $user_id ) ); 2114 } 2115 2116 // Empty array 2117 $links = array(); 2118 $sprint = '<span%1$s>%2$s</span>'; 2119 2120 // Wrap each link 2121 foreach ( $author_links as $link => $link_text ) { 2122 $link_class = ' class="bbp-author-' . esc_attr( $link ) . '"'; 2123 $links[] = sprintf( $sprint, $link_class, $link_text ); 2124 } 2125 2126 // Juggle 2127 $author_links = $links; 2128 unset( $links ); 2129 2130 // Filter sections 2131 $sections = apply_filters( 'bbp_get_author_links', $author_links, $r, $args ); 2132 2133 // Assemble sections into author link 2134 $author_link = implode( $r['sep'], $sections ); 2135 2136 // Only wrap in link if profile exists 2137 if ( empty( $anonymous ) && bbp_user_has_profile( $user_id ) ) { 2138 $author_link = sprintf( '<a href="%1$s"%2$s%3$s>%4$s</a>', esc_url( $author_url ), $link_title, ' class="bbp-author-link"', $author_link ); 2139 } 2122 // Setup title and author_links array 2123 $author_links = array(); 2124 $link_title = ! empty( $r['link_title'] ) 2125 ? ' title="' . esc_attr( $r['link_title'] ) . '"' 2126 : ''; 2127 2128 // Get avatar (unescaped, because HTML) 2129 if ( ( 'avatar' === $r['type'] ) || ( 'both' === $r['type'] ) ) { 2130 $author_links['avatar'] = get_avatar( $user_id, $r['size'] ); 2140 2131 } 2141 2132 2142 // Filter & return 2143 return apply_filters( 'bbp_get_author_link', $author_link, $r, $args ); 2144 } 2133 // Get display name (escaped, because never HTML) 2134 if ( ( 'name' === $r['type'] ) || ( 'both' === $r['type'] ) ) { 2135 $author_links['name'] = esc_html( get_the_author_meta( 'display_name', $user_id ) ); 2136 } 2137 2138 // Empty array 2139 $links = array(); 2140 $sprint = '<span%1$s>%2$s</span>'; 2141 2142 // Wrap each link 2143 foreach ( $author_links as $link => $link_text ) { 2144 $link_class = ' class="bbp-author-' . esc_attr( $link ) . '"'; 2145 $links[] = sprintf( $sprint, $link_class, $link_text ); 2146 } 2147 2148 // Juggle 2149 $author_links = $links; 2150 unset( $links ); 2151 2152 // Filter sections 2153 $sections = apply_filters( 'bbp_get_author_links', $author_links, $r, $args ); 2154 2155 // Assemble sections into author link 2156 $author_link = implode( $r['sep'], $sections ); 2157 2158 // Only wrap in link if profile exists 2159 if ( empty( $anonymous ) && bbp_user_has_profile( $user_id ) ) { 2160 $author_link = sprintf( '<a href="%1$s"%2$s%3$s>%4$s</a>', esc_url( $author_url ), $link_title, ' class="bbp-author-link"', $author_link ); 2161 } 2162 } 2163 2164 // Filter & return 2165 return apply_filters( 'bbp_get_author_link', $author_link, $r, $args ); 2166 } 2145 2167 2146 2168 /** Capabilities **************************************************************/ 2147 2169 2148 2170 /** 2149 * Check if the user can access a specific forum 2171 * Check if the user can access a specific forum. 2150 2172 * 2151 2173 * @since 2.0.0 bbPress (r3127) … … 2193 2215 2194 2216 /** 2195 * Check if the current user can publish topics 2217 * Check if the current user can publish topics. 2196 2218 * 2197 2219 * @since 2.0.0 bbPress (r3127) … … 2222 2244 2223 2245 /** 2224 * Check if the current user can publish forums 2246 * Check if the current user can publish forums. 2225 2247 * 2226 2248 * @since 2.1.0 bbPress (r3549) … … 2247 2269 2248 2270 /** 2249 * Check if the current user can publish replies 2271 * Check if the current user can publish replies. 2250 2272 * 2251 2273 * @since 2.0.0 bbPress (r3127) … … 2284 2306 2285 2307 /** 2286 * Get the forums the current user has the ability to see and post to 2308 * Get the forums the current user has the ability to see and post to. 2287 2309 * 2288 2310 * @since 2.0.0 bbPress (r3127) … … 2442 2464 2443 2465 /** 2444 * Output the moderators of a forum 2466 * Output the moderators of a forum. 2445 2467 * 2446 2468 * @since 2.6.0 bbPress 2447 2469 * 2448 * @param int $forum_id Optional. Topic id 2449 * @param array $args See {@link bbp_get_moderator_list()} 2470 * @param int $forum_id Optional. Topic id. 2471 * @param array $args See {@link bbp_get_moderator_list()}. 2450 2472 */ 2451 2473 function bbp_moderator_list( $forum_id = 0, $args = array() ) { … … 2453 2475 } 2454 2476 2455 /** 2456 * Return the moderators for an object 2457 * 2458 * @since 2.6.0 bbPress 2459 * 2460 * @param int $object_id Optional. Object id 2461 * @param array $args This function supports these arguments: 2462 * - before: Before the tag list 2463 * - sep: Tag separator 2464 * - after: After the tag list 2465 * 2466 * @return string Moderator list of the object 2467 */ 2468 function bbp_get_moderator_list( $object_id = 0, $args = array() ) { 2469 2470 // Parse arguments against default values 2471 $r = bbp_parse_args( 2472 $args, 2473 array( 2474 'before' => '<div class="bbp-moderators"><p>' . esc_html__( 'Moderators:', 'bbpress' ) . ' ', 2475 'sep' => ', ', 2476 'after' => '</p></div>', 2477 'none' => '' 2478 ), 2479 'get_moderator_list' 2480 ); 2481 2482 // Get forum moderators 2483 $user_ids = bbp_get_moderator_ids( $object_id ); 2484 if ( ! empty( $user_ids ) ) { 2485 2486 // In admin, use nicenames 2487 if ( is_admin() ) { 2488 $users = bbp_get_user_nicenames_from_ids( $user_ids ); 2489 2490 // In theme, use display names & profile links 2491 } else { 2492 foreach ( $user_ids as $user_id ) { 2493 $users[] = bbp_get_user_profile_link( $user_id ); 2494 } 2477 /** 2478 * Return the moderators for an object. 2479 * 2480 * @since 2.6.0 bbPress 2481 * 2482 * @param int $object_id Optional. Object id. 2483 * @param array $args This function supports these arguments: 2484 * - before: Before the tag list 2485 * - sep: Tag separator 2486 * - after: After the tag list 2487 * 2488 * @return string Moderator list of the object. 2489 */ 2490 function bbp_get_moderator_list( $object_id = 0, $args = array() ) { 2491 2492 // Parse arguments against default values 2493 $r = bbp_parse_args( 2494 $args, 2495 array( 2496 'before' => '<div class="bbp-moderators"><p>' . esc_html__( 'Moderators:', 'bbpress' ) . ' ', 2497 'sep' => ', ', 2498 'after' => '</p></div>', 2499 'none' => '' 2500 ), 2501 'get_moderator_list' 2502 ); 2503 2504 // Get forum moderators 2505 $user_ids = bbp_get_moderator_ids( $object_id ); 2506 if ( ! empty( $user_ids ) ) { 2507 2508 // In admin, use nicenames 2509 if ( is_admin() ) { 2510 $users = bbp_get_user_nicenames_from_ids( $user_ids ); 2511 2512 // In theme, use display names & profile links 2513 } else { 2514 foreach ( $user_ids as $user_id ) { 2515 $users[] = bbp_get_user_profile_link( $user_id ); 2495 2516 } 2496 2497 $retval = $r['before'] . implode( $r['sep'], $users ) . $r['after'];2498 2499 // No forum moderators2500 } else {2501 $retval = $r['none'];2502 2517 } 2503 2518 2504 // Filter & return 2505 return apply_filters( 'bbp_get_moderator_list', $retval ); 2506 } 2519 $retval = $r['before'] . implode( $r['sep'], $users ) . $r['after']; 2520 2521 // No forum moderators 2522 } else { 2523 $retval = $r['none']; 2524 } 2525 2526 // Filter & return 2527 return apply_filters( 'bbp_get_moderator_list', $retval ); 2528 }
Note: See TracChangeset
for help on using the changeset viewer.