SimplePortal
Customization => Custom Coding => Topic started by: cafenubia 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?
-
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. ;)
-
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
-
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.
-
That would be interesting.... I like the idea of the featured member block.
-
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) :)
-
in for updates
-
No, i currently work on the block system. So i think i can create something special for this, but thats something for later. :whistle:.
-
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.
-
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:
<?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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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>";
?>
-
Nabil that code worked GREAT! ;D
I now have it displayed on my site.
if it started with their avatar it would be perfect
-
Updated , With Avatars in the Attachments Folder
<?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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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>";
?>
-
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 ;)
-
I also prefer the Avatar at the top not the bottom,
you code is easy read and I did it. ;D
<?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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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
-
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 :
<?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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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 :
<?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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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>";
?>
-
you read my mind... I was already thinking on #2's style :D
-
Are all Avatars seen , or are there some not seen ?
-
the ones that:
do not upload a avatar and do select a avatar from the forum..
are not shown :(
-
This Code would solve that Avatar problem .
Not Tested when the user uses an external url link to his Avatar
<?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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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>";
?>
-
perfect!
but you are correct, external linked avatar's dont show
thanks for the good work ;D
-
ok , I'm gonna make an update to solve that external links avatar problem
-
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 ?
-
I changed my avatar to a link to a image from my other web page...
it does not show
-
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?
-
I seeeeeeeeeeeeeeeeeeeeeee , you have not checked this thats why , see the photo
ok I will make an update
-
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
-
So this Code will solve all Avatars problems :
<?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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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>";
?>
-
Perfect!
if some one wants this with the avatar on top use this one
<?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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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!
-
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.
-
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?
-
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?
-
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
-
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.
-
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
-
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.
-
I talked to Nabil about my attempt at adding code...
here is what we came up with
<?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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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.
-
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.
-
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
-
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?
-
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
-
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.
-
by the way , to let the Gender symbol to be displayed
find :
if ($gender!=''){ echo "<b>Gender:</b> ".$gender1."<br>"; };
replace with
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
-
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 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
<?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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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($ask, MYSQL_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>";
?>
-
Excellent. I also think the avatar should also be a link to the members profile. As well as the useron icon (http://simpleportal.net/Themes/novelty11/images/useron.gif) 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
-
8) Thank you for your work.
-
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
-
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 .
-
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
-
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.
-
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)
-
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.
-
Nice try Nabil. But you can fetch all the data with one query.
Here is my block codes:
For SMF 1.x:
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:
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.
-
Nice try Nabil. But you can fetch all the data with one query.
Here is my block codes:
For SMF 1.x:
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
???