News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

How to show Avatar Member of the Day and Top Post user

Started by ittiphol, May 14, 2015, 07:23:46 AM

Previous topic - Next topic

ittiphol

How to show Avatar Member of the Day and Top Post user

Thank you master..

Kindred

How is the "top member of the day" chosen?
Where do you want to show this information?
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

ittiphol

Quote from: Kindred on May 14, 2015, 07:39:44 AM
How is the "top member of the day" chosen?
Where do you want to show this information?

i want to show in first page (Index)

<?php ssi_randomMember('day'); ?>
<?php ssi_topPoster(); ?>

it's show only name member


Kindred

and is that code in a portal block?

but yes, you are right...  by default, the SSI functions just display the username/ID....
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

ittiphol

Quote from: Kindred on May 14, 2015, 08:32:57 AM
and is that code in a portal block?

but yes, you are right...  by default, the SSI functions just display the username/ID....

Yes... how to?


Gluz

For a portal block I got something similar, so modified to your needs looks something like this:
(it's a PHP Block of Simple Portal, that by default load SSI.php so it's not required, idk other portals behavior)
Code (PHP Block of Simple Portal) Select
$top = ssi_topPoster(1, 'array');
$topData = ssi_fetchMember($top[0]['id'], 'array');
$day = ssi_randomMember('day', 'array');
$key = array_keys($day);

echo 'Member of the Day:<br/>';
echo '<a href="', $day[$key[0]]['href'], '">', $day[$key[0]]['avatar']['image'], '<br/>', $day[$key[0]]['name'], '</a>';
echo '<br/><br/>';
echo 'Top Poster:<br/>';
echo '<a href="', $topData[$top[0]['id']]['href'], '">', $topData[$top[0]['id']]['avatar']['image'], '<br/>', $topData[$top[0]['id']]['name'], '</a>';


If you know a little of HTML then you can modify the way it looks.

ittiphol

Quote from: Gluz on May 15, 2015, 04:43:14 PM
For a portal block I got something similar, so modified to your needs looks something like this:
(it's a PHP Block of Simple Portal, that by default load SSI.php so it's not required, idk other portals behavior)
Code (PHP Block of Simple Portal) Select
$top = ssi_topPoster(1, 'array');
$topData = ssi_fetchMember($top[0]['id'], 'array');
$day = ssi_randomMember('day', 'array');
$key = array_keys($day);

echo 'Member of the Day:<br/>';
echo '<a href="', $day[$key[0]]['href'], '">', $day[$key[0]]['avatar']['image'], '<br/>', $day[$key[0]]['name'], '</a>';
echo '<br/><br/>';
echo 'Top Poster:<br/>';
echo '<a href="', $topData[$top[0]['id']]['href'], '">', $topData[$top[0]['id']]['avatar']['image'], '<br/>', $topData[$top[0]['id']]['name'], '</a>';


If you know a little of HTML then you can modify the way it looks.

thank you very much
how to modify in "index.template" i try it's error

Gluz

Maybe I misunderstood, I think you have a Portal installed and you wanted to show that in a custom Portal Block, if you want to insert the code into index.template.pgp first you nedd to tell where exactly do you want that code to be showed?

ittiphol

Quote from: Gluz on May 16, 2015, 04:52:47 AM
Maybe I misunderstood, I think you have a Portal installed and you wanted to show that in a custom Portal Block, if you want to insert the code into index.template.pgp first you nedd to tell where exactly do you want that code to be showed?

i want to show on index.template.php not portal block
show on first page

thank you  :-[

Gluz

First page is not a specific place, for that we need to know the Theme you're using in the first place.

Then if you can, add an image showing where do you want the Avatars showing up.

For placing in the index.template I don't know if there are functions in the core files to bring that data(Member of the Day and Top Poster), as I only know that functions from SSI.

ittiphol

yes my first page is index.template.php how to coding in the index.template.php  :'(

Advertisement: