Skip to:
Content

BuddyPress.org

Changeset 5623


Ignore:
Timestamp:
01/07/2012 07:48:58 PM (10 years ago)
Author:
djpaul
Message:

Add 'history' meta box to admin edit activity screen. See #3660.

Location:
trunk/bp-activity
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-activity/admin/css/admin.css

    r5621 r5623  
    1 .akismet-status{float:right;}.akismet-status a{color:#AAA;font-style:italic;}#wp-bp-activities-wrap{padding:5px 0;}#bp-activities{height:120px;}#bp-replyhead{font-size:1em;line-height:1.4em;margin:0;}#bp-replysubmit{margin:0;padding:0 0 3px;text-align:center;}#bp-replysubmit .error{color:red;line-height:21px;text-align:center;vertical-align:center;}#bp-replysubmit img.waiting{float:right;padding:4px 10px 0;vertical-align:top;}#bp-activities-form .column-response img{float:left;margin-right:10px;margin-top:1px;}.activity-errors{list-style-type:disc;margin-left:2em;}#bp_activity_action div.inside,#bp_activity_content div.inside{line-height:0;}#bp_activity_action h3,#bp_activity_content h3{cursor:auto;}#bp_activity_action td.mceIframeContainer,#bp_activity_content td.mceIframeContainer{background-color:white;}#post-body #bp-activities-action_resize,#post-body #bp-activities-content_resize{position:inherit;margin-top:-2px;}#bp_activity_link input{width:99%;}#bp-activities-primaryid{margin-bottom:1em;}
     1.akismet-status{float:right;}.akismet-status a{color:#AAA;font-style:italic;}.akismet-history{margin:13px;}.akismet-history div{margin-bottom:13px;}.akismet-history span{color:#999;}#wp-bp-activities-wrap{padding:5px 0;}#bp-activities{height:120px;}#bp-replyhead{font-size:1em;line-height:1.4em;margin:0;}#bp-replysubmit{margin:0;padding:0 0 3px;text-align:center;}#bp-replysubmit .error{color:red;line-height:21px;text-align:center;vertical-align:center;}#bp-replysubmit img.waiting{float:right;padding:4px 10px 0;vertical-align:top;}#bp-activities-form .column-response img{float:left;margin-right:10px;margin-top:1px;}.activity-errors{list-style-type:disc;margin-left:2em;}#bp_activity_action div.inside,#bp_activity_content div.inside{line-height:0;}#bp_activity_action h3,#bp_activity_content h3{cursor:auto;}#bp_activity_action td.mceIframeContainer,#bp_activity_content td.mceIframeContainer{background-color:white;}#post-body #bp-activities-action_resize,#post-body #bp-activities-content_resize{position:inherit;margin-top:-2px;}#bp_activity_link input{width:99%;}#bp-activities-primaryid{margin-bottom:1em;}
  • trunk/bp-activity/admin/css/admin.dev.css

    r5621 r5623  
    66    font-style: italic;
    77}
     8.akismet-history {
     9    margin: 13px;
     10}
     11.akismet-history div {
     12    margin-bottom: 13px;
     13}
     14.akismet-history span {
     15    color: #999;
     16}
     17
    818#wp-bp-activities-wrap {
    919    padding: 5px 0;
  • trunk/bp-activity/bp-activity-admin.php

    r5576 r5623  
    11011101     */
    11021102    function get_views() {
    1103         $redirect_to = remove_query_arg( array( 'activity_status', 'aid', 'deleted', 'spammed', 'unspammed', ), $_SERVER['REQUEST_URI'] );
     1103        $redirect_to = remove_query_arg( array( 'activity_status', 'aid', 'deleted', 'error', 'spammed', 'unspammed', 'updated', ), $_SERVER['REQUEST_URI'] );
    11041104    ?>
    11051105        <ul class="subsubsub">
  • trunk/bp-activity/bp-activity-akismet.php

    r5622 r5623  
    5656        // Hook into the Activity wp-admin screen
    5757        add_action( 'bp_activity_admin_comment_row_actions', array( $this, 'comment_row_action' ), 10, 2 );
     58        add_action( 'bp_activity_admin_load',                array( $this, 'add_history_metabox' ) );
    5859    }
    5960
     
    9798                $b[ $k ] = $item;
    9899                if ( $k == 'edit' )
    99                     $b['history'] = '<a href="' . network_admin_url( 'admin.php?page=bp-activity&amp;action=edit&aid=' . $activity['id'] ) . '#history"> '. __( 'History', 'buddypress' ) . '</a>';
     100                    $b['history'] = '<a href="' . network_admin_url( 'admin.php?page=bp-activity&amp;action=edit&aid=' . $activity['id'] ) . '#bp_activity_history"> '. __( 'History', 'buddypress' ) . '</a>';
    100101            }
    101102
     
    104105
    105106        if ( $desc )
    106             echo '<span class="akismet-status"><a href="' . network_admin_url( 'admin.php?page=bp-activity&amp;action=edit&aid=' . $activity['id'] ) . '#history">' . htmlspecialchars( $desc ) . '</a></span>';
     107            echo '<span class="akismet-status"><a href="' . network_admin_url( 'admin.php?page=bp-activity&amp;action=edit&aid=' . $activity['id'] ) . '#bp_activity_history">' . htmlspecialchars( $desc ) . '</a></span>';
    107108
    108109        return apply_filters( 'bp_akismet_comment_row_action', $actions );
    109110    }
    110 
    111111
    112112    /**
     
    485485
    486486    /**
     487     * Adds a "History" meta box to the activity edit screen.
     488     *
     489     * @param string $screen_action The type of screen that has been requested
     490     * @since 1.6
     491     */
     492    function add_history_metabox( $screen_action ) {
     493        // Only proceed if we're on the edit screen
     494        if ( 'edit' != $screen_action )
     495            return;
     496
     497        // Display meta box with a low priority (low position on screen by default)
     498        add_meta_box( 'bp_activity_history',  __( 'Activity History', 'buddypress' ), array( $this, 'history_metabox' ), 'toplevel_page_bp-activity', 'advanced', 'low' );
     499    }
     500
     501    /**
     502     * History meta box for the Activity admin edit screen
     503     *
     504     * @param object $item Activity item
     505     * @since 1.6
     506     * @todo Update activity meta to allow >1 record with the same key (iterate through $history).
     507     * @see http://buddypress.trac.wordpress.org/ticket/3907
     508     */
     509    function history_metabox( $item ) {
     510        $history = BP_Akismet::get_activity_history( $item->id );
     511
     512        if ( empty( $history ) )
     513            return;
     514
     515        echo '<div class="akismet-history"><div>';
     516        printf( '<span>%1$s</span> &mdash; %2$s', bp_core_time_since( $history[2] ), esc_html( $history[1] ) );
     517        echo '</div></div>';
     518    }
     519
     520    /**
    487521     * Update an activity item's Akismet history
    488522     *
Note: See TracChangeset for help on using the changeset viewer.