Changeset 6528
- Timestamp:
- 06/12/2017 05:29:02 PM (9 years ago)
- Location:
- trunk/src/includes
- Files:
-
- 3 edited
-
forums/template.php (modified) (2 diffs)
-
replies/template.php (modified) (2 diffs)
-
topics/template.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/forums/template.php
r6438 r6528 664 664 $parent_id = get_post_field( 'post_parent', $forum_id ); 665 665 666 // Meta-data fallback 667 if ( empty( $parent_id ) ) { 668 $parent_id = get_post_meta( $forum_id, '_bbp_forum_id', true ); 669 } 670 671 // Filter 672 if ( ! empty( $parent_id ) ) { 673 $parent_id = bbp_get_forum_id( $parent_id ); 674 } 675 666 676 // Filter & return 667 677 return (int) apply_filters( 'bbp_get_forum_parent_id', (int) $parent_id, $forum_id ); … … 2187 2197 if ( ! empty( $last_active ) ) { 2188 2198 2199 // Has replies 2189 2200 if ( ! empty( $reply_count ) ) { 2190 2191 if ( bbp_is_forum_category( $forum_id ) ) { 2192 $retstr = sprintf( esc_html__( 'This category contains %1$s and %2$s, and was last updated by %3$s %4$s.', 'bbpress' ), $topic_text, $reply_text, $last_updated_by, $time_since ); 2193 } else { 2194 $retstr = sprintf( esc_html__( 'This forum contains %1$s and %2$s, and was last updated by %3$s %4$s.', 'bbpress' ), $topic_text, $reply_text, $last_updated_by, $time_since ); 2195 } 2196 2201 $retstr = bbp_is_forum_category( $forum_id ) 2202 ? sprintf( esc_html__( 'This category has %1$s, %2$s, and was last updated %3$s by %4$s.', 'bbpress' ), $topic_text, $reply_text, $time_since, $last_updated_by ) 2203 : sprintf( esc_html__( 'This forum has %1$s, %2$s, and was last updated %3$s by %4$s.', 'bbpress' ), $topic_text, $reply_text, $time_since, $last_updated_by ); 2204 2205 // Only has topics 2197 2206 } else { 2198 2199 if ( bbp_is_forum_category( $forum_id ) ) { 2200 $retstr = sprintf( esc_html__( 'This category contains %1$s, and was last updated by %2$s %3$s.', 'bbpress' ), $topic_text, $last_updated_by, $time_since ); 2201 } else { 2202 $retstr = sprintf( esc_html__( 'This forum contains %1$s, and was last updated by %2$s %3$s.', 'bbpress' ), $topic_text, $last_updated_by, $time_since ); 2203 } 2207 $retstr = bbp_is_forum_category( $forum_id ) 2208 ? sprintf( esc_html__( 'This category has %1$s, and was last updated %2$s by %3$s.', 'bbpress' ), $topic_text, $time_since, $last_updated_by ) 2209 : sprintf( esc_html__( 'This forum has %1$s, and was last updated %2$s by %3$s.', 'bbpress' ), $topic_text, $time_since, $last_updated_by ); 2204 2210 } 2205 2211 2206 // Forum has no last active data 2212 // Forum has no last active data (but does have topics & replies) 2213 } elseif ( ! empty( $reply_count ) ) { 2214 $retstr = bbp_is_forum_category( $forum_id ) 2215 ? sprintf( esc_html__( 'This category has %1$s and %2$s.', 'bbpress' ), $topic_text, $reply_text ) 2216 : sprintf( esc_html__( 'This forum has %1$s and %2$s.', 'bbpress' ), $topic_text, $reply_text ); 2217 2218 // Forum has no last active data or replies (but does have topics) 2219 } elseif ( ! empty( $topic_count ) ) { 2220 $retstr = bbp_is_forum_category( $forum_id ) 2221 ? sprintf( esc_html__( 'This category has %1$s.', 'bbpress' ), $topic_text ) 2222 : sprintf( esc_html__( 'This forum has %1$s.', 'bbpress' ), $topic_text ); 2223 2224 // Forum is empty 2207 2225 } else { 2208 2209 if ( ! empty( $reply_count ) ) { 2210 2211 if ( bbp_is_forum_category( $forum_id ) ) { 2212 $retstr = sprintf( esc_html__( 'This category contains %1$s and %2$s.', 'bbpress' ), $topic_text, $reply_text ); 2213 } else { 2214 $retstr = sprintf( esc_html__( 'This forum contains %1$s and %2$s.', 'bbpress' ), $topic_text, $reply_text ); 2215 } 2216 2217 } else { 2218 2219 if ( ! empty( $topic_count ) ) { 2220 2221 if ( bbp_is_forum_category( $forum_id ) ) { 2222 $retstr = sprintf( esc_html__( 'This category contains %1$s.', 'bbpress' ), $topic_text ); 2223 } else { 2224 $retstr = sprintf( esc_html__( 'This forum contains %1$s.', 'bbpress' ), $topic_text ); 2225 } 2226 2227 } else { 2228 $retstr = esc_html__( 'This forum is empty.', 'bbpress' ); 2229 } 2230 } 2231 } 2232 2233 // Add feeds 2234 //$feed_links = ( ! empty( $r['feed'] ) ) ? bbp_get_forum_topics_feed_link ( $forum_id ) . bbp_get_forum_replies_feed_link( $forum_id ) : ''; 2226 $retstr = esc_html__( 'This forum is empty.', 'bbpress' ); 2227 } 2235 2228 2236 2229 // Add the 'view all' filter back -
trunk/src/includes/replies/template.php
r6526 r6528 1571 1571 */ 1572 1572 function bbp_get_reply_topic_id( $reply_id = 0 ) { 1573 1574 // Assume there is no topic id1575 $topic_id = 0;1576 1577 // Check that reply_id is valid1578 1573 $reply_id = bbp_get_reply_id( $reply_id ); 1579 if ( ! empty( $reply_id ) ) { 1574 $topic_id = get_post_field( 'post_parent', $reply_id ); 1575 1576 // Meta-data fallback 1577 if ( empty( $topic_id ) ) { 1580 1578 $topic_id = get_post_meta( $reply_id, '_bbp_topic_id', true ); 1581 if ( ! empty( $topic_id ) ) { 1582 $topic_id = bbp_get_topic_id( $topic_id ); 1583 } 1584 } 1585 1586 // Filter & return 1587 return (int) apply_filters( 'bbp_get_reply_topic_id', $topic_id, $reply_id ); 1579 } 1580 1581 // Filter 1582 if ( ! empty( $topic_id ) ) { 1583 $topic_id = bbp_get_topic_id( $topic_id ); 1584 } 1585 1586 // Filter & return 1587 return (int) apply_filters( 'bbp_get_reply_topic_id', (int) $topic_id, $reply_id ); 1588 1588 } 1589 1589 … … 1612 1612 */ 1613 1613 function bbp_get_reply_forum_id( $reply_id = 0 ) { 1614 1615 // Assume there is no forum1616 $forum_id = 0;1617 1618 // Check that reply_id is valid1619 1614 $reply_id = bbp_get_reply_id( $reply_id ); 1620 if ( ! empty( $reply_id ) ) { 1615 $forum_id = get_post_field( 'post_parent', bbp_get_reply_topic_id( $reply_id ) ); 1616 1617 // Meta-data fallback 1618 if ( empty( $forum_id ) ) { 1621 1619 $forum_id = get_post_meta( $reply_id, '_bbp_forum_id', true ); 1622 if ( ! empty( $forum_id ) ) { 1623 $forum_id = bbp_get_forum_id( $forum_id ); 1624 } 1620 } 1621 1622 // Filter 1623 if ( ! empty( $forum_id ) ) { 1624 $forum_id = bbp_get_forum_id( $forum_id ); 1625 1625 } 1626 1626 -
trunk/src/includes/topics/template.php
r6438 r6528 1881 1881 function bbp_get_topic_forum_id( $topic_id = 0 ) { 1882 1882 $topic_id = bbp_get_topic_id( $topic_id ); 1883 $forum_id = get_post_meta( $topic_id, '_bbp_forum_id', true ); 1883 $forum_id = get_post_field( 'post_parent', $topic_id ); 1884 1885 // Meta-data fallback 1886 if ( empty( $forum_id ) ) { 1887 $forum_id = get_post_meta( $topic_id, '_bbp_forum_id', true ); 1888 } 1889 1890 // Filter 1891 if ( ! empty( $forum_id ) ) { 1892 $forum_id = bbp_get_forum_id( $forum_id ); 1893 } 1884 1894 1885 1895 // Filter & return … … 3676 3686 $voice_count = sprintf( _n( '%s voice', '%s voices', $vc_int, 'bbpress' ), $voice_count ); 3677 3687 3678 // Topic has replies3679 $last_ reply = bbp_get_topic_last_reply_id( $topic_id );3680 if ( ! empty( $last_ reply) ) {3681 $last_updated_by = bbp_get_author_link( array( 'post_id' => $last_ reply, 'size' => $r['size'] ) );3682 $retstr = sprintf( esc_html__( 'This topic contains %1$s, has %2$s, and was last updated by %3$s %4$s.', 'bbpress' ), $reply_count, $voice_count, $last_updated_by, $time_since);3688 // Topic has activity (could be from reply or topic author) 3689 $last_active = bbp_get_topic_last_active_id( $topic_id ); 3690 if ( ! empty( $last_active ) ) { 3691 $last_updated_by = bbp_get_author_link( array( 'post_id' => $last_active, 'size' => $r['size'] ) ); 3692 $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 ); 3683 3693 3684 3694 // Topic has no replies 3685 3695 } elseif ( ! empty( $voice_count ) && ! empty( $reply_count ) ) { 3686 $retstr = sprintf( esc_html__( 'This topic contains %1$s and has%2$s.', 'bbpress' ), $voice_count, $reply_count );3696 $retstr = sprintf( esc_html__( 'This topic has %1$s and %2$s.', 'bbpress' ), $voice_count, $reply_count ); 3687 3697 3688 3698 // Topic has no replies and no voices … … 4112 4122 4113 4123 /** 4114 * Allow topic rows to have admin strative actions4124 * Allow topic rows to have administrative actions 4115 4125 * 4116 4126 * @since 2.1.0 bbPress (r3653)
Note: See TracChangeset
for help on using the changeset viewer.