Skip to:
Content

BuddyPress.org

Changeset 5325


Ignore:
Timestamp:
11/12/2011 09:09:29 PM (13 years ago)
Author:
djpaul
Message:

See #3660. Activity admin iteration.

  • Update automatic Akismet submission hook priority (r5276).
  • Update "In Response To" column.
  • Update Contextual Help.
  • Spam, un-spam and delete action buttons work.
  • Small styling tweaks.
  • Switched some $bp global and BP_VERSION to use the new wrapper functions.
Location:
trunk/bp-activity
Files:
3 edited

Legend:

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

    r5287 r5325  
    33 * BuddyPress Activity component admin screen
    44 *
    5  * Props to WordPress core for the Comments admin screen and its contextual help text, on which this is heavily based.
     5 * Props to WordPress core for the Comments admin screen, and its contextual help text,
     6 * on which this implementation is heavily based.
    67 *
    78 * @package BuddyPress
     
    6566 *
    6667 * @global BP_Activity_List_Table $bp_activity_list_table Activity screen list table
    67  * @global WP_Screen $current_screen Current screen object
    6868 * @since 1.6
    6969 */
    7070function bp_activity_admin_load() {
    71     global $bp_activity_list_table, $current_screen;
     71    global $bp_activity_list_table;
    7272
    7373    // per_page screen option
    7474    add_screen_option( 'per_page', array( 'label' => _x( 'Activities', 'Activity items per page (screen options)', 'buddypress' )) );
    7575
    76     // Help text
    77     add_contextual_help( $current_screen, '<p>' . __( 'You can manage activities made on your site similar to the way you manage comments and other content. This screen is customizable in the same ways as other management screens, and you can act on activities using the on-hover action links or the Bulk Actions.', 'buddypress' ) . '</p>' .
     76    // Help panel - text
     77    add_contextual_help( get_current_screen(), '<p>' . __( 'You can manage activities made on your site similar to the way you manage comments and other content. This screen is customizable in the same ways as other management screens, and you can act on activities using the on-hover action links or the Bulk Actions.', 'buddypress' ) . '</p>' .
     78        '<p>' . __( 'There are many different types of activities. Some are generated by BuddyPress automatically, and others are entered directly by a user in the form of status update. To help manage the different activity types, use the filter dropdown box to switch between them.', 'buddypress' ) . '</p>' .
     79
    7880        '<p>' . __( 'In the Activity column, above each activity it says &#8220;Submitted on,&#8221; followed by the date and time the activity item was generated on your site. Clicking on the date/time link will take you to that activity on your live site. Hovering over any activity gives you options to reply, edit, spam mark, or delete that activity.', 'buddypress' ) . '</p>' .
    79         '<p>' . __( 'There are many different types of activities. Some are generated by BuddyPress automatically, and others are entered directly by a user in the form of status update. To help manage the different activity types, use the filter dropdown box to switch between them.', 'buddypress' ) . '</p>' .
     81        '<p>' . __( 'In the In Response To column, the text is the name of the user who generated the activity, and a link to the activity on your live site. The small bubble with the number in it shows how many other activities are related to this one; these are usually comments. Clicking the bubble will filter the activity screen to show only related activity items.', 'buddypress' ) . '</p>'
     82    );
     83
     84    // Help panel - sidebar links
     85    get_current_screen()->set_help_sidebar(
    8086        '<p><strong>' . __( 'For more information:', 'buddypress' ) . '</strong></p>' .
    8187        '<p>' . __( '<a href="http://buddypress.org/support/">Support Forums</a>', 'buddypress' ) . '</p>'
     
    8591    $bp_activity_list_table = new BP_Activity_List_Table();
    8692
    87     // Handle edit/reply/spam/unspam/delete of activities
     93    // Handle spam/un-spam/delete of activities
    8894    $doaction = $bp_activity_list_table->current_action();
    89     if ( $doaction ) {
    90         check_admin_referer( 'bulk-activities' );
    91 
     95    if ( $doaction && 'edit' != $doaction ) {
     96
     97        // Build redirection URL
     98        $redirect_to = remove_query_arg( array( 'aid', 'deleted', 'spammed', 'unspammed', ), wp_get_referer() );
     99        $redirect_to = add_query_arg( 'paged', $bp_activity_list_table->get_pagenum(), $redirect_to );
     100
     101        // Get activity IDs
     102        $activity_ids = array_map( 'absint', (array) $_REQUEST['aid'] );
     103
     104        // Is this a bulk request?
     105        if ( 'bulk_' == substr( $doaction, 0, 5 ) && !empty( $_REQUEST['aid'] ) ) {
     106            // Check this is a valid form submission
     107            check_admin_referer( 'bulk-activities' );
     108
     109            // Trim 'bulk_' off the action name to avoid duplicating a ton of code
     110            $doaction = substr( $doaction, 5 );
     111
     112        // This is a request to delete, spam, or un-spam, a single item.
     113        } elseif ( !empty( $_REQUEST['aid'] ) ) {
     114
     115            // Check this is a valid form submission
     116            check_admin_referer( 'spam-activity_' . $activity_ids[0] );
     117        }
     118
     119        // Initialise counters for how many of each type of item we perform an action on
     120        $deleted = $spammed = $unspammed = 0;
     121
     122        // "We'd like to shoot the monster, could you move, please?"
     123        foreach ( $activity_ids as $activity_id ) {
     124            // @todo: Check the permissions on each
     125            //if ( ! current_user_can( 'bp_edit_activity', $activity_id ) )
     126            //  continue;
     127
     128            // Get the activity from the database
     129            $activity = new BP_Activity_Activity( $activity_id );
     130            if ( empty( $activity->component ) )
     131                continue;
     132
     133            switch ( $doaction ) {
     134                case 'delete' :
     135                    if ( 'activity_comment' == $activity->type )
     136                        bp_activity_delete_comment( $activity->item_id, $activity->id );
     137                    else
     138                        bp_activity_delete( array( 'id' => $activity->id ) );
     139
     140                    $deleted++;
     141                    break;
     142
     143                case 'ham' :
     144                    bp_activity_mark_as_ham( $activity );
     145                    $activity->save();
     146
     147                    break;
     148
     149                case 'spam' :
     150                    bp_activity_mark_as_spam( $activity );
     151                    $activity->save();
     152
     153                    $spammed++;
     154                    break;
     155
     156                default:
     157                    break;
     158            }
     159
     160            // Release memory
     161            unset( $activity );
     162        }
     163
     164        // Add arguments to the redirect URL so that on page reload, we can easily display what we've just done.
     165        if ( $spammed )
     166            $redirect_to = add_query_arg( 'spammed', $spammed, $redirect_to );
     167
     168        if ( $unspammed )
     169            $redirect_to = add_query_arg( 'unspammed', $unspammed, $redirect_to );
     170
     171        if ( $deleted )
     172            $redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to );
     173
     174        // Redirect
     175        wp_redirect( $redirect_to );
     176        exit;
     177
     178    // If a referrer and a nonce is supplied, but no action, redirect back.
    92179    } elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
    93          wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) );
    94          exit;
     180        wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) );
     181        exit;
    95182    }
    96183}
     
    105192    global $bp_activity_list_table;
    106193
     194    $messages = array();
     195
     196    // If the user has just made a change to an activity item, build status messages
     197    if ( !empty( $_REQUEST['deleted'] ) || !empty( $_REQUEST['spammed'] ) || !empty( $_REQUEST['unspammed'] ) ) {
     198        $deleted   = !empty( $_REQUEST['deleted']   ) ? (int) $_REQUEST['deleted']   : 0;
     199        $spammed   = !empty( $_REQUEST['spammed']   ) ? (int) $_REQUEST['spammed']   : 0;
     200        $unspammed = !empty( $_REQUEST['unspammed'] ) ? (int) $_REQUEST['unspammed'] : 0;
     201
     202        if ( $deleted > 0 )
     203            $messages[] = sprintf( _n( '%s activity was permanently deleted.', '%s activities were permanently deleted.', $deleted, 'buddypress' ), $deleted );
     204
     205        if ( $spammed > 0 )
     206            $messages[] = sprintf( _n( '%s activity marked as spam.', '%s activities marked as spam.', $spammed, 'buddypress' ), $spammed );
     207
     208        if ( $unspammed > 0 )
     209            $messages[] = sprintf( _n( '%s activity restored from the spam.', '%s activities restored from the spam.', $unspammed, 'buddypress' ), $unspammed );
     210
     211    // Handle the edit screen
     212    } elseif ( 'edit' == $bp_activity_list_table->current_action() && !empty( $_GET['aid'] ) ) {
     213        echo '@TODO: Activity Edit screen.';
     214        return;
     215    }
     216
     217    // Prepare the activity items for display
    107218    $bp_activity_list_table->prepare_items();
    108219?>
     
    111222        <?php screen_icon( 'buddypress' ); ?>
    112223        <h2>
    113             <?php if ( !empty( $_REQUEST['a'] ) ) : ?>
    114                 <?php printf( __( 'Activity (ID #%d)', 'buddypress' ), (int) $_REQUEST['a'] ); ?>
     224            <?php if ( !empty( $_REQUEST['aid'] ) ) : ?>
     225                <?php printf( __( 'Activity (ID #%d)', 'buddypress' ), (int) $_REQUEST['aid'] ); ?>
    115226            <?php else : ?>
    116227                <?php _e( 'Activity', 'buddypress' ); ?>
     
    121232            <?php endif; ?>
    122233        </h2>
     234
     235        <?php // If the user has just made a change to an activity item, display the status messages ?>
     236        <?php if ( !empty( $messages ) ) : ?>
     237            <div id="moderated" class="updated"><p><?php echo implode( "<br/>\n", $messages ); ?></p></div>
     238        <?php endif; ?>
    123239
    124240        <?php $bp_activity_list_table->views(); ?>
     
    181297
    182298        // Option defaults
    183         $filter       = array();
    184         $activity     = false;
    185         $search_terms = false;
    186         $sort         = 'DESC';
    187         $spam         = 'ham_only';
     299        $filter           = array();
     300        $include_id       = false;
     301        $search_terms     = false;
     302        $sort             = 'DESC';
     303        $spam             = 'ham_only';
    188304
    189305        // Set current page
     
    216332
    217333        // Check if user has clicked on a specific activity (if so, fetch only that, and any related, activity).
    218         if ( !empty( $_REQUEST['a'] ) )
    219             $activity = (int) $_REQUEST['a'];
     334        if ( !empty( $_REQUEST['aid'] ) )
     335            $include_id = (int) $_REQUEST['aid'];
    220336
    221337        // Get the spam total (ignoring any search query or filter)
     
    228344        unset( $spams );
    229345
    230         // Get the activites from the database
     346        // Get the activities from the database
    231347        $activities = bp_activity_get( array(
    232348            'display_comments' => 'stream',
    233349            'filter'           => $filter,
    234             'in'               => $activity,
     350            'in'               => $include_id,
    235351            'page'             => $page,
    236352            'per_page'         => $per_page,
     
    246362            $new_activities[] = (array) $activity_item;
    247363
     364        // @todo If we're viewing a specific activity, check/merge $activity->children into the main list (recursive).
     365        /*if ( $include_id ) {
     366        }*/
     367
    248368        // Set raw data to display
    249369        $this->items       = $new_activities;
     
    307427            </tfoot>
    308428
    309             <tbody id="the-comment-list" class="list:comment">
     429            <tbody id="the-comment-list">
    310430                <?php $this->display_rows_or_placeholder(); ?>
    311             </tbody>
    312 
    313             <tbody id="the-extra-comment-list" class="list:comment" style="display: none;">
    314                 <?php $this->items = $this->extra_items; $this->display_rows(); ?>
    315431            </tbody>
    316432        </table>
     
    326442     */
    327443    function get_views() {
     444        $redirect_to = remove_query_arg( array( 'activity_status', 'aid', 'deleted', 'spammed', 'unspammed', ), $_SERVER['REQUEST_URI'] );
    328445    ?>
    329446        <ul class="subsubsub">
    330             <li class="all"><a href="<?php echo remove_query_arg( 'activity_status' ); ?>" class="<?php if ( 'spam' != $this->view ) echo 'current'; ?>"><?php _e( 'All', 'buddypress' ); ?></a> |</li>
    331             <li class="spam"><a href="<?php echo add_query_arg( 'activity_status', 'spam' ); ?>" class="<?php if ( 'spam' == $this->view ) echo 'current'; ?>"><?php printf( __( 'Spam (%d)', 'buddypress' ), $this->spam_count ); ?></a></li>
     447            <li class="all"><a href="<?php echo esc_attr( esc_url( $redirect_to ) ); ?>" class="<?php if ( 'spam' != $this->view ) echo 'current'; ?>"><?php _e( 'All', 'buddypress' ); ?></a> |</li>
     448            <li class="spam"><a href="<?php echo esc_attr( esc_url( add_query_arg( 'activity_status', 'spam', $redirect_to ) ) ); ?>" class="<?php if ( 'spam' == $this->view ) echo 'current'; ?>"><?php printf( __( 'Spam <span class="count">(%d)</span>', 'buddypress' ), $this->spam_count ); ?></a></li>
    332449        </ul>
    333450    <?php
     
    342459    function get_bulk_actions() {
    343460        $actions = array();
    344         $actions['spam']   = __( 'Mark as Spam', 'buddypress' );
    345         $actions['unspam'] = __( 'Not Spam', 'buddypress' );
    346         $actions['delete'] = __( 'Delete Permanently', 'buddypress' );
     461        $actions['bulk_spam']   = __( 'Mark as Spam', 'buddypress' );
     462        $actions['bulk_ham']    = __( 'Not Spam', 'buddypress' );
     463        $actions['bulk_delete'] = __( 'Delete Permanently', 'buddypress' );
    347464
    348465        return $actions;
     
    440557     */
    441558    function column_cb( $item ) {
    442         printf( '<input type="checkbox" name="activity_id[]" value="%d" />', (int) $item['id'] );
     559        printf( '<input type="checkbox" name="aid[]" value="%d" />', (int) $item['id'] );
    443560    }
    444561
     
    478595        );
    479596
    480         // Get rollover actions.
    481         // Reply
     597        // Build actions URLs
     598        $base_url   = network_admin_url( 'admin.php?page=bp-activity&amp;aid=' . $item['id'] );
     599        $spam_nonce = esc_html( '_wpnonce=' . wp_create_nonce( 'spam-activity_' . $item['id'] ) );
     600
     601        $delete_url = $base_url . "&amp;action=delete&$spam_nonce";
     602        $edit_url   = $base_url . '&amp;action=edit';
     603        $ham_url    = $base_url . "&amp;action=ham&$spam_nonce";
     604        $spam_url   = $base_url . "&amp;action=spam&$spam_nonce";
     605
     606        // Rollover actions
     607
     608        // Reply - javascript only; implemented by AJAX.
    482609        if ( 'spam' != $item_status )
    483             $actions['reply'] = sprintf( '<a href="%s">%s</a>', esc_attr( '#' ), __( 'Reply', 'buddypress' ) );
     610            $actions['reply'] = sprintf( '<a href="%s" class="reply hide-if-no-js">%s</a>', $base_url, __( 'Reply', 'buddypress' ) );
    484611
    485612        // Edit
    486         $actions['edit'] = sprintf( '<a href="%s">%s</a>', esc_attr( '#' ), __( 'Edit', 'buddypress' ) );
     613        $actions['edit'] = sprintf( '<a href="%s">%s</a>', $edit_url, __( 'Edit', 'buddypress' ) );
    487614
    488615        // Spam/unspam
    489616        if ( 'spam' == $item_status )
    490             $actions['unspam'] = sprintf( '<a href="%s">%s</a>', esc_attr( '#' ), __( 'Not Spam', 'buddypress' ) );
     617            $actions['unspam'] = sprintf( '<a href="%s">%s</a>', $ham_url, __( 'Not Spam', 'buddypress' ) );
    491618        else
    492             $actions['spam'] = sprintf( '<a href="%s">%s</a>', esc_attr( '#' ), __( 'Spam', 'buddypress' ) );
     619            $actions['spam'] = sprintf( '<a href="%s">%s</a>', $spam_url, __( 'Spam', 'buddypress' ) );
    493620
    494621        // Delete
    495         $actions['delete'] = sprintf( '<a href="%s">%s</a>', esc_attr( '#' ), __( 'Delete Permanently', 'buddypress' ) );
     622        $actions['delete'] = sprintf( '<a href="%s" onclick="%s">%s</a>', $delete_url, "javascript:return confirm('" . esc_js( __( 'Are you sure?', 'buddypress' ) ) . "'); ", __( 'Delete Permanently', 'buddypress' ) );
    496623
    497624        // Start timestamp
     
    507634        echo '</div>';
    508635
    509         // Get activity item content
    510         $content = apply_filters_ref_array( 'bp_get_activity_content_body', array( $item['content'] ) );
     636        // Get activity content - if not set, use the action
     637        if ( !empty( $item['content'] ) )
     638            $content = apply_filters_ref_array( 'bp_get_activity_content_body', array( $item['content'] ) );
     639        else
     640            $content = apply_filters_ref_array( 'bp_get_activity_action', array( $item['action'] ) );
    511641
    512642        echo $content . ' ' . $this->row_actions( $actions );
     
    521651     */
    522652    function column_response( $item ) {
    523         // Does this activity have a parent?
    524         if ( empty( $item['secondary_item_id'] ) )
     653        // Display link to user's profile
     654        echo bp_core_get_userlink( $item['user_id'] );
     655
     656        // Get activity permalink
     657        $activity_link = bp_activity_get_permalink( $item['id'], (object) $item );
     658
     659        // Get the root activity ID by parsing the permalink; this may be not be the same as $item['id'] for nested items (e.g. activity_comments)
     660        $root_activity_id = array();
     661        preg_match( '/\/p\/(\d+)\/*$/i', $activity_link, $root_activity_id );
     662        if ( empty( $root_activity_id[1] ) )
    525663            return;
    526664
    527         /* translators: 1: activity admin screen permalink, 2: activity ID */
    528         printf( __( '<a href="%1$s">Activity ID #%2$d</a>', 'buddypress' ), network_admin_url( 'admin.php?page=bp-activity&a=' . $item['secondary_item_id'] ), $item['secondary_item_id'] );
     665        $root_activity_id = (int) $root_activity_id[1];
     666
     667        // Is $item the root activity?
     668        if ( (int) $item['id'] == $root_activity_id ) {
     669            $root_activity = (object) $item;
     670
     671            // Get root activity comment count
     672            $comment_count = !empty( $root_activity->children ) ? bp_activity_recurse_comment_count( $root_activity ) : 0;
     673
     674            // Display a link to the root activity's permalink, with its comment count in a speech bubble
     675            printf( '<br /><a href="%1$s" title="%2$s" class="post-com-count"><span class="comment-count">%3$d</span></a>',  network_admin_url( 'admin.php?page=bp-activity&amp;aid=' . $root_activity_id ), esc_attr( sprintf( __( '%d related activities', 'buddypress' ), $comment_count ) ), $comment_count );
     676
     677        // $item is not the root activity (it is probably an activity_comment).
     678        } else {
     679            echo '<br />';
     680
     681            // @todo Get comment count from a specific node ($root_activity_id) in the tree, not $root_activity_id's root.
     682        }
     683
     684        // Link to the activity permalink
     685        printf( __( '<a href="%1$s">View Activity</a>', 'buddypress' ), bp_activity_get_permalink( $item['id'], (object) $item ) );
    529686    }
    530687}?>
  • trunk/bp-activity/bp-activity-akismet.php

    r5284 r5325  
    7676        if ( !$user_result || $user_result == $akismet_result ) {
    7777            // Show the original Akismet result if the user hasn't overridden it, or if their decision was the same
    78             if ( $akismet_result == 'true' && $activity['is_spam'] )
     78            if ( 'true' == $akismet_result && $activity['is_spam'] )
    7979                $desc = __( 'Flagged as spam by Akismet', 'buddypress' );
    8080
    81             elseif ( $akismet_result == 'false' && !$activity['is_spam'] )
     81            elseif ( 'false' == $akismet_result && !$activity['is_spam'] )
    8282                $desc = __( 'Cleared by Akismet', 'buddypress' );
    8383
     
    8585            $who = bp_activity_get_meta( $activity['id'], '_bp_akismet_user' );
    8686
    87             if ( $user_result == 'true' )
     87            if ( 'true' == $user_result )
    8888                $desc = sprintf( __( 'Flagged as spam by %s', 'buddypress' ), $who );
    8989            else
     
    9797                $b[ $k ] = $item;
    9898                if ( $k == 'edit' )
    99                     $b['history'] = '<a href="#"> '. __( 'History', 'buddypress' ) . '</a>';
     99                    $b['history'] = '<a href="' . network_admin_url( 'admin.php?page=bp-activity&amp;action=edit&aid=' . $activity['id'] ) . '#history"> '. __( 'History', 'buddypress' ) . '</a>';
    100100            }
    101101
     
    104104
    105105        if ( $desc )
    106             echo '<span class="akismet-status"><a href="#">' . htmlspecialchars( $desc ) . '</a></span>';
     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>';
    107107
    108108        return apply_filters( 'bp_akismet_comment_row_action', $actions );
     
    240240     *
    241241     * @param BP_Activity_Activity $activity
    242      * @param string $source Either "by_a_person" (e.g. a person has manually marked the activity as spam) or "by_akismet" (automatically spammed).
     242     * @param string $source Either "by_a_person" (e.g. a person has manually marked the activity as ham) or "by_akismet" (automatically hammed).
    243243     * @since 1.6
    244244     */
    245245    public function mark_as_ham( $activity, $source ) {
    246         //DJPAULTODO: Run bp_activity_at_name_filter() somehow... but not twice, if we can help it. Maybe check if it was auto-spammed by Akismet?
     246        // If the activity was, originally, automatically marked as spam by Akismet, run the @mentions filter as it would have been skipped.
     247        if ( 'true' == bp_activity_get_meta( $activity->id, '_bp_akismet_result' ) && !bp_activity_get_meta( $activity->id, '_bp_akismet_user_result' ) )
     248            $activity->content = bp_activity_at_name_filter( $activity->content, $activity->id );
    247249
    248250        do_action( 'bp_activity_akismet_mark_as_ham', $activity, $source );
     
    333335     * Update activity meta after a manual spam change (user initiated)
    334336     *
    335      * @global object $bp BuddyPress global settings
    336337     * @param BP_Activity_Activity $activity The activity to check
    337338     * @since 1.6
    338339     */
    339340    public function update_activity_spam_meta( $activity ) {
    340         global $bp;
    341 
    342341        // By default, only handle activity updates and activity comments.
    343342        if ( !in_array( $activity->type, BP_Akismet::get_activity_types() ) )
    344343            return;
    345344
    346         $this->update_activity_history( $activity->id, sprintf( __( '%s reported this activity as spam', 'buddypress' ), $bp->loggedin_user->fullname ), 'report-spam' );
     345        $this->update_activity_history( $activity->id, sprintf( __( '%s reported this activity as spam', 'buddypress' ), bp_get_loggedin_user_fullname() ), 'report-spam' );
    347346        bp_activity_update_meta( $activity->id, '_bp_akismet_user_result', 'true' );
    348         bp_activity_update_meta( $activity->id, '_bp_akismet_user', $bp->loggedin_user->fullname );
     347        bp_activity_update_meta( $activity->id, '_bp_akismet_user', bp_get_loggedin_user_fullname() );
    349348    }
    350349
     
    352351     * Update activity meta after a manual ham change (user initiated)
    353352     *
    354      * @global object $bp BuddyPress global settings
    355353     * @param BP_Activity_Activity $activity The activity to check
    356354     * @since 1.6
    357355     */
    358356    public function update_activity_ham_meta( $activity ) {
    359         global $bp;
    360 
    361357        // By default, only handle activity updates and activity comments.
    362358        if ( !in_array( $activity->type, BP_Akismet::get_activity_types() ) )
    363359            return;
    364360
    365         $this->update_activity_history( $activity->id, sprintf( __( '%s reported this activity as not spam', 'buddypress' ), $bp->loggedin_user->fullname ), 'report-ham' );
     361        $this->update_activity_history( $activity->id, sprintf( __( '%s reported this activity as not spam', 'buddypress' ), bp_get_loggedin_user_fullname() ), 'report-ham' );
    366362        bp_activity_update_meta( $activity->id, '_bp_akismet_user_result', 'false' );
    367         bp_activity_update_meta( $activity->id, '_bp_akismet_user', $bp->loggedin_user->fullname );
     363        bp_activity_update_meta( $activity->id, '_bp_akismet_user', bp_get_loggedin_user_fullname() );
    368364    }
    369365
     
    492488
    493489        // Unique User Agent
    494         $akismet_ua     = 'BuddyPress/' . constant( 'BP_VERSION' ) . ' | Akismet/'. constant( 'AKISMET_VERSION' );
     490        $akismet_ua     = 'BuddyPress/' . bp_get_version() . ' | Akismet/'. constant( 'AKISMET_VERSION' );
    495491
    496492        // Use specific IP (if provided)
  • trunk/bp-activity/bp-activity-functions.php

    r5307 r5325  
    13601360    // If Akismet is active, and this was a manual spam/ham request, stop Akismet checking the activity
    13611361    if ( 'by_a_person' == $source && !empty( $bp->activity->akismet ) ) {
    1362         remove_action( 'bp_activity_before_save', array( $bp->activity->akismet, 'check_activity' ), 1, 1 );
     1362        remove_action( 'bp_activity_before_save', array( $bp->activity->akismet, 'check_activity' ), 4, 1 );
    13631363
    13641364        // Build data package for Akismet
     
    13961396    // If Akismet is active, and this was a manual spam/ham request, stop Akismet checking the activity
    13971397    if ( 'by_a_person' == $source && !empty( $bp->activity->akismet ) ) {
    1398         remove_action( 'bp_activity_before_save', array( $bp->activity->akismet, 'check_activity' ), 1, 1 );
     1398        remove_action( 'bp_activity_before_save', array( $bp->activity->akismet, 'check_activity' ), 4, 1 );
    13991399
    14001400        // Build data package for Akismet
     
    14081408    }
    14091409
    1410     //DJPAULTODO: Run bp_activity_at_name_filter() somehow... but not twice, if we can help it. Maybe check if it was auto-spammed by Akismet?
    14111410    do_action( 'bp_activity_mark_as_ham', $activity, $source );
    14121411}
Note: See TracChangeset for help on using the changeset viewer.