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: 369
  • 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 22216 times)

0 Members and 1 Guest are viewing this topic.

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

???