<?xml version="1.0"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>bbPress Showcase Tag: members online</title>
<link>http://bbshowcase.org/forums/</link>
<description>bbPress Showcase Tag: members online</description>
<language>en</language>
<pubDate>Thu, 24 May 2012 15:57:29 +0000</pubDate>

<item>
<title>guly on "Members Online - Hide User Online Status"</title>
<link>http://bbshowcase.org/forums/topic/members-online-hide-user-online-status#post-2169</link>
<pubDate>Sat, 23 Oct 2010 11:33:54 +0000</pubDate>
<dc:creator>guly</dc:creator>
<guid isPermaLink="false">2169@http://bbshowcase.org/forums/</guid>
<description>&#60;p&#62;I don't have your plugin development skills, unfortunately, though I did hack something up that seems to work OK:&#60;/p&#62;
&#60;p&#62;1. Two extra huge queries sounded expensive. So I added a field to bb_users called user_hide. This is probably *heresy* to modify the bb_users table instead of adding to bb_usermeta, but adding to the user table is standard procedure in other forum scripts (such as phpbb) and I assume it's cheaper than querying the database 2-3 times?&#60;/p&#62;
&#60;p&#62;2. in functions.bb-core.php, update function bb_get_profile_info_keys to include a profile key tied to user hide:&#60;br /&#62;
		'user_hide' =&#38;gt; array(0, __('Hide online status'), 'checkbox', '1', '0'), &#60;/p&#62;
