collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 765
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Thanks for having an interest with our portal. If you have any requests for features, have a look at the Feature Requests board.

Author Topic: Featured Member Block  (Read 22240 times)

0 Members and 1 Guest are viewing this topic.

Offline cafenubia

  • Newbie
  • Posts: 4
Featured Member Block
« on: October 13, 2008, 10:46:02 AM »
Is there a way to create a featured member block that shows a random member and the brief info about them in a block.

I would use the info that appears under their name in their post .

Example on my site the poster has this info when they post

Name
Administrator
Newbie
*****
Karma:
Online Online
Gender:
Last Login:
Date Registerd:
Age:
Location:
Posts:

If this block could show members random or by selection this would be coool. :thumbsup:

Is this already done?

Offline Nathaniel

  • Comrade
  • *
  • Posts: 5203
  • Gender: Male
    • Verbtest.com
  • SMF Version: 2 RC4
  • SP Version: 2.3.3
Re: Featured Member Block
« Reply #1 on: October 13, 2008, 04:32:00 PM »
No, I don't believe that anyone has already made a block like that. Although it doesn't sound very hard to do. Hopefully somebody will have tme to do it. ;)
SMF Friend (Former Support Specialist) | SimplePortal DeveloperMy SMF Mods | SimplePortal"Quis custodiet ipsos custodes?" - Who will Guard the Guards?Please don't send me ANY support related PMs. I will just delete them.

Offline cafenubia

  • Newbie
  • Posts: 4
Re: Featured Member Block
« Reply #2 on: October 14, 2008, 04:41:56 PM »
No, I don't believe that anyone has already made a block like that. Although it doesn't sound very hard to do. Hopefully somebody will have tme to do it. ;)

Yes That Would Be A Nice Addition

Offline bmac

  • Semi Newbie
  • *
  • Posts: 27
    • Steelhead Notebook
Re: Featured Member Block
« Reply #3 on: November 16, 2008, 02:23:42 PM »
I also would like to see a block for this. It would be nice to limit the members featured in this block to ones with at least "x" number of posts.

Offline 3ri

  • Newbie
  • Posts: 3
Re: Featured Member Block
« Reply #4 on: November 18, 2008, 12:38:03 AM »
That would be interesting.... I like the idea of the featured member block.

Offline ???1031

  • ... feel not as a dev at the moment ...
  • Comrade
  • *
  • Posts: 789
  • Gender: Male
  • Overworked <<
  • SMF Version: None
  • SP Version: None
Re: Featured Member Block
« Reply #5 on: November 18, 2008, 01:45:48 AM »
I've a idea for this, but i need to think about it :). (And the time i've is not so much at the moment) :)
Again... I'm having time problems...Normal Monday to Friday I'm at office from 6:00-16:00 (On my local time ;P).

Offline hot rides

  • Semi Newbie
  • *
  • Posts: 42
    • Hot Rides Show & Cruise
Re: Featured Member Block
« Reply #6 on: December 05, 2008, 11:50:52 AM »
in for updates

Offline ???1031

  • ... feel not as a dev at the moment ...
  • Comrade
  • *
  • Posts: 789
  • Gender: Male
  • Overworked <<
  • SMF Version: None
  • SP Version: None
Re: Featured Member Block
« Reply #7 on: December 10, 2008, 05:03:49 AM »
No, i currently work on the block system. So i think i can create something special for this, but thats something for later. :whistle:.
Again... I'm having time problems...Normal Monday to Friday I'm at office from 6:00-16:00 (On my local time ;P).

Offline bmac

  • Semi Newbie
  • *
  • Posts: 27
    • Steelhead Notebook
Re: Featured Member Block
« Reply #8 on: January 02, 2009, 12:20:18 PM »
I am very interested in this block. I know everyone is extremely busy, but am hoping someone can get to this one soon. Thanks in advance for any help that anyone can offer.

Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: Featured Member Block
« Reply #9 on: January 04, 2009, 06:04:22 AM »
Hi ,
This is a Block which display Member information Randomly
the Infos to display are :

Name
groupe(for example :Administrator ,Moderator ,etc.)
Post-Group(for example: newbie)
***** (stars)
Online State (as image)
Gender (if givin)
Last Active
Date Registered
Date of Birth (if givin)
Location (if givin)
Posts

here is the php Code:
Code: [Select]
<?php
global $settings;

/////////// FINDING HOW MANY Members in the Forum //////////////////
$query mysql_query("SELECT * FROM smf_members"); 
$numberOfMembers=mysql_num_rows($query); 



/////////// SELECT A MEMBER ////////////

$randomMember=rand(1,$numberOfMembers); 
$ask=mysql_query("SELECT * FROM smf_members order by rand() limit 1");
$row mysql_fetch_array($askMYSQL_ASSOC) or die (mysql_error());
$idmember1=$row[ID_MEMBER]; // Member ID
$memberName1=$row[memberName]; // Member Name
$group1=$row[ID_GROUP]; // Member Group ID

$postgroup1=$row[ID_POST_GROUP]; // Post Group
$gender1=$row[gender];
$lastlogin1=$row[lastLogin]; 
if (
$lastlogin1!=0){ $datelog1=date("d.M.Y H:i",$lastlogin1); } 
else {
$datelog1=''
};
$dateReg1=$row[dateRegistered]; $dateform =date("d.M.Y H:i",$dateReg1);
$birthdate1=$row[birthdate]; if ($birthdate1=='0001-01-01'){$birthdate1=''; };
$location1=$row[location];
$post1=$row[posts]; // How Many Posts

