Skip to:
Content

bbPress.org


Ignore:
Timestamp:
03/29/2018 06:03:12 PM (7 years ago)
Author:
johnjamesjacoby
Message:

Admin: improve topic/reply row-action UX.

This change includes more improvements to how topics and replies are toggled from an admin area list-table:

  • Move "Empty Spam" buttons to their own actions div
  • Allow spam/trash/approve/unapprove from any other status, so topics/replies can be more freely moved around
  • Add public/non-public functions for replies to match topics

See #1799.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/replies/template.php

    r6777 r6791  
    828828
    829829/**
     830 * Return array of public reply statuses.
     831 *
     832 * @since 2.6.0 bbPress (r6705)
     833 *
     834 * @return array
     835 */
     836function bbp_get_public_reply_statuses() {
     837    $statuses = array(
     838        bbp_get_public_status_id()
     839    );
     840
     841    // Filter & return
     842    return (array) apply_filters( 'bbp_get_public_reply_statuses', $statuses );
     843}
     844
     845/**
     846 * Return array of non-public reply statuses.
     847 *
     848 * @since 2.6.0 bbPress (r6791)
     849 *
     850 * @return array
     851 */
     852function bbp_get_non_public_reply_statuses() {
     853    $statuses = array(
     854        bbp_get_trash_status_id(),
     855        bbp_get_spam_status_id(),
     856        bbp_get_pending_status_id()
     857    );
     858
     859    // Filter & return
     860    return (array) apply_filters( 'bbp_get_non_public_reply_statuses', $statuses );
     861}
     862
     863/**
     864 * Is the reply publicly viewable?
     865 *
     866 * See bbp_get_public_reply_statuses() for public statuses.
     867 *
     868 * @since 2.6.0 bbPress (r6391)
     869 *
     870 * @param int $reply_id Optional. Reply id
     871 * @return bool True if public, false if not.
     872 */
     873function bbp_is_reply_public( $reply_id = 0 ) {
     874    $reply_id  = bbp_get_reply_id( $reply_id );
     875    $status    = bbp_get_reply_status( $reply_id );
     876    $public    = bbp_get_public_reply_statuses();
     877    $is_public = in_array( $status, $public, true );
     878
     879    // Filter & return
     880    return (bool) apply_filters( 'bbp_is_reply_public', $is_public, $reply_id );
     881}
     882
     883/**
    830884 * Is the reply not spam or deleted?
    831885 *
Note: See TracChangeset for help on using the changeset viewer.