Go Back   Pligg CMS Forum > Pligg Development > Modification Tutorials

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-27-2008, 02:54 PM
New Pligger
Pligg Version: 9.9.5
Pligg Template: Custom
 
Join Date: Oct 2007
Posts: 5
Thanks: 0
Thanked 4 Times in 1 Post
Thumbs up Show Recent Visitors Avatar On SideBar

This one is a slight modification of this one [SOLVED] Top 5 users in sidebar

Basically, I didn't like to show Top 5 all the time. (Heck they could be dominating the top 5 forever). So instead I chose to have recent visitor. Here's how you do.

Create a new file: create a new file: /templates/templatename/sidebar_modules/sidebar_topuser.tpl

Code:
<div class="tlb">
<a href="topusers.php"><h2>Currently Online</h2></a></div>
<div>
	<ul style="list-style:none;">
		{php}
			global $db;
			$sql="SELECT user_login from " . table_users . " order by user_lastlogin desc limit 0,25";
			$result = @mysql_query ($sql);
			$rowCount = 0;
			while($row = mysql_fetch_array($result, MYSQL_ASSOC))
			{
				$uname=$row['user_login'];
				if (($rowCount++)%2 == 0)
					echo "<a href='" . getmyurl('user2', $uname, 'profile') . "'><img src='". get_avatar('large', "", "$uname","","")."' style='padding:0px 0px 3px 3px'></a>";
				else
					echo "<a href='" . getmyurl('user2', $uname, 'profile') . "'><img src='". get_avatar('large', "", "$uname","","")."' class='align-middle' style='padding:0px 0px 3px 3px'></a>";
			}
		{/php}
	</ul>
</div>
now edit templates\templatename/sidebar.tpl to include this line where ever you want the top users to get displayed:
{assign var=sidebar_module value="sidebar_topuser"}{include file=$the_template_sidebar_modules."/wrapper.tpl"}

You can have a look at Negaraku! for this mod (live).

I'm still unsure of how to make it look nicer or at least use proper CSS.

Code:
$sql="SELECT user_login from " . table_users . " order by user_lastlogin desc limit 0,25";
<< change 0,25 to any number you wish to show.

Don't ask me mysql or php question, I have very minimal knowledge on that area
Reply With Quote
The Following 4 Users Say Thank You to edmx For This Useful Post:
  #2 (permalink)  
Old 08-27-2008, 03:14 PM
flukenakrab's Avatar
New Pligger
Pligg Version: 9.9
 
Join Date: Jul 2008
Location: Chiangmai, TH
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks ,I will try to night.
__________________
Please visit my first Pligg site at www.vkizz.com
Reply With Quote
  #3 (permalink)  
Old 09-04-2008, 01:49 PM
New Pligger
Pligg Version: 9.8
Pligg Template: template
 
Join Date: Jan 2008
Posts: 11
Thanks: 3
Thanked 0 Times in 0 Posts
so cool, thanks 4share
--------------------------------------
Please visit my first Pligg site at sig.vn
Reply With Quote
Reply

Thread Tools
Display Modes
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Similar Threads
Thread Thread Starter Forum Replies Last Post
How do online user on sidebar with small avatar ? flukenakrab General Help 0 08-12-2008 08:55 PM
hos to show recent news in home page basabi11 General Help 0 11-13-2007 11:26 PM
Avatars of most recent visitors in sidebar HealthGurl General Help 3 08-10-2007 11:55 AM
Show Top Stories by Category in Sidebar - A How To TrailofDead Modification Tutorials 0 04-23-2007 09:30 PM
Listing recent submissions' headlines on sidebar? clipsuey General Help 1 04-03-2006 08:55 AM


Search Engine Friendly URLs by vBSEO 3.2.0