Changeset 4985
- Timestamp:
- 06/11/2013 04:42:26 AM (12 years ago)
- Location:
- trunk/includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/replies/template-tags.php
r4973 r4985 1685 1685 * @since bbPress (r2667) 1686 1686 * 1687 * @param mixed$args See {@link bbp_get_reply_admin_links()}1687 * @param array $args See {@link bbp_get_reply_admin_links()} 1688 1688 * @uses bbp_get_reply_admin_links() To get the reply admin links 1689 1689 */ 1690 function bbp_reply_admin_links( $args = '') {1690 function bbp_reply_admin_links( $args = array() ) { 1691 1691 echo bbp_get_reply_admin_links( $args ); 1692 1692 } … … 1696 1696 * @since bbPress (r2667) 1697 1697 * 1698 * @param mixed$args This function supports these arguments:1698 * @param array $args This function supports these arguments: 1699 1699 * - id: Optional. Reply id 1700 1700 * - before: HTML before the links. Defaults to … … 1718 1718 * @return string Reply admin links 1719 1719 */ 1720 function bbp_get_reply_admin_links( $args = '') {1720 function bbp_get_reply_admin_links( $args = array() ) { 1721 1721 1722 1722 // Parse arguments against default values … … 1732 1732 1733 1733 // If post is a topic, return the topic admin links instead 1734 if ( bbp_is_topic( $r['id'] ) ) 1734 if ( bbp_is_topic( $r['id'] ) ) { 1735 1735 return bbp_get_topic_admin_links( $args ); 1736 } 1736 1737 1737 1738 // If post is not a reply, return 1738 if ( !bbp_is_reply( $r['id'] ) ) 1739 if ( !bbp_is_reply( $r['id'] ) ) { 1739 1740 return; 1740 1741 // Make sure user can edit this reply 1742 if ( !current_user_can( 'edit_reply', $r['id'] ) ) 1741 } 1742 1743 // If topic is trashed, do not show admin links 1744 if ( bbp_is_topic_trash( bbp_get_reply_topic_id( $r['id'] ) ) ) { 1743 1745 return; 1744 1745 // If topic is trashed, do not show admin links 1746 if ( bbp_is_topic_trash( bbp_get_reply_topic_id( $r['id'] ) ) ) 1747 return; 1746 } 1748 1747 1749 1748 // If no links were passed, default to the standard … … 1759 1758 } 1760 1759 1761 // Check caps for trashing the topic1762 if ( !current_user_can( 'delete_reply', $r['id'] ) && !empty( $r['links']['trash'] ) )1763 unset( $r['links']['trash'] );1764 1765 1760 // See if links need to be unset 1766 1761 $reply_status = bbp_get_reply_status( $r['id'] ); … … 1768 1763 1769 1764 // Spam link shouldn't be visible on trashed topics 1770 if ( bbp_get_trash_status_id() == $reply_status ) {1765 if ( bbp_get_trash_status_id() === $reply_status ) { 1771 1766 unset( $r['links']['spam'] ); 1772 1767 1773 1768 // Trash link shouldn't be visible on spam topics 1774 } elseif ( isset( $r['links']['trash'] ) && ( bbp_get_spam_status_id() == $reply_status )) {1769 } elseif ( bbp_get_spam_status_id() === $reply_status ) { 1775 1770 unset( $r['links']['trash'] ); 1776 1771 } … … 1781 1776 $retval = $r['before'] . $links . $r['after']; 1782 1777 1783 return apply_filters( 'bbp_get_reply_admin_links', $retval, $r );1778 return apply_filters( 'bbp_get_reply_admin_links', $retval, $r, $args ); 1784 1779 } 1785 1780 -
trunk/includes/topics/template-tags.php
r4970 r4985 2217 2217 * Output admin links for topic 2218 2218 * 2219 * @param mixed$args See {@link bbp_get_topic_admin_links()}2219 * @param array $args See {@link bbp_get_topic_admin_links()} 2220 2220 * @uses bbp_get_topic_admin_links() To get the topic admin links 2221 2221 */ 2222 function bbp_topic_admin_links( $args = '') {2222 function bbp_topic_admin_links( $args = array() ) { 2223 2223 echo bbp_get_topic_admin_links( $args ); 2224 2224 } … … 2228 2228 * Move topic functionality is handled by the edit topic page. 2229 2229 * 2230 * @param mixed$args This function supports these arguments:2230 * @param array $args This function supports these arguments: 2231 2231 * - id: Optional. Topic id 2232 2232 * - before: Before the links … … 2247 2247 * @return string Topic admin links 2248 2248 */ 2249 function bbp_get_topic_admin_links( $args = '') {2249 function bbp_get_topic_admin_links( $args = array() ) { 2250 2250 2251 2251 // Parse arguments against default values … … 2257 2257 'links' => array() 2258 2258 ), 'get_topic_admin_links' ); 2259 2260 if ( !current_user_can( 'edit_topic', $r['id'] ) )2261 return;2262 2259 2263 2260 if ( empty( $r['links'] ) ) { … … 2273 2270 } 2274 2271 2275 // Check caps for trashing the topic2276 if ( !current_user_can( 'delete_topic', $r['id'] ) && !empty( $r['links']['trash'] ) )2277 unset( $r['links']['trash'] );2278 2279 2272 // See if links need to be unset 2280 2273 $topic_status = bbp_get_topic_status( $r['id'] ); … … 2285 2278 2286 2279 // Spam link shouldn't be visible on trashed topics 2287 if ( $topic_status == bbp_get_trash_status_id() )2280 if ( bbp_get_trash_status_id() === $topic_status ) { 2288 2281 unset( $r['links']['spam'] ); 2289 2282 2290 2283 // Trash link shouldn't be visible on spam topics 2291 elseif ( $topic_status == bbp_get_spam_status_id() )2284 } elseif ( bbp_get_spam_status_id() === $topic_status ) { 2292 2285 unset( $r['links']['trash'] ); 2286 } 2293 2287 } 2294 2288 2295 2289 // Process the admin links 2296 $links = implode( $r['sep'], array_filter( $r['links'] ) ); 2297 2298 return apply_filters( 'bbp_get_topic_admin_links', $r['before'] . $links . $r['after'], $r ); 2290 $links = implode( $r['sep'], array_filter( $r['links'] ) ); 2291 $retval = $r['before'] . $links . $r['after']; 2292 2293 return apply_filters( 'bbp_get_topic_admin_links', $retval, $r, $args ); 2299 2294 } 2300 2295
Note: See TracChangeset
for help on using the changeset viewer.