Changeset 3551
- Timestamp:
- 10/30/2011 03:50:51 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-forum-template.php
r3505 r3551 322 322 323 323 // Set root text to page title 324 if ( $page = bbp_get_page_by_path( $bbp->root_slug ) ) { 324 $page = bbp_get_page_by_path( $bbp->root_slug ); 325 if ( !empty( $page ) ) { 325 326 $title = get_the_title( $page->ID ); 326 327 … … 436 437 437 438 if ( !$last_active = get_post_meta( $forum_id, '_bbp_last_active_time', true ) ) { 438 if ( $reply_id = bbp_get_forum_last_reply_id( $forum_id ) ) { 439 $reply_id = bbp_get_forum_last_reply_id( $forum_id ); 440 if ( !empty( $reply_id ) ) { 439 441 $last_active = get_post_field( 'post_date', $reply_id ); 440 442 } else { 441 if ( $topic_id = bbp_get_forum_last_topic_id( $forum_id ) ) { 443 $topic_id = bbp_get_forum_last_topic_id( $forum_id ); 444 if ( !empty( $topic_id ) ) { 442 445 $last_active = bbp_get_topic_last_active_time( $topic_id ); 443 446 } … … 548 551 $forum_id = bbp_get_forum_id( $forum_id ); 549 552 $ancestors = array(); 550 551 if ( $forum = bbp_get_forum( $forum_id ) ) { 553 $forum = bbp_get_forum( $forum_id ); 554 555 if ( !empty( $forum ) ) { 552 556 while ( 0 !== $forum->post_parent ) { 553 557 $ancestors[] = $forum->post_parent; … … 664 668 665 669 // Loop through forums and create a list 666 if ( $sub_forums = bbp_forum_get_subforums( $forum_id ) ) { 670 $sub_forums = bbp_forum_get_subforums( $forum_id ); 671 if ( !empty( $sub_forum ) ) { 667 672 668 673 // Total count (for separator) … … 961 966 962 967 // If forum has replies, get the last reply and use its url 963 if ( $reply_id = bbp_get_forum_last_reply_id( $forum_id ) ) { 968 $reply_id = bbp_get_forum_last_reply_id( $forum_id ); 969 if ( !empty( $reply_id ) ) { 964 970 $reply_url = bbp_get_reply_url( $reply_id ); 965 971 … … 1673 1679 1674 1680 // Forum has posts 1675 if ( $last_reply = bbp_get_forum_last_active_id( $forum_id ) ) { 1681 $last_reply = bbp_get_forum_last_active_id( $forum_id ); 1682 if ( !empty( $last_reply ) ) { 1676 1683 1677 1684 // Freshness author … … 1709 1716 // Return filtered result 1710 1717 return apply_filters( 'bbp_get_single_forum_description', $retstr, $args ); 1718 } 1719 1720 /** Forms *********************************************************************/ 1721 1722 /** 1723 * Output the value of forum title field 1724 * 1725 * @since bbPress (r3551) 1726 * 1727 * @uses bbp_get_form_forum_title() To get the value of forum title field 1728 */ 1729 function bbp_form_forum_title() { 1730 echo bbp_get_form_forum_title(); 1731 } 1732 /** 1733 * Return the value of forum title field 1734 * 1735 * @since bbPress (r3551) 1736 * 1737 * @uses bbp_is_forum_edit() To check if it's forum edit page 1738 * @uses apply_filters() Calls 'bbp_get_form_forum_title' with the title 1739 * @return string Value of forum title field 1740 */ 1741 function bbp_get_form_forum_title() { 1742 global $post; 1743 1744 // Get _POST data 1745 if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['bbp_forum_title'] ) ) 1746 $forum_title = $_POST['bbp_forum_title']; 1747 1748 // Get edit data 1749 elseif ( !empty( $post->post_title ) && bbp_is_forum_edit() ) 1750 $forum_title = $post->post_title; 1751 1752 // No data 1753 else 1754 $forum_title = ''; 1755 1756 return apply_filters( 'bbp_get_form_forum_title', esc_attr( $forum_title ) ); 1757 } 1758 1759 /** 1760 * Output the value of forum content field 1761 * 1762 * @since bbPress (r3551) 1763 * 1764 * @uses bbp_get_form_forum_content() To get value of forum content field 1765 */ 1766 function bbp_form_forum_content() { 1767 echo bbp_get_form_forum_content(); 1768 } 1769 /** 1770 * Return the value of forum content field 1771 * 1772 * @since bbPress (r3551) 1773 * 1774 * @uses bbp_is_forum_edit() To check if it's the forum edit page 1775 * @uses apply_filters() Calls 'bbp_get_form_forum_content' with the content 1776 * @return string Value of forum content field 1777 */ 1778 function bbp_get_form_forum_content() { 1779 global $post; 1780 1781 // Get _POST data 1782 if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['bbp_forum_content'] ) ) 1783 $forum_content = $_POST['bbp_forum_content']; 1784 1785 // Get edit data 1786 elseif ( !empty( $post->post_title ) && bbp_is_forum_edit() ) 1787 $forum_content = $post->post_content; 1788 1789 // No data 1790 else 1791 $forum_content = ''; 1792 1793 return apply_filters( 'bbp_get_form_forum_content', esc_textarea( $forum_content ) ); 1794 } 1795 1796 /** 1797 * Output value of forum parent 1798 * 1799 * @since bbPress (r3551) 1800 * 1801 * @uses bbp_get_form_forum_parent() To get the topic's forum id 1802 */ 1803 function bbp_form_forum_parent() { 1804 echo bbp_get_form_forum_parent(); 1805 } 1806 /** 1807 * Return value of forum parent 1808 * 1809 * @since bbPress (r3551) 1810 * 1811 * @uses bbp_is_topic_edit() To check if it's the topic edit page 1812 * @uses bbp_get_forum_parent_id() To get the topic forum id 1813 * @uses apply_filters() Calls 'bbp_get_form_forum_parent' with the forum 1814 * @return string Value of topic content field 1815 */ 1816 function bbp_get_form_forum_parent() { 1817 1818 // Get _POST data 1819 if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && isset( $_POST['bbp_forum_id'] ) ) 1820 $forum_parent = $_POST['bbp_forum_id']; 1821 1822 // Get edit data 1823 elseif ( bbp_is_forum_edit() ) 1824 $forum_parent = bbp_get_forum_parent_id(); 1825 1826 // No data 1827 else 1828 $forum_parent = 0; 1829 1830 return apply_filters( 'bbp_get_form_forum_parent', esc_attr( $forum_parent ) ); 1711 1831 } 1712 1832
Note: See TracChangeset
for help on using the changeset viewer.