Changeset 9383 for trunk/src/bp-forums/bp-forums-template.php
- Timestamp:
- 01/21/2015 12:13:52 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-forums/bp-forums-template.php
r9351 r9383 29 29 function bp_get_forums_slug() { 30 30 global $bp; 31 32 /** 33 * Filters the forums component slug. 34 * 35 * @since BuddyPress (1.5.0) 36 * 37 * @param string $slug Forums component slug. 38 */ 31 39 return apply_filters( 'bp_get_forums_slug', $bp->forums->slug ); 32 40 } … … 51 59 function bp_get_forums_root_slug() { 52 60 global $bp; 61 62 /** 63 * Filters the forums component root slug. 64 * 65 * @since BuddyPress (1.5.0) 66 * 67 * @param string $root_slug Forums component root slug. 68 */ 53 69 return apply_filters( 'bp_get_forums_root_slug', $bp->forums->root_slug ); 54 70 } … … 77 93 */ 78 94 function bp_get_forums_directory_permalink() { 95 96 /** 97 * Filters the permalink for the forum directory. 98 * 99 * @since BuddyPress (1.5.0) 100 * 101 * @param string $value Permalink for the forum directory. 102 */ 79 103 return apply_filters( 'bp_get_forums_directory_permalink', trailingslashit( bp_get_root_domain() . '/' . bp_get_forums_root_slug() ) ); 80 104 } … … 235 259 } 236 260 261 /** 262 * Filters the forums template topics. 263 * 264 * @since BuddyPress (1.1.0) 265 * 266 * @param array $topics Array of topics being set for display. 267 * @param string $type The sort order/kind. 'newest', 268 * 'popular', 'unreplied', 'tags'. 269 * @param int $forum_id ID for the current forum. 270 * @param int $per_page The number of the page being requested. 271 * @param int $max The max number of posts to show. 272 * @param string $no_stickies Requested sticky format. 273 */ 237 274 $this->topics = apply_filters( 'bp_forums_template_topics', $this->topics, $type, $forum_id, $per_page, $max, $no_stickies ); 238 275 … … 282 319 } 283 320 321 /** 322 * Filters the topic count for the forum being displayed. 323 * 324 * @since BuddyPress (1.1.0) 325 * 326 * @param int $topic_count Topic count to be displayed. 327 * @param array $topics Array of topics to be displayed. 328 * @param string $type The sort order/kind. 'newest', 329 * 'popular', 'unreplied', 'tags'. 330 * @param int $forum_id ID for the current forum. 331 * @param int $per_page The number of the page being requested. 332 * @param int $max The max number of posts to show. 333 * @param string $no_stickies Requested sticky format. 334 */ 284 335 $this->topic_count = apply_filters_ref_array( 'bp_forums_template_topic_count', array( $this->topic_count, &$this->topics, $type, $forum_id, $per_page, $max, $no_stickies ) ); 336 337 /** 338 * Filters the total topic count for the forum being displayed. 339 * 340 * @since BuddyPress (1.1.0) 341 * 342 * @param int $total_topic_count Total topic count found. 343 * @param int $topic_count Topic count to be displayed. 344 * @param array $topics Array of topics to be displayed. 345 * @param string $type The sort order/kind. 'newest', 346 * 'popular', 'unreplied', 'tags'. 347 * @param int $forum_id ID for the current forum. 348 * @param int $per_page The number of the page being requested. 349 * @param int $max The max number of posts to show. 350 * @param string $no_stickies Requested sticky format. 351 */ 285 352 $this->total_topic_count = apply_filters_ref_array( 'bp_forums_template_total_topic_count', array( $this->total_topic_count, $this->topic_count, &$this->topics, $type, $forum_id, $per_page, $max, $no_stickies ) ); 286 353 … … 353 420 return true; 354 421 } elseif ( $this->current_topic + 1 == $this->topic_count ) { 422 423 /** 424 * Fires right before the rewinding of user topics. 425 * 426 * @since BuddyPress (1.5.0) 427 */ 355 428 do_action('forum_loop_end'); 356 429 // Do some cleaning up after the loop … … 374 447 $this->topic = (object)$this->topic; 375 448 376 if ( $this->current_topic == 0 ) // loop has just started 377 do_action('forum_loop_start'); 449 if ( $this->current_topic == 0 ) { 450 451 /** 452 * Fires if the current topic item is the first in the topic loop. 453 * 454 * @since BuddyPress (1.5.0) 455 */ 456 do_action( 'forum_loop_start' ); 457 } 378 458 } 379 459 } … … 582 662 } 583 663 664 /** 665 * Filters whether or not there are topics to display. 666 * 667 * @since BuddyPress (1.1.0) 668 * 669 * @param bool $value Whether or not there are topics to display. 670 * @param object $forum_template Global $forum_template object. 671 */ 584 672 return apply_filters( 'bp_has_topics', $forum_template->has_topics(), $forum_template ); 585 673 } … … 623 711 global $forum_template; 624 712 713 /** 714 * Filters the ID of the current topic in the loop. 715 * 716 * @since BuddyPress (1.0.0) 717 * 718 * @param int $topic_id ID for the current topic. 719 */ 625 720 return apply_filters( 'bp_get_the_topic_id', $forum_template->topic->topic_id ); 626 721 } … … 640 735 global $forum_template; 641 736 737 /** 738 * Filters the title of the current topic in the loop. 739 * 740 * @since BuddyPress (1.0.0) 741 * 742 * @param string $topic_title Title for the current topic. 743 */ 642 744 return apply_filters( 'bp_get_the_topic_title', stripslashes( $forum_template->topic->topic_title ) ); 643 745 } … … 657 759 global $forum_template; 658 760 761 /** 762 * Filters the slug of the current topic in the loop. 763 * 764 * @since BuddyPress (1.0.0) 765 * 766 * @param string $topic_slug Slug for the current topic. 767 */ 659 768 return apply_filters( 'bp_get_the_topic_slug', $forum_template->topic->topic_slug ); 660 769 } … … 675 784 676 785 $post = bb_get_first_post( (int) $forum_template->topic->topic_id, false ); 786 787 /** 788 * Filters the text of the first post in the current topic in the loop. 789 * 790 * @since BuddyPress (1.1.0) 791 * 792 * @param string $post_text Text for the first post in the current topic. 793 */ 677 794 return apply_filters( 'bp_get_the_topic_text', esc_attr( $post->post_text ) ); 678 795 } … … 692 809 global $forum_template; 693 810 811 /** 812 * Filters the ID of the user who posted the current topic in the loop. 813 * 814 * @since BuddyPress (1.0.0) 815 * 816 * @param int $topic_poster ID for the user. 817 */ 694 818 return apply_filters( 'bp_get_the_topic_poster_id', $forum_template->topic->topic_poster ); 695 819 } … … 736 860 extract( $r, EXTR_SKIP ); 737 861 862 /** 863 * Filters the avatar for the user who posted the current topic in the loop. 864 * 865 * @since BuddyPress (1.0.0) 866 * 867 * @param string $value HTML for the display of the user's avatar. 868 */ 738 869 return apply_filters( 'bp_get_the_topic_poster_avatar', bp_core_fetch_avatar( array( 'item_id' => $forum_template->topic->topic_poster, 'type' => $type, 'width' => $width, 'height' => $height, 'alt' => $alt ) ) ); 739 870 } … … 758 889 return __( 'Deleted User', 'buddypress' ); 759 890 891 /** 892 * Filters the name of the user who posted the current topic in the loop. 893 * 894 * @since BuddyPress (1.0.0) 895 * 896 * @param string $name Name for the user who posted the current topic. 897 */ 760 898 return apply_filters( 'bp_get_the_topic_poster_name', $name ); 761 899 } … … 777 915 global $forum_template; 778 916 917 /** 918 * Filters the ID of the object associated with the current topic in the loop. 919 * 920 * Objects are things like associated groups. 921 * 922 * @since BuddyPress (1.1.0) 923 * 924 * @param int $object_id ID for the object associated with the current topic. 925 */ 779 926 return apply_filters( 'bp_get_the_topic_object_id', $forum_template->topic->object_id ); 780 927 } … … 802 949 $retval = ''; 803 950 951 /** 952 * Filters the name of the object associated with the current topic in the loop. 953 * 954 * Objects are things like groups. So this filter would return the 955 * name of the group associated with the forum topic, if it exists. 956 * 957 * @since BuddyPress (1.1.0) 958 * 959 * @param string $retval Name for the object associated with the current topic. 960 */ 804 961 return apply_filters( 'bp_get_the_topic_object_name', $retval ); 805 962 } … … 822 979 global $forum_template; 823 980 981 /** 982 * Filters the slug of the object associated with the current topic in the loop. 983 * 984 * Objects are things like groups. So this filter would return the 985 * slug of the group associated with the forum topic, if it exists. 986 * 987 * @since BuddyPress (1.1.0) 988 * 989 * @param string $object_slug Slug for the object associated with the current topic. 990 */ 824 991 return apply_filters( 'bp_get_the_topic_object_slug', $forum_template->topic->object_slug ); 825 992 } … … 847 1014 $permalink = ''; 848 1015 1016 /** 1017 * Filters the permalink of the object associated with the current topic in the loop. 1018 * 1019 * Objects are things like groups. So this filter would return the 1020 * slug of the group associated with the forum topic, if it exists. 1021 * 1022 * @since BuddyPress (1.1.0) 1023 * 1024 * @param string $permalink Permalink for the object associated with the current topic. 1025 */ 849 1026 return apply_filters( 'bp_get_the_topic_object_permalink', $permalink ); 850 1027 } … … 872 1049 return __( 'Deleted User', 'buddypress' ); 873 1050 1051 /** 1052 * Filters the linked name of the user who last posted to the current topic in the loop. 1053 * 1054 * @since BuddyPress (1.0.0) 1055 * 1056 * @param string $value HTML link to the profile of the user who last posted. 1057 */ 874 1058 return apply_filters( 'bp_get_the_topic_last_poster_name', '<a href="' . $domain . '">' . $forum_template->topic->topic_last_poster_displayname . '</a>' ); 875 1059 } … … 922 1106 extract( $r, EXTR_SKIP ); 923 1107 1108 /** 1109 * Filters the avatar of the object associated with the current topic in the loop. 1110 * 1111 * @since BuddyPress (1.1.0) 1112 * 1113 * @param string $value HTML output for the object associated with the current topic. 1114 */ 924 1115 return apply_filters( 'bp_get_the_topic_object_avatar', bp_core_fetch_avatar( array( 'item_id' => $forum_template->topic->object_id, 'type' => $type, 'object' => 'group', 'width' => $width, 'height' => $height, 'alt' => $alt ) ) ); 925 1116 } … … 966 1157 extract( $r, EXTR_SKIP ); 967 1158 1159 /** 1160 * Filters the avatar for the user who last posted to the current topic in the loop. 1161 * 1162 * @since BuddyPress (1.0.0) 1163 * 1164 * @param string $value HTML output for the avatar for the user who last posted. 1165 */ 968 1166 return apply_filters( 'bp_get_the_topic_last_poster_avatar', bp_core_fetch_avatar( array( 'email' => $forum_template->topic->topic_last_poster_email, 'item_id' => $forum_template->topic->topic_last_poster, 'type' => $type, 'width' => $width, 'height' => $height, 'alt' => $alt ) ) ); 969 1167 } … … 983 1181 global $forum_template; 984 1182 1183 /** 1184 * Filters the start time of the current topic in the loop. 1185 * 1186 * @since BuddyPress (1.0.0) 1187 * 1188 * @param string $topic_start_time Start time for the current topic. 1189 */ 985 1190 return apply_filters( 'bp_get_the_topic_start_time', $forum_template->topic->topic_start_time ); 986 1191 } … … 1000 1205 global $forum_template; 1001 1206 1207 /** 1208 * Filters the topic time of the current topic in the loop. 1209 * 1210 * @since BuddyPress (1.0.0) 1211 * 1212 * @param string $topic_time Topic time for the current topic. 1213 */ 1002 1214 return apply_filters( 'bp_get_the_topic_time', $forum_template->topic->topic_time ); 1003 1215 } … … 1017 1229 global $forum_template; 1018 1230 1231 /** 1232 * Filters the ID of the forum associated with the current topic in the loop. 1233 * 1234 * @since BuddyPress (1.0.0) 1235 * 1236 * @param int $forum_id ID of the forum associated with the current topic. 1237 */ 1019 1238 return apply_filters( 'bp_get_the_topic_forum_id', $forum_template->topic->forum_id ); 1020 1239 } … … 1034 1253 global $forum_template; 1035 1254 1255 /** 1256 * Filters the status of the current topic in the loop. 1257 * 1258 * @since BuddyPress (1.0.0) 1259 * 1260 * @param string $topic_status Status of the current topic. 1261 */ 1036 1262 return apply_filters( 'bp_get_the_topic_status', $forum_template->topic->topic_status ); 1037 1263 } … … 1051 1277 global $forum_template; 1052 1278 1279 /** 1280 * Filters whether or not the current topic in the loop is open. 1281 * 1282 * @since BuddyPress (1.0.0) 1283 * 1284 * @param string $topic_open Whether or not the current topic is open. 1285 */ 1053 1286 return apply_filters( 'bp_get_the_topic_is_topic_open', $forum_template->topic->topic_open ); 1054 1287 } … … 1068 1301 global $forum_template; 1069 1302 1303 /** 1304 * Filters the ID of the last post in the current topic in the loop. 1305 * 1306 * @since BuddyPress (1.0.0) 1307 * 1308 * @param int $topic_last_post_id ID for the last post in the current topic. 1309 */ 1070 1310 return apply_filters( 'bp_get_the_topic_last_post_id', $forum_template->topic->topic_last_post_id ); 1071 1311 } … … 1085 1325 global $forum_template; 1086 1326 1327 /** 1328 * Filters whether or not the current topic in the loop is sticky. 1329 * 1330 * @since BuddyPress (1.0.0) 1331 * 1332 * @param bool $topic_sticky Whether or not the current topic is sticky. 1333 */ 1087 1334 return apply_filters( 'bp_get_the_topic_is_sticky', $forum_template->topic->topic_sticky ); 1088 1335 } … … 1102 1349 global $forum_template; 1103 1350 1104 if ( $forum_template->topic->topic_posts == 1 ) 1351 if ( $forum_template->topic->topic_posts == 1 ) { 1352 1353 /** 1354 * Filters a 'x posts' string with the number of posts in the current topic. 1355 * 1356 * @since BuddyPress (1.0.0) 1357 * 1358 * @param string $value 'X posts' string value for the current topic. 1359 */ 1105 1360 return apply_filters( 'bp_get_the_topic_total_post_count', sprintf( __( '%d post', 'buddypress' ), $forum_template->topic->topic_posts ) ); 1106 else 1361 } else { 1362 1363 /** This filter is documented in bp-forums/bp-forums-template.php */ 1107 1364 return apply_filters( 'bp_get_the_topic_total_post_count', sprintf( __( '%d posts', 'buddypress' ), $forum_template->topic->topic_posts ) ); 1365 } 1108 1366 } 1109 1367 … … 1122 1380 global $forum_template; 1123 1381 1382 /** 1383 * Filters the total number of posts in the current topic in the loop. 1384 * 1385 * @since BuddyPress (1.2.4) 1386 * 1387 * @param int $topic_posts Total number of posts in the current topic. 1388 */ 1124 1389 return apply_filters( 'bp_get_the_topic_total_posts', $forum_template->topic->topic_posts ); 1125 1390 } … … 1139 1404 global $forum_template; 1140 1405 1406 /** 1407 * Filters the tag count for the current topic in the loop. 1408 * 1409 * @since BuddyPress (1.0.0) 1410 * 1411 * @param int $tag_count Tag count for the current topic. 1412 */ 1141 1413 return apply_filters( 'bp_get_the_topic_tag_count', $forum_template->topic->tag_count ); 1142 1414 } … … 1173 1445 } 1174 1446 1447 /** 1448 * Filters the permalink for the current topic in the loop. 1449 * 1450 * @since BuddyPress (1.0.0) 1451 * 1452 * @param string $value Permalink for the current topic in the loop. 1453 */ 1175 1454 return apply_filters( 'bp_get_the_topic_permalink', trailingslashit( $permalink . 'topic/' . $forum_template->topic->topic_slug ) ); 1176 1455 } … … 1192 1471 global $forum_template; 1193 1472 1473 /** 1474 * Filters a 'time since' string describing when the current topic was created. 1475 * 1476 * @since BuddyPress (1.0.0) 1477 * 1478 * @param string $value 'Time since' value for the current topic. 1479 */ 1194 1480 return apply_filters( 'bp_get_the_topic_time_since_created', bp_core_time_since( strtotime( $forum_template->topic->topic_start_time ) ) ); 1195 1481 } … … 1222 1508 $post = bp_create_excerpt( $post->post_text, $length ); 1223 1509 1510 /** 1511 * Filters an excerpt from the latest post of the current topic in the loop. 1512 * 1513 * @since BuddyPress (1.0.0) 1514 * 1515 * @param string $post Post exceprt for the current topic. 1516 * @param string $length String length to trim excerpt down to. 1517 */ 1224 1518 return apply_filters( 'bp_get_the_topic_latest_post_excerpt', $post, $length ); 1225 1519 } … … 1241 1535 global $forum_template; 1242 1536 1537 /** 1538 * Filters a 'time since' string describing when the last post in the current topic was created. 1539 * 1540 * @since BuddyPress (1.0.0) 1541 * 1542 * @param string $value The 'time since' string for the last post in the current topic. 1543 */ 1243 1544 return apply_filters( 'bp_get_the_topic_time_since_last_post', bp_core_time_since( strtotime( $forum_template->topic->topic_time ) ) ); 1244 1545 } … … 1338 1639 $class .= ' closed'; 1339 1640 1641 /** 1642 * Filters the CSS class for the current topic in the loop. 1643 * 1644 * This class may contain keywords like 'alt', 'sticky', or 'closed', 1645 * based on context. 1646 * 1647 * @since BuddyPress (1.2.4) 1648 * 1649 * @param string $value Concatenated classes for the current topic in the loop. 1650 */ 1340 1651 return apply_filters( 'bp_get_the_topic_css_class', trim( $class ) ); 1341 1652 } … … 1355 1666 global $bp; 1356 1667 1668 /** 1669 * Filters the permalink to the 'personal' topics tab. 1670 * 1671 * @since BuddyPress (1.1.0) 1672 * 1673 * @param string $value Permalink to the 'personal' topics tab. 1674 */ 1357 1675 return apply_filters( 'bp_get_my_forum_topics_link', bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/personal/' ); 1358 1676 } … … 1372 1690 global $bp; 1373 1691 1692 /** 1693 * Filters the permalink to the 'unreplied' topics tab. 1694 * 1695 * @since BuddyPress (1.1.0) 1696 * 1697 * @param string $value Permalink to the 'unreplied' topics tab. 1698 */ 1374 1699 return apply_filters( 'bp_get_unreplied_forum_topics_link', bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/unreplied/' ); 1375 1700 } … … 1389 1714 global $bp; 1390 1715 1716 /** 1717 * Filters the permalink to the 'popular' topics tab. 1718 * 1719 * @since BuddyPress (1.1.0) 1720 * 1721 * @param string $value Permalink to the 'popular' topics tab. 1722 */ 1391 1723 return apply_filters( 'bp_get_popular_forum_topics_link', bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/popular/' ); 1392 1724 } … … 1406 1738 global $bp; 1407 1739 1740 /** 1741 * Filters the link to the forums directory. 1742 * 1743 * @since BuddyPress (1.1.0) 1744 * 1745 * @param string $value Link to the forums directory. 1746 */ 1408 1747 return apply_filters( 'bp_get_newest_forum_topics_link', bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/' ); 1409 1748 } … … 1428 1767 return 'newest'; 1429 1768 1769 /** 1770 * Filters the currently viewed topic list type. 1771 * 1772 * Eg, 'newest', 'popular', etc. 1773 * 1774 * @since BuddyPress (1.1.0) 1775 * 1776 * @param string $value Currently viewed topic list type. 1777 */ 1430 1778 return apply_filters( 'bp_get_forum_topic_type', bp_current_action() ); 1431 1779 } … … 1462 1810 } 1463 1811 1464 // Tack on the #post-topic-reply anchor before returning 1812 /** 1813 * Filters the permalink for the New Reply button at the top of forum topics. 1814 * 1815 * @since BuddyPress (1.5.0) 1816 * 1817 * @param string $value Permalink for the New Reply button. 1818 */ 1465 1819 return apply_filters( 'bp_get_forum_topic_new_reply_link', $link . '#post-topic-reply', $link ); 1466 1820 } … … 1499 1853 global $forum_template; 1500 1854 1855 /** 1856 * Filters the pagination links for the current topic list. 1857 * 1858 * @since BuddyPress (1.0.0) 1859 * 1860 * @param string $pag_links HTML pagination links. 1861 */ 1501 1862 return apply_filters( 'bp_get_forum_pagination', $forum_template->pag_links ); 1502 1863 } … … 1527 1888 $pag_filter = sprintf( __( ' matching tag "%s"', 'buddypress' ), $forum_template->search_terms ); 1528 1889 1890 /** 1891 * Filters the pagination count for the current topic list. 1892 * 1893 * @since BuddyPress (1.5.0) 1894 * 1895 * @param string $value Pagination count for the current topic list. 1896 * @param string $from_num Low end count in the view. 1897 * @param string $to_num High end count in the view. 1898 * @param string $total Total count of topics found. 1899 */ 1529 1900 return apply_filters( 'bp_get_forum_pagination_count', sprintf( _n( 'Viewing 1 topic', 'Viewing %1$s - %2$s of %3$s topics', (int) $forum_template->total_topic_count, 'buddypress' ), $from_num, $to_num, $total, $pag_filter ), $from_num, $to_num, $total ); 1530 1901 } … … 1799 2170 return true; 1800 2171 } elseif ( $this->current_post + 1 == $this->post_count ) { 2172 2173 /** 2174 * Fires right before the rewinding of user posts. 2175 * 2176 * @since BuddyPress (1.5.0) 2177 */ 1801 2178 do_action('topic_loop_end'); 1802 2179 // Do some cleaning up after the loop … … 1820 2197 $this->post = (object)$this->post; 1821 2198 1822 if ( $this->current_post == 0 ) // loop has just started 1823 do_action('topic_loop_start'); 2199 if ( $this->current_post == 0 ) { 2200 2201 /** 2202 * Fires if the current post item is the first in the topic loop. 2203 * 2204 * @since BuddyPress (1.5.0) 2205 */ 2206 do_action( 'topic_loop_start' ); 2207 } 1824 2208 } 1825 2209 } … … 1867 2251 } 1868 2252 2253 /** 2254 * Filters whether or not there are topics to display. 2255 * 2256 * @since BuddyPress (1.1.0) 2257 * 2258 * @param bool $value Whether or not there are topics. 2259 * @param BP_Forums_Template_Topic $topic_template Topic template global to use when rendering. 2260 */ 1869 2261 return apply_filters( 'bp_has_topic_posts', $topic_template->has_posts(), $topic_template ); 1870 2262 } … … 1904 2296 global $topic_template; 1905 2297 2298 /** 2299 * Filters the ID of the current post in the loop. 2300 * 2301 * @since BuddyPress (1.0.0) 2302 * 2303 * @param int $post_id ID of the current post. 2304 */ 1906 2305 return apply_filters( 'bp_get_the_topic_post_id', $topic_template->post->post_id ); 1907 2306 } … … 1921 2320 global $topic_template; 1922 2321 2322 /** 2323 * Filters the content of the current post in the loop. 2324 * 2325 * @since BuddyPress (1.0.0) 2326 * 2327 * @param string $post_text The content of the current post. 2328 */ 1923 2329 return apply_filters( 'bp_get_the_topic_post_content', stripslashes( $topic_template->post->post_text ) ); 1924 2330 } … … 1953 2359 $class .= ' open'; 1954 2360 2361 /** 2362 * Filters the CSS class for the current post in the loop. 2363 * 2364 * This class may contain keywords like 'alt', 'deleted', or 'open', 2365 * based on context. 2366 * 2367 * @since BuddyPress (1.2.4) 2368 * 2369 * @param string $value Concatenated classes for the current post in the loop. 2370 */ 1955 2371 return apply_filters( 'bp_get_the_topic_post_css_class', trim( $class ) ); 1956 2372 } … … 1997 2413 extract( $r, EXTR_SKIP ); 1998 2414 2415 /** 2416 * Filters the avatar of the user who posted the current post in the loop. 2417 * 2418 * @since BuddyPress (1.0.0) 2419 * 2420 * @param string $value Avatar of the user who posted the current post. 2421 */ 1999 2422 return apply_filters( 'bp_get_the_topic_post_poster_avatar', bp_core_fetch_avatar( array( 'item_id' => $topic_template->post->poster_id, 'type' => $type, 'width' => $width, 'height' => $height, 'alt' => $alt ) ) ); 2000 2423 } … … 2017 2440 return __( 'Deleted User', 'buddypress' ); 2018 2441 2442 /** 2443 * Filters the name of the user who posted the current post in the loop. 2444 * 2445 * @since BuddyPress (1.0.0) 2446 * 2447 * @param string $value HTML link for the poster's name. 2448 */ 2019 2449 return apply_filters( 'bp_get_the_topic_post_poster_name', '<a href="' . $link . '" title="' . $topic_template->post->poster_name . '">' . $topic_template->post->poster_name . '</a>' ); 2020 2450 } … … 2035 2465 global $topic_template; 2036 2466 2467 /** 2468 * Filters a link to the profile of the user who posted the current post. 2469 * 2470 * @since BuddyPress (1.2.1) 2471 * 2472 * @param string $value Link for the current poster's profile. 2473 */ 2037 2474 return apply_filters( 'bp_the_topic_post_poster_link', bp_core_get_user_domain( $topic_template->post->poster_id ) ); 2038 2475 } … … 2054 2491 global $topic_template; 2055 2492 2493 /** 2494 * Filters the 'since' string describing when the current post in the loop was posted. 2495 * 2496 * @since BuddyPress (1.0.0) 2497 * 2498 * @param string $value The 'since' string. 2499 */ 2056 2500 return apply_filters( 'bp_get_the_topic_post_time_since', bp_core_time_since( strtotime( $topic_template->post->post_time ) ) ); 2057 2501 } … … 2116 2560 $links[] .= '<a class="confirm" id="post-delete-link" href="' . wp_nonce_url( bp_get_the_topic_permalink() . 'delete/post/' . $topic_template->post->post_id, 'bp_forums_delete_post' ) . '">' . __( 'Delete', 'buddypress' ) . '</a>'; 2117 2561 2562 /** 2563 * Filters the admin links for the current post in the loop. 2564 * 2565 * @since BuddyPress (1.2.7) 2566 * 2567 * @param string $value HTML string containing the admin links for the current post. 2568 */ 2118 2569 return apply_filters( 'bp_get_the_topic_post_admin_links', implode( $separator, $links ), $links, $r ); 2119 2570 } … … 2132 2583 function bp_get_the_topic_post_edit_text() { 2133 2584 $post = bp_forums_get_post( bp_action_variable( 4 ) ); 2585 2586 /** 2587 * Filters the text to edit when editing a post. 2588 * 2589 * @since BuddyPress (1.2.4) 2590 * 2591 * @param string $value The text to edit when editing a post. 2592 */ 2134 2593 return apply_filters( 'bp_get_the_topic_post_edit_text', esc_attr( $post->post_text ) ); 2135 2594 } … … 2149 2608 global $topic_template; 2150 2609 2610 2611 /** 2612 * Filters the pagination links for the current topic page. 2613 * 2614 * @since BuddyPress (1.0.0) 2615 * 2616 * @param string $pag_links HTML pagination links. 2617 */ 2151 2618 return apply_filters( 'bp_get_the_topic_pagination', $topic_template->pag_links ); 2152 2619 } … … 2167 2634 $total = bp_core_number_format( $topic_template->total_post_count ); 2168 2635 2636 /** 2637 * Filters the pagination count for the current topic page. 2638 * 2639 * @since BuddyPress (1.0.0) 2640 * 2641 * @param string $value Pagination count for the current topic page. 2642 * @param string $from_num Low end count in the view. 2643 * @param string $to_num High end count in the view. 2644 * @param string $total Total count of topics found. 2645 */ 2169 2646 echo apply_filters( 'bp_the_topic_pagination_count', sprintf( _n( 'Viewing 1 post', 'Viewing %1$s - %2$s of %3$s posts', (int) $topic_template->total_post_count, 'buddypress' ), $from_num, $to_num, $total ), $from_num, $to_num, $total ); 2170 2647 } … … 2185 2662 global $topic_template; 2186 2663 2664 /** 2665 * Filters whether or not a user is on the last page in the current topic. 2666 * 2667 * @since BuddyPress (1.2.0) 2668 * 2669 * @param bool $value Whether or not user is on last page. 2670 */ 2187 2671 return apply_filters( 'bp_get_the_topic_is_last_page', $topic_template->pag_page == $topic_template->pag->total_pages ); 2188 2672 } … … 2200 2684 </form>'; 2201 2685 2686 /** 2687 * Filters the forums directory search form. 2688 * 2689 * @since BuddyPress (1.9.0) 2690 * 2691 * @param string HTML search form for the forums directory. 2692 */ 2202 2693 echo apply_filters( 'bp_directory_forums_search_form', $search_form_html ); 2203 2694 } … … 2238 2729 } 2239 2730 2731 /** 2732 * Filters the permalink to a given forum. 2733 * 2734 * @since BuddyPress (1.0.0) 2735 * 2736 * @param string $value Peramlink to the given forum. 2737 */ 2240 2738 return apply_filters( 'bp_get_forum_permalink', trailingslashit( $permalink ) ); 2241 2739 } … … 2267 2765 } 2268 2766 2269 if ( $forum = bp_forums_get_forum( $forum_id ) ) 2767 if ( $forum = bp_forums_get_forum( $forum_id ) ) { 2768 2769 /** 2770 * Filters the name of a given forum. 2771 * 2772 * @since BuddyPress (1.5.0) 2773 * 2774 * @param string $forum_name Name of the given forum. 2775 * @param string $forum_id ID of the given forum. 2776 */ 2270 2777 return apply_filters( 'bp_get_forum_name', $forum->forum_name, $forum->forum_id ); 2271 else2778 } else { 2272 2779 return false; 2780 } 2273 2781 } 2274 2782 … … 2334 2842 $tags = implode( ', ', $tags ); 2335 2843 2844 /** 2845 * Filters the current topic's tag list. 2846 * 2847 * @since BuddyPress (1.5.0) 2848 * 2849 * @param string|array $tags List or array of tags for the current topic. 2850 * @param string $format Requested format for the tags. 2851 */ 2336 2852 return apply_filters( 'bp_forum_topic_tag_list', $tags, $format ); 2337 2853 } … … 2352 2868 $has_tags = true; 2353 2869 2870 /** 2871 * Filters whether or not a forum topic has any tags. 2872 * 2873 * @since BuddyPress (1.5.0) 2874 * 2875 * @param bool $has_tags Whether or not there are any tags. 2876 */ 2354 2877 return apply_filters( 'bp_forum_topic_has_tags', $has_tags ); 2355 2878 } … … 2369 2892 global $topic_template; 2370 2893 2894 /** 2895 * Filters the url to use in a forum form 'action'. 2896 * 2897 * @since BuddyPress (1.0.0) 2898 * 2899 * @param string $value URL to use in the forum form 'action'. 2900 */ 2371 2901 return apply_filters( 'bp_get_forum_action', bp_get_root_domain() . esc_attr( $_SERVER['REQUEST_URI'] ) ); 2372 2902 } … … 2384 2914 */ 2385 2915 function bp_get_forum_topic_action() { 2916 2917 /** 2918 * Filters the url to use in a forum topic form 'action'. 2919 * 2920 * @since BuddyPress (1.0.0) 2921 * 2922 * @param string $value URL to use in the forum topic form 'action'. 2923 */ 2386 2924 return apply_filters( 'bp_get_forum_topic_action', $_SERVER['REQUEST_URI'] ); 2387 2925 } … … 2401 2939 * 2402 2940 * @param int $user_id See {@link bp_forums_total_topic_count_for_user}. 2941 * 2942 * @return int 2403 2943 */ 2404 2944 function bp_get_forum_topic_count_for_user( $user_id = 0 ) { 2945 2946 /** 2947 * Filters the total topic count for a given user. 2948 * 2949 * @since BuddyPress (1.2.0) 2950 * 2951 * @param int $value Total topic count for the given user. 2952 */ 2405 2953 return apply_filters( 'bp_get_forum_topic_count_for_user', bp_forums_total_topic_count_for_user( $user_id ) ); 2406 2954 } … … 2420 2968 * 2421 2969 * @param int $user_id See {@link bp_forums_total_topic_count()}. 2970 * 2971 * @return int 2422 2972 */ 2423 2973 function bp_get_forum_topic_count( $user_id = 0 ) { 2974 2975 /** 2976 * Filters the total topic count for a given user. 2977 * 2978 * @since BuddyPress (1.2.0) 2979 * 2980 * @param int $value Total topic count for the given user. 2981 */ 2424 2982 return apply_filters( 'bp_get_forum_topic_count', bp_forums_total_topic_count( $user_id ) ); 2425 2983 }
Note: See TracChangeset
for help on using the changeset viewer.