bp_dtheme_spam_activity()
AJAX spam an activity item or comment
Return Return
(mixed) String on error, void on success
Source Source
File: bp-themes/bp-default/_inc/ajax.php
function bp_dtheme_spam_activity() { global $bp; // Bail if not a POST action if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) return; // Check that user is logged in, Activity Streams are enabled, and Akismet is present. if ( ! is_user_logged_in() || ! bp_is_active( 'activity' ) || empty( $bp->activity->akismet ) ) exit( '-1' ); // Check an item ID was passed if ( empty( $_POST['id'] ) || ! is_numeric( $_POST['id'] ) ) exit( '-1' ); // Is the current user allowed to spam items? if ( ! bp_activity_user_can_mark_spam() ) exit( '-1' ); // Load up the activity item $activity = new BP_Activity_Activity( (int) $_POST['id'] ); if ( empty( $activity->component ) ) exit( '-1' ); // Check nonce check_admin_referer( 'bp_activity_akismet_spam_' . $activity->id ); // Call an action before the spamming so plugins can modify things if they want to do_action( 'bp_activity_before_action_spam_activity', $activity->id, $activity ); // Mark as spam bp_activity_mark_as_spam( $activity ); $activity->save(); do_action( 'bp_activity_action_spam_activity', $activity->id, $activity->user_id ); exit; }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
BuddyPress (1.6) | Introduced. |