Skip to:
Content

bbPress.org


Ignore:
Timestamp:
08/06/2015 11:29:43 PM (9 years ago)
Author:
johnjamesjacoby
Message:

Topics: First pass at metabox for replies in single-topic edit

  • Includes topic-replies list-table class
  • Includes helper functions for hooking things in
  • Todo: cap checks or row-actions, maybe bulk-actions, formatting clean-up

See #2842.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/admin/topics.php

    r5868 r5886  
    7979        add_action( 'admin_notices',  array( $this, 'toggle_topic_notice' ) );
    8080
    81         // Anonymous metabox actions
    82         add_action( 'add_meta_boxes', array( $this, 'author_metabox'      ) );
     81        // Metabox actions
     82        add_action( 'add_meta_boxes', array( $this, 'author_metabox'  ) );
     83        add_action( 'add_meta_boxes', array( $this, 'replies_metabox' ) );
    8384
    8485        // Add ability to filter topics and replies per forum
     
    390391
    391392    /**
     393     * Add the replies metabox
     394     *
     395     * Allows viewing & moderating of replies to a topic, based on the way
     396     * comments are visible on a blog post.
     397     *
     398     * @since bbPress (r5886)
     399     *
     400     * @uses bbp_get_topic() To get the topic
     401     * @uses bbp_get_reply() To get the reply
     402     * @uses bbp_get_topic_post_type() To get the topic post type
     403     * @uses bbp_get_reply_post_type() To get the reply post type
     404     * @uses add_meta_box() To add the metabox
     405     * @uses do_action() Calls 'bbp_author_metabox' with the topic/reply
     406     *                    id
     407     */
     408    public function replies_metabox() {
     409
     410        if ( $this->bail() ) {
     411            return;
     412        }
     413
     414        // Bail if post_type is not a reply
     415        if ( empty( $_GET['action'] ) || ( 'edit' !== $_GET['action'] ) ) {
     416            return;
     417        }
     418
     419        // Add the metabox
     420        add_meta_box(
     421            'bbp_topic_replies_metabox',
     422            __( 'Replies', 'bbpress' ),
     423            'bbp_topic_replies_metabox',
     424            $this->post_type,
     425            'normal',
     426            'high'
     427        );
     428
     429        do_action( 'bbp_topic_replies_metabox', get_the_ID() );
     430    }
     431
     432    /**
    392433     * Add some general styling to the admin area
    393434     *
     
    412453                display: inline-block;
    413454                width: 60px;
     455            }
     456
     457            .column-bbp_topic_reply_author,
     458            .column-bbp_forum_topic_author {
     459                width: 25% !important;
     460            }
     461
     462            .column-bbp_topic_reply_author .avatar,
     463            .column-bbp_forum_topic_author .avatar {
     464                float: left;
     465                margin-right: 10px;
    414466            }
    415467
Note: See TracChangeset for help on using the changeset viewer.