if ($group1!='0'){
$ask=mysql_query("SELECT groupName, stars FROM smf_membergroups WHERE ID_GROUP='$group1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$groupName1=$row[groupName]; // Group Name
$star1=$row[stars]; // How many Stars
};

$ask=mysql_query("SELECT groupName, stars FROM smf_membergroups WHERE ID_GROUP='$postgroup1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$postgroup2=$row[groupName];
if (
$star1==''){$star1=$row[stars]; };

// is the Member Online //////////////
$query mysql_query("SELECT * FROM smf_log_online"); 
$numberOfRows=mysql_num_rows($query); 
$imagepath1=$settings['images_url'];
if (
$numberOfRows>0){
$ask=mysql_query("SELECT ip FROM smf_log_online WHERE ID_MEMBER='$idmember1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$conline1=$row[ip]; 
};
/////////// how many Stars ////////////////////
$imagepath1=$settings['images_url'];
list(
$ngif,$gifn)=explode("#",$star1);
//////////////////////////////////////////////

///////////// displaying the infos //////////////// 
echo "<div align='center'>";
echo 
$memberName1."<br>";
if (
$groupName1!='') { echo $groupName1."<br>"; };
echo 
$postgroup2."<br>";
echo 
"<div style='margin:5px'>";
for (
$i=0$i<$ngif$i+=1){
echo 
"<img src='$imagepath1/$gifn' border='0'>";
};
echo 
"</div>";
if (
$conline1!=''){
echo 
"<img src='$imagepath1/useron.gif' border='0' style='margin:5px'><br>"; } else {
echo 
"<img src='$imagepath1/useroff.gif' border='0' style='margin:5px'><br>";
}


if (
$gender!=''){ echo 'Gender: '.$gender1."<br>"; };
if (
$datelog1==''){ $datelog1='Never'; };
echo 
'Last Active: '.$datelog1."<br>"
echo 
'Date Registered: '.$dateform."<br>";
if (
$birthdate1!='') { echo 'Date of Birth: '.$birthdate1."<br>"; };
if (
$location1!='') { echo 'Location: '.$location1."<br>"; };
echo 
'Posts: '.$post1."<br>";
echo 
"</div>";


?>

« Last Edit: January 04, 2009, 06:10:35 AM by Nabil »

Offline dougsbrat

  • Jr. Member
  • **
  • Posts: 55
  • Pull my finger!
Re: Featured Member Block
« Reply #10 on: January 04, 2009, 09:25:12 AM »
Nabil that code worked GREAT!  ;D
I now have it displayed on my site.

if it started with their avatar it would be perfect

Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: Featured Member Block
« Reply #11 on: January 04, 2009, 10:26:58 AM »
Updated , With Avatars in the Attachments Folder
Code: [Select]
<?php
global $settings;

/////////// FINDING HOW MANY Members in the Forum //////////////////
$query mysql_query("SELECT * FROM smf_members"); 
$numberOfMembers=mysql_num_rows($query); 



/////////// SELECT A MEMBER ////////////

$randomMember=rand(1,$numberOfMembers); 
$ask=mysql_query("SELECT * FROM smf_members order by rand() limit 1");
$row mysql_fetch_array($askMYSQL_ASSOC) or die (mysql_error());
$idmember1=$row[ID_MEMBER]; // Member ID
$memberName1=$row[memberName]; // Member Name
$group1=$row[ID_GROUP]; // Member Group ID

$postgroup1=$row[ID_POST_GROUP]; // Post Group
$gender1=$row[gender];
$lastlogin1=$row[lastLogin]; 
if (
$lastlogin1!=0){ $datelog1=date("d.M.Y H:i",$lastlogin1); } 
else {
$datelog1=''
};
$dateReg1=$row[dateRegistered]; $dateform =date("d.M.Y H:i",$dateReg1);
$birthdate1=$row[birthdate]; if ($birthdate1=='0001-01-01'){$birthdate1=''; };
$location1=$row[location];
$post1=$row[posts]; // How Many Posts

if ($group1!='0'){
$ask=mysql_query("SELECT groupName, stars FROM smf_membergroups WHERE ID_GROUP='$group1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$groupName1=$row[groupName]; // Group Name
$star1=$row[stars]; // How many Stars
};

$ask=mysql_query("SELECT groupName, stars FROM smf_membergroups WHERE ID_GROUP='$postgroup1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$postgroup2=$row[groupName];
if (
$star1==''){$star1=$row[stars]; };

// is the Member Online //////////////
$query mysql_query("SELECT * FROM smf_log_online"); 
$numberOfRows=mysql_num_rows($query); 
$imagepath1=$settings['images_url'];
if (
$numberOfRows>0){
$ask=mysql_query("SELECT ip FROM smf_log_online WHERE ID_MEMBER='$idmember1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$conline1=$row[ip]; 
};
/////////// how many Stars ////////////////////
$imagepath1=$settings['images_url'];
list(
$ngif,$gifn)=explode("#",$star1);
//////////////////////////////////////////////

///////////// Get The Avatar /////////////
$ask=mysql_query("SELECT filename, ID_ATTACH FROM smf_attachments WHERE ID_MEMBER='$idmember1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$avatar1=$row[filename]; $idattach1=$row[ID_ATTACH]; 
///////////// displaying the infos //////////////// 
echo "<div align='center'>";
echo 
$memberName1."<br>";
if (
$groupName1!='') { echo $groupName1."<br>"; };
echo 
$postgroup2."<br>";
echo 
"<div style='margin:5px'>";
for (
$i=0$i<$ngif$i+=1){
echo 
"<img src='$imagepath1/$gifn' border='0'>";
};
echo 
"</div>";
if (
$conline1!=''){
echo 
"<img src='$imagepath1/useron.gif' border='0' style='margin:5px'><br>"; } else {
echo 
"<img src='$imagepath1/useroff.gif' border='0' style='margin:5px'><br>";
}


if (
$gender!=''){ echo 'Gender: '.$gender1."<br>"; };
if (
$datelog1==''){ $datelog1='Never'; };
echo 
'Last Active: '.$datelog1."<br>"
echo 
'Date Registered: '.$dateform."<br>";
if (
$birthdate1!='') { echo 'Date of Birth: '.$birthdate1."<br>"; };
if (
$location1!='') { echo 'Location: '.$location1."<br>"; };
echo 
'Posts: '.$post1."<br>";
if (
$avatar1!=''){
echo 
"<img src='index.php?action=dlattach;attach=$idattach1;type=avatar' border='0' style='margin:5px'><br>";
};
echo 
"</div>";


?>


Offline dougsbrat

  • Jr. Member
  • **
  • Posts: 55
  • Pull my finger!
Re: Featured Member Block
« Reply #12 on: January 04, 2009, 10:40:52 AM »
thanks for the quick code work  ;D

I put this one on my test forum.. (4 users)
the avatar only shows up on 2 of the 4,
the other 2 shows as if the latest code was not used.
strange?

I think it shows if the avatar was uploaded vs picked from the forum.

which after re-reading I see that you did say that  ;)
« Last Edit: January 04, 2009, 10:43:46 AM by dougsbrat »

Offline dougsbrat

  • Jr. Member
  • **
  • Posts: 55
  • Pull my finger!
Re: Featured Member Block
« Reply #13 on: January 04, 2009, 10:56:57 AM »
I also prefer the Avatar at the top not the bottom,
you code is easy read and I did it.  ;D

Code: [Select]
<?php
global $settings;

/////////// FINDING HOW MANY Members in the Forum //////////////////
$query mysql_query("SELECT * FROM smf_members"); 
$numberOfMembers=mysql_num_rows($query); 



/////////// SELECT A MEMBER ////////////

$randomMember=rand(1,$numberOfMembers); 
$ask=mysql_query("SELECT * FROM smf_members order by rand() limit 1");
$row mysql_fetch_array($askMYSQL_ASSOC) or die (mysql_error());
$idmember1=$row[ID_MEMBER]; // Member ID
$memberName1=$row[memberName]; // Member Name
$group1=$row[ID_GROUP]; // Member Group ID

$postgroup1=$row[ID_POST_GROUP]; // Post Group
$gender1=$row[gender];
$lastlogin1=$row[lastLogin]; 
if (
$lastlogin1!=0){ $datelog1=date("d.M.Y H:i",$lastlogin1); } 
else {
$datelog1=''
};
$dateReg1=$row[dateRegistered]; $dateform =date("d.M.Y H:i",$dateReg1);
$birthdate1=$row[birthdate]; if ($birthdate1=='0001-01-01'){$birthdate1=''; };
$location1=$row[location];
$post1=$row[posts]; // How Many Posts

if ($group1!='0'){
$ask=mysql_query("SELECT groupName, stars FROM smf_membergroups WHERE ID_GROUP='$group1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$groupName1=$row[groupName]; // Group Name
$star1=$row[stars]; // How many Stars
};

$ask=mysql_query("SELECT groupName, stars FROM smf_membergroups WHERE ID_GROUP='$postgroup1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$postgroup2=$row[groupName];
if (
$star1==''){$star1=$row[stars]; };

// is the Member Online //////////////
$query mysql_query("SELECT * FROM smf_log_online"); 
$numberOfRows=mysql_num_rows($query); 
$imagepath1=$settings['images_url'];
if (
$numberOfRows>0){
$ask=mysql_query("SELECT ip FROM smf_log_online WHERE ID_MEMBER='$idmember1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$conline1=$row[ip]; 
};
/////////// how many Stars ////////////////////
$imagepath1=$settings['images_url'];
list(
$ngif,$gifn)=explode("#",$star1);
//////////////////////////////////////////////

///////////// Get The Avatar /////////////
$ask=mysql_query("SELECT filename, ID_ATTACH FROM smf_attachments WHERE ID_MEMBER='$idmember1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$avatar1=$row[filename]; $idattach1=$row[ID_ATTACH]; 
///////////// displaying the infos //////////////// 
echo "<div align='center'>";
if (
$avatar1!=''){
echo 
"<img src='index.php?action=dlattach;attach=$idattach1;type=avatar' border='0' style='margin:5px'><br>";
};
echo 
$memberName1."<br>";
if (
$groupName1!='') { echo $groupName1."<br>"; };
echo 
$postgroup2."<br>";
echo 
"<div style='margin:5px'>";
for (
$i=0$i<$ngif$i+=1){
echo 
"<img src='$imagepath1/$gifn' border='0'>";
};
echo 
"</div>";
if (
$conline1!=''){
echo 
"<img src='$imagepath1/useron.gif' border='0' style='margin:5px'><br>"; } else {
echo 
"<img src='$imagepath1/useroff.gif' border='0' style='margin:5px'><br>";
}


if (
$gender!=''){ echo 'Gender: '.$gender1."<br>"; };
if (
$datelog1==''){ $datelog1='Never'; };
echo 
'Last Active: '.$datelog1."<br>"
echo 
'Date Registered: '.$dateform."<br>";
if (
$birthdate1!='') { echo 'Date of Birth: '.$birthdate1."<br>"; };
if (
$location1!='') { echo 'Location: '.$location1."<br>"; };
echo 
'Posts: '.$post1."<br>";

echo 
"</div>";

?>


thanks

Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: Featured Member Block
« Reply #14 on: January 04, 2009, 11:06:41 AM »
Quote
also prefer the Avatar at the top not the bottom,
you code is easy read and I did it. 

its not difficult to change , here are 2 Codes , 2 Styles with Bold Font
No. 1 :
Code: [Select]
<?php
global $settings;

/////////// FINDING HOW MANY Members in the Forum //////////////////
$query mysql_query("SELECT * FROM smf_members"); 
$numberOfMembers=mysql_num_rows($query); 



/////////// SELECT A MEMBER ////////////

$randomMember=rand(1,$numberOfMembers); 
$ask=mysql_query("SELECT * FROM smf_members order by rand() limit 1");
$row mysql_fetch_array($askMYSQL_ASSOC) or die (mysql_error());
$idmember1=$row[ID_MEMBER]; // Member ID
$memberName1=$row[memberName]; // Member Name
$group1=$row[ID_GROUP]; // Member Group ID

$postgroup1=$row[ID_POST_GROUP]; // Post Group
$gender1=$row[gender];
$lastlogin1=$row[lastLogin]; 
if (
$lastlogin1!=0){ $datelog1=date("d.M.Y H:i",$lastlogin1); } 
else {
$datelog1=''
};
$dateReg1=$row[dateRegistered]; $dateform =date("d.M.Y H:i",$dateReg1);
$birthdate1=$row[birthdate]; if ($birthdate1=='0001-01-01'){$birthdate1=''; };
$location1=$row[location];
$post1=$row[posts]; // How Many Posts

if ($group1!='0'){
$ask=mysql_query("SELECT groupName, stars FROM smf_membergroups WHERE ID_GROUP='$group1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$groupName1=$row[groupName]; // Group Name
$star1=$row[stars]; // How many Stars
};

$ask=mysql_query("SELECT groupName, stars FROM smf_membergroups WHERE ID_GROUP='$postgroup1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$postgroup2=$row[groupName];
if (
$star1==''){$star1=$row[stars]; };

// is the Member Online //////////////
$query mysql_query("SELECT * FROM smf_log_online"); 
$numberOfRows=mysql_num_rows($query); 
$imagepath1=$settings['images_url'];
if (
$numberOfRows>0){
$ask=mysql_query("SELECT ip FROM smf_log_online WHERE ID_MEMBER='$idmember1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$conline1=$row[ip]; 
};
/////////// how many Stars ////////////////////
$imagepath1=$settings['images_url'];
list(
$ngif,$gifn)=explode("#",$star1);
//////////////////////////////////////////////

///////////// Get The Avatar /////////////
$ask=mysql_query("SELECT filename, ID_ATTACH FROM smf_attachments WHERE ID_MEMBER='$idmember1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$avatar1=$row[filename]; $idattach1=$row[ID_ATTACH]; 
///////////// displaying the infos //////////////// 
echo "<div align='center'>";
echo 
"<b>$memberName1</b>"."<br>";
if (
$groupName1!='') { echo "<b>$groupName1</b><br>"; };
echo 
"<b>$postgroup2</b><br>";
echo 
"<div style='margin:5px'>";
for (
$i=0$i<$ngif$i+=1){
echo 
"<img src='$imagepath1/$gifn' border='0'>";
};
echo 
"</div>";
if (
$conline1!=''){
echo 
"<img src='$imagepath1/useron.gif' border='0' style='margin:5px'><br>"; } else {
echo 
"<img src='$imagepath1/useroff.gif' border='0' style='margin:5px'><br>";
}


if (
$gender!=''){ echo "<b>Gender:</b> ".$gender1."<br>"; };
if (
$datelog1==''){ $datelog1='Never'; };
echo 
"<b>Last Active:</b> ".$datelog1."<br>"
echo 
"<b>Date Registered:</b> ".$dateform."<br>";
if (
$birthdate1!='') { echo "<b>Date of Birth:</b> ".$birthdate1."<br>"; };
if (
$location1!='') { echo "<b>Location:</b> ".$location1."<br>"; };
echo 
"<b>Posts:</b> ".$post1."<br>";
if (
$avatar1!=''){
echo 
"<img src='index.php?action=dlattach;attach=$idattach1;type=avatar' border='0' style='margin:5px'><br>";
};
echo 
"</div>";


?>



NO. 2 :
Code: [Select]
<?php
global $settings;

/////////// FINDING HOW MANY Members in the Forum //////////////////
$query mysql_query("SELECT * FROM smf_members"); 
$numberOfMembers=mysql_num_rows($query); 



/////////// SELECT A MEMBER ////////////

$randomMember=rand(1,$numberOfMembers); 
$ask=mysql_query("SELECT * FROM smf_members order by rand() limit 1");
$row mysql_fetch_array($askMYSQL_ASSOC) or die (mysql_error());
$idmember1=$row[ID_MEMBER]; // Member ID
$memberName1=$row[memberName]; // Member Name
$group1=$row[ID_GROUP]; // Member Group ID

$postgroup1=$row[ID_POST_GROUP]; // Post Group
$gender1=$row[gender];
$lastlogin1=$row[lastLogin]; 
if (
$lastlogin1!=0){ $datelog1=date("d.M.Y H:i",$lastlogin1); } 
else {
$datelog1=''
};
$dateReg1=$row[dateRegistered]; $dateform =date("d.M.Y H:i",$dateReg1);
$birthdate1=$row[birthdate]; if ($birthdate1=='0001-01-01'){$birthdate1=''; };
$location1=$row[location];
$post1=$row[posts]; // How Many Posts

if ($group1!='0'){
$ask=mysql_query("SELECT groupName, stars FROM smf_membergroups WHERE ID_GROUP='$group1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$groupName1=$row[groupName]; // Group Name
$star1=$row[stars]; // How many Stars
};

$ask=mysql_query("SELECT groupName, stars FROM smf_membergroups WHERE ID_GROUP='$postgroup1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$postgroup2=$row[groupName];
if (
$star1==''){$star1=$row[stars]; };

// is the Member Online //////////////
$query mysql_query("SELECT * FROM smf_log_online"); 
$numberOfRows=mysql_num_rows($query); 
$imagepath1=$settings['images_url'];
if (
$numberOfRows>0){
$ask=mysql_query("SELECT ip FROM smf_log_online WHERE ID_MEMBER='$idmember1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$conline1=$row[ip]; 
};
/////////// how many Stars ////////////////////
$imagepath1=$settings['images_url'];
list(
$ngif,$gifn)=explode("#",$star1);
//////////////////////////////////////////////

///////////// Get The Avatar /////////////
$ask=mysql_query("SELECT filename, ID_ATTACH FROM smf_attachments WHERE ID_MEMBER='$idmember1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$avatar1=$row[filename]; $idattach1=$row[ID_ATTACH]; 
///////////// displaying the infos //////////////// 
echo "<div align='center'>";
echo 
"<b>$memberName1</b>"."<br>";
if (
$groupName1!='') { echo "<b>$groupName1</b><br>"; };
echo 
"<b>$postgroup2</b><br>";
echo 
"<div style='margin:5px'>";
for (
$i=0$i<$ngif$i+=1){
echo 
"<img src='$imagepath1/$gifn' border='0'>";
};
echo 
"</div>";
if (
$conline1!=''){
echo 
"<img src='$imagepath1/useron.gif' border='0' style='margin:5px'><br>"; } else {
echo 
"<img src='$imagepath1/useroff.gif' border='0' style='margin:5px'><br>";
}


if (
$gender!=''){ echo "<b>Gender:</b> ".$gender1."<br>"; };
if (
$datelog1==''){ $datelog1='Never'; };
echo 
"<b>Last Active:</b><br>".$datelog1."<br>"
echo 
"<b>Date Registered:</b><br>".$dateform."<br>";
if (
$birthdate1!='') { echo "<b>Date of Birth:</b><br>".$birthdate1."<br>"; };
if (
$location1!='') { echo "<b>Location:</b><br>".$location1."<br>"; };
echo 
"<b>Posts:</b> ".$post1."<br>";
if (
$avatar1!=''){
echo 
"<img src='index.php?action=dlattach;attach=$idattach1;type=avatar' border='0' style='margin:5px'><br>";
};
echo 
"</div>";


?>


Offline dougsbrat

  • Jr. Member
  • **
  • Posts: 55
  • Pull my finger!
Re: Featured Member Block
« Reply #15 on: January 04, 2009, 11:25:08 AM »
you read my mind... I was already thinking on #2's style  :D


Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: Featured Member Block
« Reply #16 on: January 04, 2009, 11:28:18 AM »
Are all Avatars seen , or are there some not seen ?

Offline dougsbrat

  • Jr. Member
  • **
  • Posts: 55
  • Pull my finger!
Re: Featured Member Block
« Reply #17 on: January 04, 2009, 11:35:00 AM »
the ones that:
do not upload a avatar and do select a avatar from the forum..
are not shown  :(

Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: Featured Member Block
« Reply #18 on: January 04, 2009, 12:17:44 PM »
This Code would solve that Avatar problem .
Not Tested when the user uses an external url link to his Avatar
Code: [Select]
<?php
global $settings;

/////////// FINDING HOW MANY Members in the Forum //////////////////
$query mysql_query("SELECT * FROM smf_members"); 
$numberOfMembers=mysql_num_rows($query); 



/////////// SELECT A MEMBER ////////////

$randomMember=rand(1,$numberOfMembers); 
$ask=mysql_query("SELECT * FROM smf_members order by rand() limit 1");
$row mysql_fetch_array($askMYSQL_ASSOC) or die (mysql_error());
$idmember1=$row[ID_MEMBER]; // Member ID
$memberName1=$row[memberName]; // Member Name
$group1=$row[ID_GROUP]; // Member Group ID
$avatarin=$row[avatar];

$postgroup1=$row[ID_POST_GROUP]; // Post Group
$gender1=$row[gender];
$lastlogin1=$row[lastLogin]; 
if (
$lastlogin1!=0){ $datelog1=date("d.M.Y H:i",$lastlogin1); } 
else {
$datelog1=''
};
$dateReg1=$row[dateRegistered]; $dateform =date("d.M.Y H:i",$dateReg1);
$birthdate1=$row[birthdate]; if ($birthdate1=='0001-01-01'){$birthdate1=''; };
$location1=$row[location];
$post1=$row[posts]; // How Many Posts

if ($group1!='0'){
$ask=mysql_query("SELECT groupName, stars FROM smf_membergroups WHERE ID_GROUP='$group1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$groupName1=$row[groupName]; // Group Name
$star1=$row[stars]; // How many Stars
};

$ask=mysql_query("SELECT groupName, stars FROM smf_membergroups WHERE ID_GROUP='$postgroup1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$postgroup2=$row[groupName];
if (
$star1==''){$star1=$row[stars]; };

// is the Member Online //////////////
$query mysql_query("SELECT * FROM smf_log_online"); 
$numberOfRows=mysql_num_rows($query); 
$imagepath1=$settings['images_url'];
if (
$numberOfRows>0){
$ask=mysql_query("SELECT ip FROM smf_log_online WHERE ID_MEMBER='$idmember1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$conline1=$row[ip]; 
};
/////////// how many Stars ////////////////////
$imagepath1=$settings['images_url'];
list(
$ngif,$gifn)=explode("#",$star1);
//////////////////////////////////////////////

///////////// Get The Avatar /////////////
if ($avatarin==''){
$ask=mysql_query("SELECT filename, ID_ATTACH FROM smf_attachments WHERE ID_MEMBER='$idmember1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$avatar1=$row[filename]; $idattach1=$row[ID_ATTACH];
}
///////////// displaying the infos //////////////// 
echo "<div align='center'>";
echo 
"<b>$memberName1</b>"."<br>";
if (
$groupName1!='') { echo "<b>$groupName1</b><br>"; };
echo 
"<b>$postgroup2</b><br>";
echo 
"<div style='margin:5px'>";
for (
$i=0$i<$ngif$i+=1){
echo 
"<img src='$imagepath1/$gifn' border='0'>";
};
echo 
"</div>";
if (
$conline1!=''){
echo 
"<img src='$imagepath1/useron.gif' border='0' style='margin:5px'><br>"; } else {
echo 
"<img src='$imagepath1/useroff.gif' border='0' style='margin:5px'><br>";
}


if (
$gender!=''){ echo "<b>Gender:</b> ".$gender1."<br>"; };
if (
$datelog1==''){ $datelog1='Never'; };
echo 
"<b>Last Active:</b><br>".$datelog1."<br>"
echo 
"<b>Date Registered:</b><br>".$dateform."<br>";
if (
$birthdate1!='') { echo "<b>Date of Birth:</b><br>".$birthdate1."<br>"; };
if (
$location1!='') { echo "<b>Location:</b><br>".$location1."<br>"; };
echo 
"<b>Posts:</b> ".$post1."<br>";
if (
$avatarin!=''){
echo 
"<img src='avatars/$avatarin' border='0' style='margin:5px'><br>";
};
if (
$avatar1!=''){
echo 
"<img src='index.php?action=dlattach;attach=$idattach1;type=avatar' border='0' style='margin:5px'><br>";
};
echo 
"</div>";


?>


Offline dougsbrat

  • Jr. Member
  • **
  • Posts: 55
  • Pull my finger!
Re: Featured Member Block
« Reply #19 on: January 04, 2009, 12:42:55 PM »
perfect!

but you are correct, external linked avatar's dont show


thanks for the good work   ;D
« Last Edit: January 04, 2009, 12:46:25 PM by dougsbrat »

Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: Featured Member Block
« Reply #20 on: January 04, 2009, 01:24:38 PM »
ok , I'm gonna make an update to solve that external links avatar problem

Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: Featured Member Block
« Reply #21 on: January 04, 2009, 01:57:07 PM »
There is no need for an update , the Avatars also will display if the user uses an external link to the Avatar because the Avatar will be saved as if someone Uploaded the Avatar , so the Avatar from an external link will be displayed as well isnt it ?

Offline dougsbrat

  • Jr. Member
  • **
  • Posts: 55
  • Pull my finger!
Re: Featured Member Block
« Reply #22 on: January 04, 2009, 02:18:50 PM »
I changed my avatar to a link to a image from my other web page...
it does not show

Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: Featured Member Block
« Reply #23 on: January 04, 2009, 02:44:36 PM »
Quote
I changed my avatar to a link to a image from my other web page...
it does not show
This is Strange !! , I have also made a test , but the result was ok , the Avatar displayed .. what do you see when you make a right mouse click on the Avatar , which properties (url addresse ?) I mean for an external link Avatar?
« Last Edit: January 04, 2009, 02:49:28 PM by Nabil »

Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: Featured Member Block
« Reply #24 on: January 04, 2009, 04:04:42 PM »
I seeeeeeeeeeeeeeeeeeeeeee , you have not checked this thats why , see the photo

ok I will make an update
« Last Edit: January 04, 2009, 04:08:02 PM by Nabil »

Offline dougsbrat

  • Jr. Member
  • **
  • Posts: 55
  • Pull my finger!
Re: Featured Member Block
« Reply #25 on: January 04, 2009, 04:34:04 PM »
I seeeeeeeeeeeeeeeeeeeeeee , you have not checked this thats why , see the photo

ok I will make an update

you are correct... mine looks like that

Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: Featured Member Block
« Reply #26 on: January 04, 2009, 04:44:36 PM »
So this Code will solve all Avatars problems :

Code: [Select]
<?php
global $settings;

/////////// FINDING HOW MANY Members in the Forum //////////////////
$query mysql_query("SELECT * FROM smf_members"); 
$numberOfMembers=mysql_num_rows($query); 



/////////// SELECT A MEMBER ////////////

$randomMember=rand(1,$numberOfMembers); 
$ask=mysql_query("SELECT * FROM smf_members order by rand() limit 1");
$row mysql_fetch_array($askMYSQL_ASSOC) or die (mysql_error());
$idmember1=$row[ID_MEMBER]; // Member ID
$memberName1=$row[memberName]; // Member Name
$group1=$row[ID_GROUP]; // Member Group ID
$avatarin=$row[avatar];

$postgroup1=$row[ID_POST_GROUP]; // Post Group
$gender1=$row[gender];
$lastlogin1=$row[lastLogin]; 
if (
$lastlogin1!=0){ $datelog1=date("d.M.Y H:i",$lastlogin1); } 
else {
$datelog1=''
};
$dateReg1=$row[dateRegistered]; $dateform =date("d.M.Y H:i",$dateReg1);
$birthdate1=$row[birthdate]; if ($birthdate1=='0001-01-01'){$birthdate1=''; };
$location1=$row[location];
$post1=$row[posts]; // How Many Posts

if ($group1!='0'){
$ask=mysql_query("SELECT groupName, stars FROM smf_membergroups WHERE ID_GROUP='$group1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$groupName1=$row[groupName]; // Group Name
$star1=$row[stars]; // How many Stars
};

$ask=mysql_query("SELECT groupName, stars FROM smf_membergroups WHERE ID_GROUP='$postgroup1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$postgroup2=$row[groupName];
if (
$star1==''){$star1=$row[stars]; };

// is the Member Online //////////////
$query mysql_query("SELECT * FROM smf_log_online"); 
$numberOfRows=mysql_num_rows($query); 
$imagepath1=$settings['images_url'];
if (
$numberOfRows>0){
$ask=mysql_query("SELECT ip FROM smf_log_online WHERE ID_MEMBER='$idmember1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$conline1=$row[ip]; 
};
/////////// how many Stars ////////////////////
$imagepath1=$settings['images_url'];
list(
$ngif,$gifn)=explode("#",$star1);
//////////////////////////////////////////////

///////////// Get The Avatar /////////////
if ($avatarin==''){
$ask=mysql_query("SELECT filename, ID_ATTACH FROM smf_attachments WHERE ID_MEMBER='$idmember1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$avatar1=$row[filename]; $idattach1=$row[ID_ATTACH];
}
///////////// displaying the infos //////////////// 
echo "<div align='center'>";
echo 
"<b>$memberName1</b>"."<br>";
if (
$groupName1!='') { echo "<b>$groupName1</b><br>"; };
echo 
"<b>$postgroup2</b><br>";
echo 
"<div style='margin:5px'>";
for (
$i=0$i<$ngif$i+=1){
echo 
"<img src='$imagepath1/$gifn' border='0'>";
};
echo 
"</div>";
if (
$conline1!=''){
echo 
"<img src='$imagepath1/useron.gif' border='0' style='margin:5px'><br>"; } else {
echo 
"<img src='$imagepath1/useroff.gif' border='0' style='margin:5px'><br>";
}


if (
$gender!=''){ echo "<b>Gender:</b> ".$gender1."<br>"; };
if (
$datelog1==''){ $datelog1='Never'; };
echo 
"<b>Last Active:</b><br>".$datelog1."<br>"
echo 
"<b>Date Registered:</b><br>".$dateform."<br>";
if (
$birthdate1!='') { echo "<b>Date of Birth:</b><br>".$birthdate1."<br>"; };
if (
$location1!='') { echo "<b>Location:</b><br>".$location1."<br>"; };
echo 
"<b>Posts:</b> ".$post1."<br>";

if (
$avatarin!=''){
$checkavatar1=preg_match('/http:\/\//',$avatarin);
if (
$checkavatar1){ 
echo 
"<img src='$avatarin' border='0' style='margin:5px'><br>";
} else {
echo 
"<img src='avatars/$avatarin' border='0' style='margin:5px'><br>";
}
};
if (
$avatar1!=''){
echo 
"<img src='index.php?action=dlattach;attach=$idattach1;type=avatar' border='0' style='margin:5px'><br>";
};
echo 
"</div>";


?>


Offline dougsbrat

  • Jr. Member
  • **
  • Posts: 55
  • Pull my finger!
Re: Featured Member Block
« Reply #27 on: January 04, 2009, 05:07:44 PM »
Perfect!


if some one wants this with the avatar on top use this one
Code: [Select]
<?php

global $settings;

/////////// FINDING HOW MANY Members in the Forum //////////////////
$query mysql_query("SELECT * FROM smf_members"); 
$numberOfMembers=mysql_num_rows($query); 



/////////// SELECT A MEMBER ////////////

$randomMember=rand(1,$numberOfMembers); 
$ask=mysql_query("SELECT * FROM smf_members order by rand() limit 1");
$row mysql_fetch_array($askMYSQL_ASSOC) or die (mysql_error());
$idmember1=$row[ID_MEMBER]; // Member ID
$memberName1=$row[memberName]; // Member Name
$group1=$row[ID_GROUP]; // Member Group ID
$avatarin=$row[avatar];

$postgroup1=$row[ID_POST_GROUP]; // Post Group
$gender1=$row[gender];
$lastlogin1=$row[lastLogin]; 
if (
$lastlogin1!=0){ $datelog1=date("d.M.Y H:i",$lastlogin1); } 
else {
$datelog1=''
};
$dateReg1=$row[dateRegistered]; $dateform =date("d.M.Y H:i",$dateReg1);
$birthdate1=$row[birthdate]; if ($birthdate1=='0001-01-01'){$birthdate1=''; };
$location1=$row[location];
$post1=$row[posts]; // How Many Posts

if ($group1!='0'){
$ask=mysql_query("SELECT groupName, stars FROM smf_membergroups WHERE ID_GROUP='$group1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$groupName1=$row[groupName]; // Group Name
$star1=$row[stars]; // How many Stars
};

$ask=mysql_query("SELECT groupName, stars FROM smf_membergroups WHERE ID_GROUP='$postgroup1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$postgroup2=$row[groupName];
if (
$star1==''){$star1=$row[stars]; };

// is the Member Online //////////////
$query mysql_query("SELECT * FROM smf_log_online"); 
$numberOfRows=mysql_num_rows($query); 
$imagepath1=$settings['images_url'];
if (
$numberOfRows>0){
$ask=mysql_query("SELECT ip FROM smf_log_online WHERE ID_MEMBER='$idmember1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$conline1=$row[ip]; 
};
/////////// how many Stars ////////////////////
$imagepath1=$settings['images_url'];
list(
$ngif,$gifn)=explode("#",$star1);
//////////////////////////////////////////////

///////////// Get The Avatar /////////////
if ($avatarin==''){
$ask=mysql_query("SELECT filename, ID_ATTACH FROM smf_attachments WHERE ID_MEMBER='$idmember1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$avatar1=$row[filename]; $idattach1=$row[ID_ATTACH];
}
///////////// displaying the infos //////////////// 
echo "<div align='center'>";

if (
$avatarin!=''){
$checkavatar1=preg_match('/http:\/\//',$avatarin);
if (
$checkavatar1){ 
echo 
"<img src='$avatarin' border='0' style='margin:5px'><br>";
} else {
echo 
"<img src='avatars/$avatarin' border='0' style='margin:5px'><br>";
}
};
if (
$avatar1!=''){
echo 
"<img src='index.php?action=dlattach;attach=$idattach1;type=avatar' border='0' style='margin:5px'><br>";
};

echo 
"<b>$memberName1</b>"."<br>";
if (
$groupName1!='') { echo "<b>$groupName1</b><br>"; };
echo 
"<b>$postgroup2</b><br>";
echo 
"<div style='margin:5px'>";
for (
$i=0$i<$ngif$i+=1){
echo 
"<img src='$imagepath1/$gifn' border='0'>";
};
echo 
"</div>";
if (
$conline1!=''){
echo 
"<img src='$imagepath1/useron.gif' border='0' style='margin:5px'><br>"; } else {
echo 
"<img src='$imagepath1/useroff.gif' border='0' style='margin:5px'><br>";
}


if (
$gender!=''){ echo "<b>Gender:</b> ".$gender1."<br>"; };
if (
$datelog1==''){ $datelog1='Never'; };
echo 
"<b>Last Active:</b><br>".$datelog1."<br>"
echo 
"<b>Date Registered:</b><br>".$dateform."<br>";
if (
$birthdate1!='') { echo "<b>Date of Birth:</b><br>".$birthdate1."<br>"; };
if (
$location1!='') { echo "<b>Location:</b><br>".$location1."<br>"; };
echo 
"<b>Posts:</b> ".$post1."<br>";

echo 
"</div>";

?>


(for new users)
1. create a new PHP block
2. copy the code
3. paste into the block (exclude the first and last line)
4. enjoy

Nabil gets all the credit, THANKS!

Offline bmac

  • Semi Newbie
  • *
  • Posts: 27
    • Steelhead Notebook
Re: Featured Member Block
« Reply #28 on: January 05, 2009, 12:42:18 AM »
Works great, thanks for the hard work on this.

One question, Is there any way to modify the code to only show members with over "X" number of posts? ..... possibly 25, 50 or 100 or something.


Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: Featured Member Block
« Reply #29 on: January 05, 2009, 05:20:13 AM »
Quote
One question, Is there any way to modify the code to only show members with over "X" number of posts? ..... possibly 25, 50 or 100 or something.

of course this is possible ,how about selecting a Member (not Randomly) but according to posts (let say from 50 on ) you decide how many posts , every day a Member you can call the block (Member of the day) but as I said not every Member only choosing from Members that have made a minimum number of posts , all Visitors of your forum will see the same Member (unlike a Random function where every visitor sees another Member).
every day a Member is displayed one after the other and when all Members with that minimum Posts are displayed , then will start from the begining this could take maybe months according to how many Members with that minimum amount of posts and (those who reach recently this minimum Number ) will also be considered every day , how about that?

Offline Burke Knight

  • Sr. Member
  • ****
  • Posts: 394
  • Gender: Male
  • I tell it how I see it. Don't like it? Hit Alt+F4
    • BurkeKnight Enterprises
  • SMF Version: None
  • SP Version: None
  • Elkarte Version: None
Re: Featured Member Block
« Reply #30 on: January 05, 2009, 08:01:41 AM »
More viable way, I think, would be setting it by member ID #. Not have it random, so the admin can set up maybe a member of the week, or month. :)

Also, is this for 1.1.7 or 2.0 Beta 4?

Offline bmac

  • Semi Newbie
  • *
  • Posts: 27
    • Steelhead Notebook
Re: Featured Member Block
« Reply #31 on: January 05, 2009, 09:56:58 AM »
Quote
Also, is this for 1.1.7

I'm running 1.1.7. I'm not great at this coding stuff, but would appreciate any help you guys could provide. I love the idea of member of the week or month. Exactly what I'm looking for.

Brian

Offline dougsbrat

  • Jr. Member
  • **
  • Posts: 55
  • Pull my finger!
Re: Featured Member Block
« Reply #32 on: January 05, 2009, 01:08:45 PM »
I use 1.1.7  ;D

looks like the random code would be removed and add a line of code to set the member # to use

ie
MOW=23
and the code use that to display

surly we all can change one variable ;)

I would prefer it be a seprate block so ether or both could be used. 
« Last Edit: January 05, 2009, 01:14:06 PM by dougsbrat »

Offline dougsbrat

  • Jr. Member
  • **
  • Posts: 55
  • Pull my finger!
Re: Featured Member Block
« Reply #33 on: January 06, 2009, 10:39:08 AM »
perhaps with just a few lines of code and adding or removing a "/",

you could have:
"member of the moment"(random)
or
"member of the week/month"(designated)

that would be cool ;D

Offline bmac

  • Semi Newbie
  • *
  • Posts: 27
    • Steelhead Notebook
Re: Featured Member Block
« Reply #34 on: January 06, 2009, 12:27:54 PM »
Quote

perhaps with just a few lines of code and adding or removing a "/",

you could have:
"member of the moment"(random)
or
"member of the week/month"(designated)

that would be coo

Thats what I'm looking for. If it is simple coding as said, I would love some help to figure this out. Like I said, this area is a big weakness of mine. I guess I need to make a better effort to learn this stuff. In the meantime any help is greatly appreciated.

thanks for your guys hard work on this.

Offline dougsbrat

  • Jr. Member
  • **
  • Posts: 55
  • Pull my finger!
Re: Featured Member Block
« Reply #35 on: January 06, 2009, 03:56:12 PM »
I talked to Nabil about my attempt at adding code...

here is what we came up with

Code: [Select]
<?php

global $settings;

/////////// FINDING HOW MANY Members in the Forum //////////////////
$query mysql_query("SELECT * FROM smf_members");
$numberOfMembers=mysql_num_rows($query);



/////////// SELECT A MEMBER ////////////

$randomMember=rand(1,$numberOfMembers);
$ask=mysql_query("SELECT * FROM smf_members order by rand() limit 1");

//////  MEMBER SELECT OPTION ////////
/////if you want member # 5 to be used ONY 
////then change the #2 to the number you (want +1)  in this case 6     //
///// add "//" at begining on the next line to use a random member  /////
$ask=mysql_query("SELECT * FROM smf_members LIMIT 2,1");
///// end of member select option /////

$row mysql_fetch_array($askMYSQL_ASSOC) or die (mysql_error());
$idmember1=$row[ID_MEMBER]; // Member ID
$memberName1=$row[memberName]; // Member Name
$group1=$row[ID_GROUP]; // Member Group ID
$avatarin=$row[avatar];

$postgroup1=$row[ID_POST_GROUP]; // Post Group
$gender1=$row[gender];
$lastlogin1=$row[lastLogin];
if (
$lastlogin1!=0){ $datelog1=date("d.M.Y H:i",$lastlogin1); }
else {
$datelog1='';
};
$dateReg1=$row[dateRegistered]; $dateform =date("d.M.Y H:i",$dateReg1);
$birthdate1=$row[birthdate]; if ($birthdate1=='0001-01-01'){$birthdate1=''; };
$location1=$row[location];
$post1=$row[posts]; // How Many Posts

if ($group1!='0'){
$ask=mysql_query("SELECT groupName, stars FROM smf_membergroups WHERE ID_GROUP='$group1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$groupName1=$row[groupName]; // Group Name
$star1=$row[stars]; // How many Stars
};

$ask=mysql_query("SELECT groupName, stars FROM smf_membergroups WHERE ID_GROUP='$postgroup1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$postgroup2=$row[groupName];
if (
$star1==''){$star1=$row[stars]; };

// is the Member Online //////////////
$query mysql_query("SELECT * FROM smf_log_online");
$numberOfRows=mysql_num_rows($query);
$imagepath1=$settings['images_url'];
if (
$numberOfRows>0){
$ask=mysql_query("SELECT ip FROM smf_log_online WHERE ID_MEMBER='$idmember1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$conline1=$row[ip];
};
/////////// how many Stars ////////////////////
$imagepath1=$settings['images_url'];
list(
$ngif,$gifn)=explode("#",$star1);
//////////////////////////////////////////////

///////////// Get The Avatar /////////////
if ($avatarin==''){
$ask=mysql_query("SELECT filename, ID_ATTACH FROM smf_attachments WHERE ID_MEMBER='$idmember1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$avatar1=$row[filename]; $idattach1=$row[ID_ATTACH];
}
///////////// displaying the infos ////////////////
echo "<div align='center'>";

if (
$avatarin!=''){
$checkavatar1=preg_match('/http:\/\//',$avatarin);
if (
$checkavatar1){
echo 
"<img src='$avatarin' border='0' style='margin:5px'><br>";
} else {
echo 
"<img src='avatars/$avatarin' border='0' style='margin:5px'><br>";
}
};
if (
$avatar1!=''){
echo 
"<img src='index.php?action=dlattach;attach=$idattach1;type=avatar' border='0' style='margin:5px'><br>";
};

echo 
"<b>$memberName1</b>"."<br>";
if (
$groupName1!='') { echo "<b>$groupName1</b><br>"; };
echo 
"<b>$postgroup2</b><br>";
echo 
"<div style='margin:5px'>";
for (
$i=0$i<$ngif$i+=1){
echo 
"<img src='$imagepath1/$gifn' border='0'>";
};
echo 
"</div>";
if (
$conline1!=''){
echo 
"<img src='$imagepath1/useron.gif' border='0' style='margin:5px'><br>"; } else {
echo 
"<img src='$imagepath1/useroff.gif' border='0' style='margin:5px'><br>";
}


if (
$gender!=''){ echo "<b>Gender:</b> ".$gender1."<br>"; };
if (
$datelog1==''){ $datelog1='Never'; };
echo 
"<b>Last Active:</b><br>".$datelog1."<br>";
echo 
"<b>Date Registered:</b><br>".$dateform."<br>";
if (
$birthdate1!='') { echo "<b>Date of Birth:</b><br>".$birthdate1."<br>"; };
if (
$location1!='') { echo "<b>Location:</b><br>".$location1."<br>"; };
echo 
"<b>Posts:</b> ".$post1."<br>";

echo 
"</div>";

?>

look at the "member select option" area for the member option and what to change.


« Last Edit: January 06, 2009, 10:52:08 PM by dougsbrat »

Offline bmac

  • Semi Newbie
  • *
  • Posts: 27
    • Steelhead Notebook
Re: Featured Member Block
« Reply #36 on: January 06, 2009, 10:41:12 PM »
Quote
look at the "member select option" area for the member option and what to change

OK, I tried this and here is what I saw on my portal. It appears that it should be change the # 2 to the number you want +1,  not -1. That works on my portal. Also this works fine for 1 or 2 digit userID numbers, but when I try a 3  digit userID number it fails and shows a blank block. Any ideas?

Love it so far, if I could fix the three digit problem I would be very happy. Great work!

Also, how hard would it be to have the username or avatar in this block as a link to the members profile that could be clicked on to go there?

thanks again for your continued hard work on this.
« Last Edit: January 07, 2009, 12:33:49 AM by bmac »

Offline dougsbrat

  • Jr. Member
  • **
  • Posts: 55
  • Pull my finger!
Re: Featured Member Block
« Reply #37 on: January 06, 2009, 10:51:27 PM »
you are correct +1 ;)
I will edit the above posted code info.

-I don't have that many users so I would have not seen this problem (yet).
-and linking would be good too.
hopefully Nabil or another can shed light on this fix

Offline casper

  • Semi Newbie
  • *
  • Posts: 9
  • SMF Version: 2 RC2
  • SP Version: 2.3.1
Re: Featured Member Block
« Reply #38 on: January 07, 2009, 12:12:31 AM »
Very nice mod. One request though - I also use SMF Media Gallery 1.5.2 and was wondering if it's possible to include the number of images that the user has uploaded?

Offline bmac

  • Semi Newbie
  • *
  • Posts: 27
    • Steelhead Notebook
Re: Featured Member Block
« Reply #39 on: January 08, 2009, 07:50:01 PM »
One more question on this, How would I change the font size,  color, face etc. ?

Would these be done by CSS or by adding other options to this php code that could be used to modify the look slightly?

I would also like to make a link out of the avatar and user ID.

Any ideas would be helpful.

thanks..Bmac

Offline hot rides

  • Semi Newbie
  • *
  • Posts: 42
    • Hot Rides Show & Cruise
Re: Featured Member Block
« Reply #40 on: January 09, 2009, 11:33:48 AM »
any idea how I would exclude certain members? I have a test account and I also wouldnt want my admin account showing up either.
I know this can be done and the code is fairly simple I just cant remember it off the top my head.

Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: Featured Member Block
« Reply #41 on: January 09, 2009, 11:46:23 AM »
by the way , to let the Gender symbol to be displayed

find :
Code: [Select]
if ($gender!=''){ echo "<b>Gender:</b> ".$gender1."<br>"; };

replace with
Code: [Select]
if ($gender1!=0){
if ($gender1==1){$gender1="<img src='$imagepath1/Male.gif' border='0'>"; }
else { $gender1="<img src='$imagepath1/Female.gif' border='0'>"; }
echo "<b>Gender:</b> ".$gender1."<br>";
                 }; /// End gender1

Offline darkon

  • Semi Newbie
  • *
  • Posts: 6
Re: Featured Member Block
« Reply #42 on: January 11, 2009, 11:51:19 PM »
I think there is one thing missing....

This block doesn´t make any sense to me without a link to the users profile.

I tried to code that in, but i just suck at php...  :|



Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: Featured Member Block
« Reply #43 on: January 12, 2009, 04:18:37 AM »
Quote
I think there is one thing missing....

This block doesn´t make any sense to me without a link to the users profile.

I tried to code that in, but i just suck at php... 

I think you're right , this is an important thing that should be added , so now I have added a link in the block , just use the Code below
Code: [Select]
<?php
$date11
=date(U); // this is the Current Date Including Time
//////////// CHOOSE THE MINIMUM NUMBER OF POSTS REQUIRED /////////////////
$minpost11=1;
///////////////////////////////////////////////////////////////////////////

global $settings;
////////// FINDING HOW MANY Members in the Forum //////////////////
$query mysql_query("SELECT * FROM smf_members"); 
$numberOfMembers=mysql_num_rows($query); 

//////////// check out The max Time and the Start Position ///
$data11=file_get_contents("memBlock.php");
list(
$max11,$extr11,$start11)=explode("|",$data11);
if (
$date11>$max11){$start11+=1$dateplus11=$date11+$extr11;
if (
$start11>=$numberOfMembers){$start11=0; };
}
//////////////////////////////////////////////////////////////


$endp11=$numberOfMembers-$start11;


/////////// LOOK for member with minpost11 starting from $start11 ////////////
$ask=mysql_query("SELECT * FROM smf_members LIMIT $start11,$endp11");
$i11=-1;
while (
$row mysql_fetch_array($askMYSQL_ASSOC) ){
$i11+=1// Counter for the position
$post1=$row[posts]; // How Many Posts
if ($post1>=$minpost11){ 
if (
$date11>$max11){
$start11+=$i11// The Final position
$fp11=fopen("memBlock.php","w");
$pcontent11="$dateplus11|$extr11|$start11";
fputs($fp11,$pcontent11); // a document with Time and start position
}
break; 
}
};

$idmember1=$row[ID_MEMBER]; // Member ID
$memberName1=$row[memberName]; // Member Name
$group1=$row[ID_GROUP]; // Member Group ID
$avatarin=$row[avatar];

$postgroup1=$row[ID_POST_GROUP]; // Post Group
$gender1=$row[gender];
$lastlogin1=$row[lastLogin]; 
if (
$lastlogin1!=0){ $datelog1=date("d.M.Y H:i",$lastlogin1); } 
else {
$datelog1=''
};
$dateReg1=$row[dateRegistered]; $dateform =date("d.M.Y H:i",$dateReg1);
$birthdate1=$row[birthdate]; if ($birthdate1=='0001-01-01'){$birthdate1=''; };
$location1=$row[location];


if (
$group1!='0'){
$ask=mysql_query("SELECT groupName, stars FROM smf_membergroups WHERE ID_GROUP='$group1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$groupName1=$row[groupName]; // Group Name
$star1=$row[stars]; // How many Stars
};

$ask=mysql_query("SELECT groupName, stars FROM smf_membergroups WHERE ID_GROUP='$postgroup1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$postgroup2=$row[groupName];
if (
$star1==''){$star1=$row[stars]; };

// is the Member Online //////////////
$query mysql_query("SELECT * FROM smf_log_online"); 
$numberOfRows=mysql_num_rows($query); 
$imagepath1=$settings['images_url'];
if (
$numberOfRows>0){
$ask=mysql_query("SELECT ip FROM smf_log_online WHERE ID_MEMBER='$idmember1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$conline1=$row[ip]; 
};
/////////// how many Stars ////////////////////
$imagepath1=$settings['images_url'];
list(
$ngif,$gifn)=explode("#",$star1);
//////////////////////////////////////////////

///////////// Get The Avatar /////////////
if ($avatarin==''){
$ask=mysql_query("SELECT filename, ID_ATTACH FROM smf_attachments WHERE ID_MEMBER='$idmember1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$avatar1=$row[filename]; $idattach1=$row[ID_ATTACH];
}
///////////// displaying the infos //////////////// 
echo "<div align='center'>";
if (
$avatarin!=''){
$checkavatar1=preg_match('/http:\/\//',$avatarin);
if (
$checkavatar1){ 
echo 
"<img src='$avatarin' border='0' style='margin:5px'><br>";
} else {
echo 
"<img src='avatars/$avatarin' border='0' style='margin:5px'><br>";
}
};
if (
$avatar1!=''){
echo 
"<img src='index.php?action=dlattach;attach=$idattach1;type=avatar' border='0' style='margin:5px'><br>";
};
echo 
"<a href='index.php?action=profile;u=$idmember1'><b>$memberName1</b></a>"."<br>";
if (
$groupName1!='') { echo "<b>$groupName1</b><br>"; };
echo 
"<b>$postgroup2</b><br>";
echo 
"<div style='margin:5px'>";
for (
$i=0$i<$ngif$i+=1){
echo 
"<img src='$imagepath1/$gifn' border='0'>";
};
echo 
"</div>";
if (
$conline1!=''){
echo 
"<img src='$imagepath1/useron.gif' border='0' style='margin:5px'><br>"; } else {
echo 
"<img src='$imagepath1/useroff.gif' border='0' style='margin:5px'><br>";
}


//if ($gender!=''){ echo "<b>Gender:</b> ".$gender1."<br>"; };
if ($gender1!=0){ 
if (
$gender1==1){$gender1="<img src='$imagepath1/Male.gif' border='0'>"; } 
else { 
$gender1="<img src='$imagepath1/Female.gif' border='0'>"; }
echo 
"<b>Gender:</b> ".$gender1."<br>"
                 }; 
/// End gender1
if ($datelog1==''){ $datelog1='Never'; };
echo 
"<b>Last Active:</b><br>".$datelog1."<br>"
echo 
"<b>Date Registered:</b><br>".$dateform."<br>";
if (
$birthdate1!='') { echo "<b>Date of Birth:</b><br>".$birthdate1."<br>"; };
if (
$location1!='') { echo "<b>Location:</b><br>".$location1."<br>"; };
echo 
"<b>Posts:</b> ".$post1."<br>";


echo 
"</div>";


?>


Offline bmac

  • Semi Newbie
  • *
  • Posts: 27
    • Steelhead Notebook
Re: Featured Member Block
« Reply #44 on: January 12, 2009, 08:29:01 AM »
Excellent. I also think the avatar should also be a link to the members profile. As well as the useron icon that can be used to send a PM as on the Top Poster with Showcase block. I also like the CSS in the code on the Top Poster with Showcase block that can be used to change colors, font size, etc. Will the CSS code in that block work on this block as well? If so I can just add it.

Great work on this block Nabil! ;D

Offline darkon

  • Semi Newbie
  • *
  • Posts: 6
Re: Featured Member Block
« Reply #45 on: January 12, 2009, 09:57:36 AM »
 8) Thank you for your work.


Offline dougsbrat

  • Jr. Member
  • **
  • Posts: 55
  • Pull my finger!
Re: Featured Member Block
« Reply #46 on: January 12, 2009, 10:19:12 AM »
Just me or not?
I looked at the last code and looks like many things were changed, so I just put it into a "test" block

first run looked good (no members have gender though)
I added gender to a test user to see it...

now the block always looks like this (pic) all the time

Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: Featured Member Block
« Reply #47 on: January 12, 2009, 11:48:59 AM »
Quote
Just me or not?
I looked at the last code and looks like many things were changed, so I just put it into a "test" block

first run looked good (no members have gender though)
I added gender to a test user to see it...

now the block always looks like this (pic) all the time

Maybe you have added Gender Code 2 times , the last Code includes already 'Gender Code' you don't need to add anything to it , just use it as it is .

Offline dougsbrat

  • Jr. Member
  • **
  • Posts: 55
  • Pull my finger!
Re: Featured Member Block
« Reply #48 on: January 12, 2009, 11:52:16 AM »
Quote
Just me or not?
I looked at the last code and looks like many things were changed, so I just put it into a "test" block

first run looked good (no members have gender though)
I added gender to a test user to see it...

now the block always looks like this (pic) all the time

Maybe you have added Gender Code 2 times , the last Code includes already 'Gender Code' you don't need to add anything to it , just use it as it is .

I used the complete code from #43 in a new block

Offline bmac

  • Semi Newbie
  • *
  • Posts: 27
    • Steelhead Notebook
Re: Featured Member Block
« Reply #49 on: January 12, 2009, 12:22:03 PM »
I actually haven't tried this new code yet, but the code dougsbrat posted earlier is what I'm using for my featured member. This has the ability to specify a specific member which is what I was looking for. I love it and think it would be better with these links added to it and style commands that can be modified to create color or font changes. 

Maybe a different block based on dougsbrat code for specific members, and this one for random members? Just a thought.

great work on both of these.

Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Re: Featured Member Block
« Reply #50 on: January 12, 2009, 12:48:13 PM »
Quote
I used the complete code from #43 in a new block
I know this happens usually when the User is not activated, so he has no Data in the database although the user is registered but it is considered (not active) therefore you see in the Block no name and last active : NEVER , also no Correct DATA. so a user must activate first his account (if you have required Activation of the email as an Admin)

Offline jb3398

  • Semi Newbie
  • *
  • Posts: 29
Re: Featured Member Block
« Reply #51 on: January 19, 2009, 07:54:35 PM »
I tried using this block on by portal page and it disfigured all my other blocks. I copied the php code and pasted it in the php block. I placed it as the last block on my page. When I clicked on my home page all my blocks were missing and out of alignment. Does anyone have a demo or page url you can refer me too, so I can view the end results.

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Featured Member Block
« Reply #52 on: February 03, 2009, 05:09:47 AM »
Nice try Nabil. But you can fetch all the data with one query.

Here is my block codes:

For SMF 1.x:

Code: [Select]
global $db_prefix, $scripturl, $memberContext, $color_profile, $txt;

loadLanguage('Profile');

// Ids of users to exclude. (2,3,4)
$exclude_members = array();

$request = db_query("
SELECT ID_MEMBER
FROM {$db_prefix}members
WHERE is_activated = 1" . (!empty($exclude_members) ? "
AND ID_MEMBER NOT IN (" . implode(',', $exclude_members) . ")" : "") . "
ORDER BY RAND()
LIMIT 1", __FILE__, __LINE__);
list ($member) = mysql_fetch_row($request);
mysql_free_result($request);

if (empty($member))
return 'No members.';

loadMemberData($member);
loadMemberContext($member);

$member_info = $memberContext[$member];

if (empty($modSettings['MemberColorLinkInstalled']) && sp_loadColors($member) !== false)
$member_info['colored_link'] = '<strong><a href="' . $scripturl . '?action=profile;u=' . $member_info['id'] . '" title="' . $txt[92] . ' ' . $member_info['name'] . '">' . $color_profile[$member]['colored_name'] . '</a></strong>';

echo '
<div style="text-align: center; width: %99;">';

// Colored member link.
echo '
', $member_info['colored_link'], '<br />';

// Member title.
if (!empty($member_info['title']))
echo '
', $member_info['title'], '<br />';

// Member group.
if (!empty($member_info['group']))
echo '
', $member_info['group'], '<br />';
else
echo '
', $member_info['post_group'], '<br />';

// Group stars.
echo '
', $member_info['group_stars'], '<br />';

// Member avatar.
if (!empty($member_info['avatar']['image']))
echo '
<br />
', $member_info['avatar']['image'], '<br />';

// Personal text.
if (!empty($member_info['blurb']))
echo '
', $member_info['blurb'], '<br />';

// Online image.
echo '
<img src="', $member_info['online']['image_href'], '" alt="', $member_info['online']['text'], '" /> ', $member_info['online']['text'], '<br />';

// Gender name and image.
if (!empty($member_info['gender']['name']))
echo '
', $member_info['gender']['image'], ' ', $member_info['gender']['name'], '<br />';

echo '
<ul style="list-style-type: none; text-align: left; padding: 0px 0px 0px 5px;">';

// Post count.
echo '
<li><strong>', $txt[21], ':</strong> ', $member_info['posts'], '</li>';

// Location.
if (!empty($member_info['location']))
echo '
<li><strong>', $txt[227], ':</strong> ', $member_info['location'], '</li>';

// Date registered.
echo '
<li><strong>', $txt[233], ':</strong> ', $member_info['registered'], '</li>';

// Last login.
echo '
<li><strong>', $txt['lastLoggedIn'], ':</strong> ', $member_info['last_login'], '</li>';

echo '
</ul>
</div>';

For SMF 2.x:

Code: [Select]
global $smcFunc, $scripturl, $memberContext, $color_profile, $txt;

loadLanguage('Profile');

// Ids of users to exclude. (2,3,4)
$exclude_members = array();

$request = $smcFunc['db_query']('', '
SELECT id_member
FROM {db_prefix}members
WHERE is_activated = {int:is_activated}' . (!empty($exclude_members) ? '
AND id_member NOT IN ({array_int:exclude_members})' : '') . '
ORDER BY RAND()
LIMIT 1',
array(
'is_activated' => 1,
'exclude_members' => $exclude_members,
)
);
list ($member) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);

if (empty($member))
return 'No members.';

loadMemberData($member);
loadMemberContext($member);

$member_info = $memberContext[$member];

if (empty($modSettings['MemberColorLinkInstalled']) && sp_loadColors($member) !== false)
$member_info['colored_link'] = '<strong><a href="' . $scripturl . '?action=profile;u=' . $member_info['id'] . '" title="' . $txt['profile_of'] . ' ' . $member_info['name'] . '">' . $color_profile[$member]['colored_name'] . '</a></strong>';

echo '
<div style="text-align: center; width: %99;">';

// Colored member link.
echo '
', $member_info['colored_link'], '<br />';

// Member title.
if (!empty($member_info['title']))
echo '
', $member_info['title'], '<br />';

// Member group.
if (!empty($member_info['group']))
echo '
', $member_info['group'], '<br />';
else
echo '
', $member_info['post_group'], '<br />';

// Group stars.
echo '
', $member_info['group_stars'], '<br />';

// Member avatar.
if (!empty($member_info['avatar']['image']))
echo '
<br />
', $member_info['avatar']['image'], '<br />';

// Personal text.
if (!empty($member_info['blurb']))
echo '
', $member_info['blurb'], '<br />';

// Online image.
echo '
<img src="', $member_info['online']['image_href'], '" alt="', $member_info['online']['text'], '" /> ', $member_info['online']['text'], '<br />';

// Gender name and image.
if (!empty($member_info['gender']['name']))
echo '
', $member_info['gender']['image'], ' ', $member_info['gender']['name'], '<br />';

echo '
<ul style="list-style-type: none; text-align: left; padding: 0px 0px 0px 5px;">';

// Post count.
echo '
<li><strong>', $txt['posts'], ':</strong> ', $member_info['posts'], '</li>';

// Location.
if (!empty($member_info['location']))
echo '
<li><strong>', $txt['location'], ':</strong> ', $member_info['location'], '</li>';

// Date registered.
echo '
<li><strong>', $txt['date_registered'], ':</strong> ', $member_info['registered'], '</li>';

// Last login.
echo '
<li><strong>', $txt['lastLoggedIn'], ':</strong> ', $member_info['last_login'], '</li>';

echo '
</ul>
</div>';

I've used seperate 'echo' for each data, so that you can move things as you wish.

An example of how it looks is attached.
And slowly, you come to realize... It's all as it should be...

Offline Dallape

  • Semi Newbie
  • *
  • Posts: 6
  • Gender: Male
  • SMF Version: 1.1.11
  • SP Version: 2.3.1
Re: Featured Member Block
« Reply #53 on: February 01, 2010, 08:32:49 PM »
Nice try Nabil. But you can fetch all the data with one query.

Here is my block codes:

For SMF 1.x:

Code: [Select]
global $db_prefix, $scripturl, $memberContext, $color_profile, $txt;

loadLanguage('Profile');

// Ids of users to exclude. (2,3,4)
$exclude_members = array();

$request = db_query("
SELECT ID_MEMBER
FROM {$db_prefix}members
WHERE is_activated = 1" . (!empty($exclude_members) ? "
AND ID_MEMBER NOT IN (" . implode(',', $exclude_members) . ")" : "") . "
ORDER BY RAND()
LIMIT 1", __FILE__, __LINE__);
list ($member) = mysql_fetch_row($request);
mysql_free_result($request);

if (empty($member))
return 'No members.';

loadMemberData($member);
loadMemberContext($member);

$member_info = $memberContext[$member];

if (empty($modSettings['MemberColorLinkInstalled']) && sp_loadColors($member) !== false)
$member_info['colored_link'] = '<strong><a href="' . $scripturl . '?action=profile;u=' . $member_info['id'] . '" title="' . $txt[92] . ' ' . $member_info['name'] . '">' . $color_profile[$member]['colored_name'] . '</a></strong>';

echo '
<div style="text-align: center; width: %99;">';

// Colored member link.
echo '
', $member_info['colored_link'], '<br />';

// Member title.
if (!empty($member_info['title']))
echo '
', $member_info['title'], '<br />';

// Member group.
if (!empty($member_info['group']))
echo '
', $member_info['group'], '<br />';
else
echo '
', $member_info['post_group'], '<br />';

// Group stars.
echo '
', $member_info['group_stars'], '<br />';

// Member avatar.
if (!empty($member_info['avatar']['image']))
echo '
<br />
', $member_info['avatar']['image'], '<br />';

// Personal text.
if (!empty($member_info['blurb']))
echo '
', $member_info['blurb'], '<br />';

// Online image.
echo '
<img src="', $member_info['online']['image_href'], '" alt="', $member_info['online']['text'], '" /> ', $member_info['online']['text'], '<br />';

// Gender name and image.
if (!empty($member_info['gender']['name']))
echo '
', $member_info['gender']['image'], ' ', $member_info['gender']['name'], '<br />';

echo '
<ul style="list-style-type: none; text-align: left; padding: 0px 0px 0px 5px;">';

// Post count.
echo '
<li><strong>', $txt[21], ':</strong> ', $member_info['posts'], '</li>';

// Location.
if (!empty($member_info['location']))
echo '
<li><strong>', $txt[227], ':</strong> ', $member_info['location'], '</li>';

// Date registered.
echo '
<li><strong>', $txt[233], ':</strong> ', $member_info['registered'], '</li>';

// Last login.
echo '
<li><strong>', $txt['lastLoggedIn'], ':</strong> ', $member_info['last_login'], '</li>';

echo '
</ul>
</div>';



This code is working. But showing random members. How do I choose which member will be displayed. For example I want to display members
http://mysite.net/index.php?action=profile;u=1
and
http://mysite.net/index.php?action=profile;u=127

???