Skip to:
Content

BuddyPress.org

Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#4347 closed enhancement (fixed)

Consider Adding Admin Option To Control How Long User is Considered Online

Reported by: frank13's profile frank13 Owned by: boonebgorges's profile 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)

#1 @frank13
13 years ago

  • Type changed from defect (bug) to enhancement
  • Version set to 1.5.6

#2 follow-up: @boonebgorges
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

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.

#3 @frank13
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 @boonebgorges
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 @frank13
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

Last edited 13 years ago by frank13 (previous) (diff)

#6 @boonebgorges
12 years ago

  • Keywords needs-patch added; 1.7-early removed
  • Milestone changed from Future Release to 1.7

#7 @johnjamesjacoby
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.

#8 @boonebgorges
12 years ago

  • Owner set to boonebgorges
  • Resolution set to fixed
  • Status changed from new to closed

In 7135:

Introduces bp_user_query_online_interval filter

This will allow site admins or plugins to adjust the number of minutes used as
an interval when querying for 'online' users using BP_User_Query.

Fixes #4347

#9 @boonebgorges
12 years ago

I'm going to introduce a filter for this purpose. No UI option for the moment. If it turns out that there's continued demand, let's handle it in a different release.

Note: See TracTickets for help on using tickets.