Main Menu
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 log in.

Who's Online

  • Dot Guests: 884
  • Dot Hidden: 0
  • Dot Users: 1
  • Dot Users Online:

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]


NEED HELP? If you're looking for support with Simple Portal, look no further than the Support Board!

Featured Member Block

Started by cafenubia, October 13, 2008, 10:46:02 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

hot rides

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.

Nabil

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


darkon

I think there is one thing missing....

This block doesn

Nabil

Quote
I think there is one thing missing....

This block doesn

bmac

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

darkon


dougsbrat

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

Nabil

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 .

dougsbrat

Quote from: Nabil 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 .

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

bmac

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.

Nabil

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)

jb3398

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.

[SiNaN]

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.
And slowly, you come to realize... It's all as it should be...

Dallape

Quote from: [SiNaN] 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:

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

???