Skip to:
Content

BuddyPress.org


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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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)
Note: See TracChangeset for help on using the changeset viewer.