/**
* Output the "active [x days ago]" string for a user.
*
* @see bp_get_last_activity() for a description of parameters.
*
* @param int $user_id See {@link bp_get_last_activity()}.
*/
function bp_last_activity( $user_id = 0 ) {
/**
* Filters the 'active [x days ago]' string for a user.
*
* @since 1.0.0
*
* @param string $value Formatted 'active [x days ago]' string.
*/
echo apply_filters( 'bp_last_activity', bp_get_last_activity( $user_id ) );
}
/**
* Get the "active [x days ago]" string for a user.
*
* @param int $user_id ID of the user. Default: displayed user ID.
* @return string
*/
function bp_get_last_activity( $user_id = 0 ) {
if ( empty( $user_id ) )
$user_id = bp_displayed_user_id();
$last_activity = bp_core_get_last_activity( bp_get_user_last_activity( $user_id ), __('active %s', 'online') );
/**
* Filters the 'active [x days ago]' string for a user.
*
* @since 1.5.0
*
* @param string $value Formatted 'active [x days ago]' string.
*/
return apply_filters( 'bp_get_last_activity', $last_activity);
}
<span class="activity"><?php bp_last_activity( bp_displayed_user_id() ); ?></span>
<?php
/**
* We define an online user or not
*/
check_is_user_online function($user_id) {
if (bp_has_members("type=online&include=" . $user_id))
return true;
else
return false;
}
/**
*Add a style if the viewing user is online
*/
onwp_header_avatar function() {
$is_online = check_is_user_online(bp_displayed_user_id());
if (!empty($is_online)) {
echo '<style-->
#item-header-avatar {
border: 2px solid green;
}
';
}
}
add_action('wp_footer', 'onwp_header_avatar');
?>
.activity {
border: 2px solid green; // set the desired width (2px), type (solid, dotted, dashed etc) and colour (green)
}
Find more questions by tags WordPress