#4347 closed enhancement (fixed)
Consider Adding Admin Option To Control How Long User is Considered Online
Reported by: | frank13 | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 1.8 | Priority: | normal |
Severity: | trivial | Version: | 1.5.6 |
Component: | Members | Keywords: | needs-patch |
Cc: |
Description
I made a hard coded change to/wp-content/plugins/buddypress/bp-core/bp-core-classes.php on line 246
Out-of-box:
$sql['where_online'] = "AND DATE_ADD( um.meta_value, INTERVAL 5 MINUTE ) >= UTC_TIMESTAMP()";
My Override:
$sql['where_online'] = "AND DATE_ADD( um.meta_value, INTERVAL 15 MINUTE ) >= UTC_TIMESTAMP()"; // 2012-05-15 increased value to 15 minutes
Thank you for considering.
Change History (9)
#2
follow-up:
↓ 5
@
13 years ago
- Component changed from Core to Members
- Keywords 1.7-early added
- Milestone changed from Awaiting Review to Future Release
- Severity changed from normal to trivial
#3
@
13 years ago
Ok thanks @boonebgorges. I'll try to assemble a filter for it.
You don't think my hard coded override has anything to do with my "active sometime ago" issue do you?
#4
@
13 years ago
You don't think my hard coded override has anything to do with my "active sometime ago" issue do you?
I doubt it, but you should absolutely test on a totally clean, stock installation of BP.
#5
in reply to:
↑ 2
@
13 years ago
Replying to boonebgorges:
You may want to consider doing this with a filter on bp_core_get_paged_users_sql and bp_core_get_total_users_sql instead of modifying the core file.
I can't seem to figure out how to override it short of my hard coded hack @boonebgorges
This is what I added to my functions.php in my theme:
`function my_bp_core_get_users_sql() {
if ( 'online' == $type )
$sqlwhere_online? = "AND DATE_ADD( um.meta_value, INTERVAL 15 MINUTE ) >= UTC_TIMESTAMP()"; 2012-05-15 increased value to 15 minutes
}
add_filter( 'bp_core_get_paged_users_sql', 'my_bp_core_get_users_sql' );
add_filter( 'bp_core_get_total_users_sql', 'my_bp_core_get_users_sql' );
`
But I got "Sorry, no members were found." in my BuddyPress site
#6
@
12 years ago
- Keywords needs-patch added; 1.7-early removed
- Milestone changed from Future Release to 1.7
#7
@
12 years ago
- Milestone changed from 1.7 to 1.8
A setting for this makes sense, but not in 1.7. Moving to 1.8.
You may want to consider doing this with a filter on bp_core_get_paged_users_sql and bp_core_get_total_users_sql instead of modifying the core file.
I don't think it makes sense to have an admin option for this particular value (too few people really care about it), but I do think it's worth having a filter, so you don't have to resort to hacks.