&#60;p&#62;3. in profile-edit.php, under:&#60;br /&#62;
&#60;code&#62;foreach( $profile_info_keys as $key =&#38;gt; $label ) {&#60;/code&#62;&#60;br /&#62;
add:&#60;br /&#62;
&#60;code&#62;&#60;br /&#62;
				if ($key == 'user_hide') {&#60;br /&#62;
					global $bbdb; //unsure if I need to declare this?&#60;br /&#62;
					$passkey = $$key; //workaround. I don't know how to pass a variable-variable ($$) through MYSQL&#60;br /&#62;
					$bbdb-&#38;gt;query( &#34;UPDATE $bbdb-&#38;gt;users SET user_hide = '$passkey' WHERE ID = '$user-&#38;gt;ID'&#34; );&#60;/p&#62;
&#60;p&#62;&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;4. Updated the query in members_online.php plugin to retrieve the user_hide value:&#60;br /&#62;
&#60;code&#62;	$results=$bbdb-&#38;gt;get_results(&#34;SELECT ID,user_login,user_hide FROM $bbdb-&#38;gt;users LEFT JOIN $bbdb-&#38;gt;usermeta ON ID=user_id WHERE meta_key='last_online' AND cast(meta_value AS unsigned)&#38;gt;'$time' ORDER BY meta_value DESC&#34;);&#60;br /&#62;
&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;5. Added conditional handling of each displayed name. Instead of just:&#60;br /&#62;
&#60;code&#62;				$output.=&#34; &#60;a rel='nofollow' href='&#34;.attribute_escape($uri.$stub).&#34;'&#62;$value&#60;/a&#62;, &#34;;&#60;br /&#62;
&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;Do this instead:&#60;br /&#62;
&#60;code&#62;&#60;br /&#62;
				//if user_hide is false, then handle it normally.&#60;br /&#62;
				if ($result-&#38;gt;user_hide == 0) {&#60;br /&#62;
				$output.=&#34; &#60;a rel='nofollow' href='&#34;.attribute_escape($uri.$stub).&#34;'&#62;$value&#60;/a&#62;, &#34;;&#60;br /&#62;
				} else {&#60;br /&#62;
				//if user_hide is not false, then only display for Mods/admins, and give it (hidden) formatting.&#60;br /&#62;
					if (($bb_current_user-&#38;gt;capabilities[moderator] = true) &#124;&#124; ($bb_current_user-&#38;gt;capabilities[administrator] = true)) {&#60;br /&#62;
					$output.=&#34; &#60;i&#62;&#60;a rel='nofollow' href='&#34;.attribute_escape($uri.$stub).&#34;'&#62;($value)&#60;/a&#62;&#60;/i&#62;, &#34;;&#60;br /&#62;
					}&#60;br /&#62;
&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;7. Setup a cron job on my server to run every 4 min. tried wp-cron but too darn complicated... couldn't figure it out.&#60;/p&#62;
&#60;p&#62;_ck_ do you think running the cron job every 4 min will pickup all users? Could I set it to run less frequently?
&#60;/p&#62;</description>
</item>
<item>
<title>_ck_ on "Members Online - Hide User Online Status"</title>
<link>http://bbshowcase.org/forums/topic/members-online-hide-user-online-status#post-2168</link>
<pubDate>Fri, 22 Oct 2010 13:37:59 +0000</pubDate>
<dc:creator>_ck_</dc:creator>
<guid isPermaLink="false">2168@http://bbshowcase.org/forums/</guid>
<description>&#60;p&#62;Actually, you'll have to pull the user_ids and then do a &#60;code&#62;bb_cache_users&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;It will add 2 extra (big) queries for that &#34;feature&#34;.&#60;/p&#62;
&#60;p&#62;The real solution might be to completely rewrite the plugin so it simply builds the resulting string to display every few minutes, instead of doing the queries on each and every page load. Then when it builds the string to display it can check all the options without all the overhead on each page load.&#60;/p&#62;
&#60;p&#62;It will also become significantly faster for busy sites.&#60;/p&#62;
&#60;p&#62;Store the string in the regular bb_options.&#60;/p&#62;
&#60;p&#62;This is about all the help I can give you for now, I am on a bbpress &#34;break&#34; for the rest of the year. Good luck!
&#60;/p&#62;</description>
</item>
<item>
<title>guly on "Members Online - Hide User Online Status"</title>
<link>http://bbshowcase.org/forums/topic/members-online-hide-user-online-status#post-2167</link>
<pubDate>Fri, 22 Oct 2010 13:28:12 +0000</pubDate>
<dc:creator>guly</dc:creator>
<guid isPermaLink="false">2167@http://bbshowcase.org/forums/</guid>
<description>&#60;p&#62;Actually I think it's just fetching ID and user_login. Here is the query:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;$results=$bbdb-&#38;gt;get_results(&#34;SELECT ID,user_login FROM $bbdb-&#38;gt;users LEFT JOIN $bbdb-&#38;gt;usermeta ON ID=user_id WHERE meta_key='last_online' AND cast(meta_value AS unsigned)&#38;gt;'$time' ORDER BY meta_value DESC&#34;);&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;If I run a var_dump, here are the variables it's pulling up:&#60;br /&#62;
&#60;code&#62;now : array(1) {&#60;br /&#62;
[0]=&#38;gt; object(stdClass)#103 (2) { [&#34;ID&#34;]=&#38;gt; string(1) &#34;1&#34; [&#34;user_login&#34;]=&#38;gt; string(5) &#34;admin&#34; }&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;today : array(4) {&#60;br /&#62;
[0]=&#38;gt; object(stdClass)#103 (2) {&#60;br /&#62;
[&#34;ID&#34;]=&#38;gt; string(1) &#34;1&#34; [&#34;user_login&#34;]=&#38;gt; string(5) &#34;admin&#34; }&#60;br /&#62;
[1]=&#38;gt; object(stdClass)#100 (2) { [&#34;ID&#34;]=&#38;gt; string(5) &#34;44700&#34; [&#34;user_login&#34;]=&#38;gt; string(5) &#34;user2&#34; }&#60;br /&#62;
[2]=&#38;gt; object(stdClass)#99 (2) { [&#34;ID&#34;]=&#38;gt; string(5) &#34;44561&#34; [&#34;user_login&#34;]=&#38;gt; string(5) &#34;user3&#34; }&#60;br /&#62;
[3]=&#38;gt; object(stdClass)#101 (2) { [&#34;ID&#34;]=&#38;gt; string(5) &#34;55563&#34; [&#34;user_login&#34;]=&#38;gt; string(5) &#34;user5&#34; } } &#60;/code&#62;
&#60;/p&#62;</description>
</item>
<item>
<title>_ck_ on "Members Online - Hide User Online Status"</title>
<link>http://bbshowcase.org/forums/topic/members-online-hide-user-online-status#post-2166</link>
<pubDate>Fri, 22 Oct 2010 12:35:16 +0000</pubDate>
<dc:creator>_ck_</dc:creator>
<guid isPermaLink="false">2166@http://bbshowcase.org/forums/</guid>
<description>&#60;p&#62;I can't remember but it probably already fetches/catches all the users data in one query anyway. If not, it could be converted. So adding additional usermeta doesn't add queries.
&#60;/p&#62;</description>
</item>
<item>
<title>guly on "Members Online - Hide User Online Status"</title>
<link>http://bbshowcase.org/forums/topic/members-online-hide-user-online-status#post-2165</link>
<pubDate>Fri, 22 Oct 2010 11:50:10 +0000</pubDate>
<dc:creator>guly</dc:creator>
<guid isPermaLink="false">2165@http://bbshowcase.org/forums/</guid>
<description>&#60;p&#62;Hi _ck_&#60;/p&#62;
&#60;p&#62;I am going to tweak your Members Online code to give users the opportunity to hide their status, if they choose (though mods and admins would still get to see their status). I was wondering what approach you think is best:&#60;/p&#62;
&#60;p&#62;1. Create a new bb_usermeta value 'dont_show_online' for each user who opts out. When function members_online_now() runs, it checks whether dont_show_online exists each online user. Then you could do all sorts of things like SKIP showing the user to normal users, show their name in italics to mods/admins, etc. The main disadvantage I see is you have to do an extra mysql query each time members_online_now() runs, and my understanding is that too many queries = bad.&#60;/p&#62;
&#60;p&#62;2. store the bb_usermeta value 'last_online' as a compound variable, using implode()/explode(), so the stored 'last_online' value in mysql table is &#34;1287724455,1&#34; (1287724455=time,1=flag for 'don't display my online status').&#60;/p&#62;
&#60;p&#62;3. Other approach.&#60;/p&#62;
&#60;p&#62;Thanks!
&#60;/p&#62;</description>
</item>
<item>
<title>massbase on "Members Online, - Editing the output"</title>
<link>http://bbshowcase.org/forums/topic/members-online-editing-the-output#post-1384</link>
<pubDate>Wed, 17 Jun 2009 12:31:46 +0000</pubDate>
<dc:creator>massbase</dc:creator>
<guid isPermaLink="false">1384@http://bbshowcase.org/forums/</guid>
<description>&#60;p&#62;I got the link working, correctly for the permalink.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function members_online_now($time=0) {
global $bbdb, $members_online;  $members_online[&#38;#39;footer&#38;#39;]=false;
if (empty($time)) {$time=time()-$members_online[&#38;#39;timeout&#38;#39;];}
	$members=$bbdb-&#38;gt;get_results(&#38;quot;SELECT ID,user_login FROM $bbdb-&#38;gt;users LEFT JOIN $bbdb-&#38;gt;usermeta ON ID=user_id WHERE meta_key=&#38;#39;last_online&#38;#39; AND cast(meta_value AS unsigned)&#38;gt;&#38;#39;$time&#38;#39; ORDER BY meta_value DESC&#38;quot;);
	if (!empty($members)) {
		$profile=bb_get_option(&#38;#39;uri&#38;#39;).&#38;quot;profile/&#38;quot;; $output=&#38;quot;&#38;quot;;
		foreach ($members as $member) {$output.=&#38;quot;&#38;lt;a rel=&#38;#39;nofollow&#38;#39; href=&#38;#39;$profile$member-&#38;gt;user_login&#38;#39;&#38;gt;$member-&#38;gt;user_login&#38;lt;/a&#38;gt;, &#38;quot;;}
		echo rtrim($output,&#38;quot;, &#38;quot;);
	}
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;but i was wondering if you could do this but using the gravatar instead of text.
&#60;/p&#62;</description>
</item>
<item>
<title>massbase on "Members Online, - Editing the output"</title>
<link>http://bbshowcase.org/forums/topic/members-online-editing-the-output#post-1383</link>
<pubDate>Wed, 17 Jun 2009 11:59:57 +0000</pubDate>
<dc:creator>massbase</dc:creator>
<guid isPermaLink="false">1383@http://bbshowcase.org/forums/</guid>
<description>&#60;p&#62;hey ck,&#60;/p&#62;
&#60;p&#62;i need to edit the text that outputs the &#34;online users today&#34;... reason being is that i have permalinks on, so the links to the profile doesnt work, becuase it uses id, rather than name, i dont know what bit to edit from the code.&#60;/p&#62;
&#60;p&#62;my plan is too get the gravatar of the user show up instead of text, that links to &#60;a href=&#34;http://www.sitename.com/profile/username&#34; rel=&#34;nofollow&#34;&#62;http://www.sitename.com/profile/username&#60;/a&#62; (not id)&#60;/p&#62;
&#60;p&#62;thanks.
&#60;/p&#62;</description>
</item>

</channel>
</rss>

