Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • @poco06

    Participant

    Hello,
    Anybody has a clue for this?
    I can modify the core files if needed as this site will not evolve in the future.
    Thanks
    Pat

    @poco06

    Participant

    Hi Dan,
    Thanks for your quick return.
    I have checked the different links you indicated, but not found any answer to my specific question.
    The issue there is I need a radio field from the beggining in order the new members to have a unique possible choice on this field. That’s why I choose the radio field. Now, I need to make search on all potential options (I’m using the BP profile search plugin until now).
    Thanks again
    Pat

    @poco06

    Participant

    Hello shanebp,

    Thanks for your proposal. I tested it and it is fully working.
    Just one point : do I still have the ability to define which activity time to take into consideration by call the function. Until now, here’s the code I placed for that :

    if(is_user_online($userid, 30))
    with time in minuts (ie : 30 for this example)

    Regards
    Pat

    @poco06

    Participant

    Hello,

    Sorry for the delay in my answer, but in the meantime, I have found a solution if anyone is interested. The aim is to have a specific parameter showing the “state (online or offline)” of a user. Here is a function that can do the trick :

    function is_user_online($user_id, $time=5){
    	global $wp, $wpdb;
    	
    	$user_login = $wpdb->get_var( $wpdb->prepare( "
    		SELECT u.user_login FROM $wpdb->users u JOIN $wpdb->usermeta um ON um.user_id = u.ID 
    		WHERE 	u.ID = $user_id 
    		AND um.meta_key = 'last_activity'
    		AND DATE_ADD( um.meta_value, INTERVAL $time MINUTE ) >= UTC_TIMESTAMP()
    		" ,APP_POST_TYPE
    	));
    	
    	if(isset($user_login) && $user_login !=""){
    		return true;
    	}
    	else {return false;}
    }
Viewing 4 replies - 1 through 4 (of 4 total)
Skip to toolbar