/** * @deprecated 1.6.0 */ function bp_core_is_user_deleted($user_id = 0) { _deprecated_function(__FUNCTION__, '1.6'); bp_is_user_deleted($user_id); }
/** * Check whether a user is "active", ie neither deleted nor spammer. * * @since 1.6.0 * * @param int $user_id The user ID to check. * @return bool True if active, otherwise false. */ function bp_is_user_active($user_id = 0) { // Default to current user. if (empty($user_id) && is_user_logged_in()) { $user_id = bp_loggedin_user_id(); } // No user to check. if (empty($user_id)) { return false; } // Check spam. if (bp_is_user_spammer($user_id)) { return false; } // Check deleted. if (bp_is_user_deleted($user_id)) { return false; } // Assume true if not spam or deleted. return true; }
function bp_checkins_post_update($args = '') { global $bp; $defaults = array('content' => false, 'user_id' => $bp->loggedin_user->id, 'type' => 'checkin', 'place_id' => false, 'place_name' => false, 'comment_id' => false, 'recorded_time' => bp_core_current_time()); $r = wp_parse_args($args, $defaults); extract($r, EXTR_SKIP); if ($type == "checkin" && (empty($content) || !strlen(trim($content)))) { return false; } if (bp_is_user_spammer($user_id) || bp_is_user_deleted($user_id)) { return false; } // Record this on the user's profile $from_user_link = bp_core_get_userlink($user_id); $component = 'checkins'; if ($type == 'checkin') { $activity_action = sprintf(__('%s added a checkin', 'bp-checkins'), $from_user_link); $activity_content = $content; $primary_link = bp_core_get_userlink($user_id, false, true); $checkin_type = 'activity_checkin'; $item_id = false; $secondary_item_id = false; } else { if ($type == 'new_place' && !empty($place_id)) { $component = 'places'; $place_permalink = '<a href="' . bp_get_checkins_places_the_permalink($place_id) . '" title="' . $place_name . '">' . $place_name . '</a>'; $activity_action = sprintf(__('%s added a new place %s', 'bp-checkins'), $from_user_link, $place_permalink); $primary_link = bp_core_get_userlink($user_id, false, true); $checkin_type = 'new_place'; $item_id = $place_id; $activity_content = $content; $secondary_item_id = false; } else { if ($type == 'place_checkin' && !empty($place_id)) { $place_permalink = '<a href="' . bp_get_checkins_places_the_permalink($place_id) . '" title="' . $place_name . '">' . $place_name . '</a>'; $activity_action = sprintf(__('%s checked-in %s', 'bp-checkins'), $from_user_link, $place_permalink); $primary_link = bp_core_get_userlink($user_id, false, true); $checkin_type = 'place_checkin'; $item_id = $place_id; $activity_content = false; $secondary_item_id = false; } else { if ($type == 'place_comment' && !empty($place_id) && !empty($comment_id)) { $component = 'places'; $place_permalink = '<a href="' . bp_get_checkins_places_the_permalink($place_id) . '" title="' . $place_name . '">' . $place_name . '</a>'; $activity_action = sprintf(__('%s added a comment on %s', 'bp-checkins'), $from_user_link, $place_permalink); $primary_link = bp_core_get_userlink($user_id, false, true); $checkin_type = 'place_comment'; $activity_content = $content; $item_id = $place_id; $secondary_item_id = $comment_id; } else { if ($type == 'place_checkin_comment' && !empty($place_id) && !empty($comment_id)) { $component = 'places'; $place_permalink = '<a href="' . bp_get_checkins_places_the_permalink($place_id) . '" title="' . $place_name . '">' . $place_name . '</a>'; $activity_action = sprintf(__('%s checked-in and added a comment on %s', 'bp-checkins'), $from_user_link, $place_permalink); $primary_link = bp_core_get_userlink($user_id, false, true); $checkin_type = 'place_comment'; $activity_content = $content; $item_id = $place_id; $secondary_item_id = $comment_id; } } } } } // Now write the values $activity_id = bp_activity_add(array('user_id' => $user_id, 'action' => apply_filters('bp_activity_new_update_action', $activity_action), 'content' => apply_filters('bp_activity_new_update_content', $activity_content), 'primary_link' => apply_filters('bp_activity_new_update_primary_link', $primary_link), 'component' => $component, 'type' => $checkin_type, 'item_id' => $item_id, 'secondary_item_id' => $secondary_item_id, 'recorded_time' => $recorded_time)); if ($type == 'checkin') { bp_update_user_meta($bp->loggedin_user->id, 'bp_latest_update', array('id' => $activity_id, 'content' => wp_filter_kses($content))); } if ($checkin_type == 'place_comment') { update_comment_meta($comment_id, 'group_place_activity_id', $activity_id); } do_action('bp_activity_posted_checkin', $content, $user_id, $activity_id); return $activity_id; }