News:

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

Main Menu

signature info stats [no more updates and support]

Started by sebastian, August 20, 2005, 10:42:12 PM

Previous topic - Next topic

brianjw

Are the images actually in those locations? If so, are they CHMODDED to 777?

sebastian



sebastian


Zeebra

Quote from: sebastian on November 03, 2008, 03:36:30 PM
...also...
QuoteI noticed that the online members is also counting guests, is there anyway to not have it count guests

Remove
$result = db_query("
SELECT COUNT(session)
FROM {$db_prefix}log_online", __FILE__, __LINE__);
list ($context['users_online']) = mysql_fetch_row($result);


Add
$result = db_query("
SELECT ID_MEMBER
FROM {$db_prefix}log_online", __FILE__, __LINE__);

    $context['users_online'] = 0;

while ($row = mysql_fetch_assoc($result))
{

    if (!empty($row['ID_MEMBER']))
{
$context['users_online']++;
continue;
}

}



Hi Sebastian ,

your code works great for the stats page.  If I wanted to not show guests on the main page under "Users Online" what would I need to change to accomplish that?

sebastian

Quote from: Zeebra on December 19, 2008, 02:36:05 PM
If I wanted to not show guests on the main page under "Users Online" what would I need to change to accomplish that?

Hi Zeebra,

Do you mean 'The main page' of your forum? If so...

Backup and open your_forum_path/Themes/Your_theme/BoardIndex.template.php

Find
echo '
', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', $context['num_guests'], ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ' . $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];


Replace
echo '
', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];

Zeebra

#186
Quote from: sebastian on December 22, 2008, 07:35:04 AM
Quote from: Zeebra on December 19, 2008, 02:36:05 PM
If I wanted to not show guests on the main page under "Users Online" what would I need to change to accomplish that?

Hi Zeebra,

Do you mean 'The main page' of your forum? If so...

Backup and open your_forum_path/Themes/Your_theme/BoardIndex.template.php

Find
echo '
', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', $context['num_guests'], ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ' . $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];


Replace
echo '
', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];


Thank you again Sebastian!  That works great on the main page of the forum.  One more instance.  When I click on the link for "x Users" on the main page it takes me to a "Who's Online" page "index.php?action=who"...that still lists Guests.  Where is the code to modify for that last page?

sebastian

Quote from: Zeebra on December 22, 2008, 10:55:59 AM
When I click on the link for "x Users" on the main page it takes me to a "Who's Online" page "index.php?action=who"...that still lists Guests.  Where is the code to modify for that last page?

Same file BoardIndex.template.php

Find
echo '
                  ', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];


Replace
echo '
', $context['show_who'] ? '' : '', $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];


Find
echo $context['show_who'] ? '</a>' : '', '
<div class="smalltext">';


Replace
echo $context['show_who'] ? '' : '', '
<div class="smalltext">';

Zeebra

Quote from: sebastian on December 23, 2008, 12:57:51 AM
Quote from: Zeebra on December 22, 2008, 10:55:59 AM
When I click on the link for "x Users" on the main page it takes me to a "Who's Online" page "index.php?action=who"...that still lists Guests.  Where is the code to modify for that last page?

Same file BoardIndex.template.php

Find
echo '
                  ', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];


Replace
echo '
', $context['show_who'] ? '' : '', $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];


Find
echo $context['show_who'] ? '</a>' : '', '
<div class="smalltext">';


Replace
echo $context['show_who'] ? '' : '', '
<div class="smalltext">';



I couldn't find the 2nd piece of code you listed.  I found instead:


if ($context['show_who'])
echo '</a>';

echo '
<div class="smalltext">';


and I tried replacing it with your code but I still see "Guests" in the "Who's Online" section?

sebastian

Quote from: Zeebra on December 23, 2008, 10:45:21 AM
and I tried replacing it with your code but I still see "Guests" in the "Who's Online" section?

OK I understood now.
Backup and open your_forum_path/Themes/Your_theme/Who.template.php

Find
if (!$member['is_guest'])
{
echo '
<div style="float: right; width: 14ex;">
', $context['can_send_pm'] ? '<a href="' . $member['online']['href'] . '" title="' . $member['online']['label'] . '">' : '', $settings['use_image_buttons'] ? '<img src="' . $member['online']['image_href'] . '" alt="' . $member['online']['text'] . '" align="middle" />' : $member['online']['text'], $context['can_send_pm'] ? '</a>' : '', '
', $member['icq']['link'], ' ', $member['msn']['link'], ' ', $member['yim']['link'], ' ', $member['aim']['link'], '
</div>';
}

echo '
<span', $member['is_hidden'] ? ' style="font-style: italic;"' : '', '>', $member['is_guest'] ? $member['name'] : '<a href="' . $member['href'] . '" title="' . $txt[92] . ' ' . $member['name'] . '"' . (empty($member['color']) ? '' : ' style="color: ' . $member['color'] . '"') . '>' . $member['name'] . '</a>', '</span>';

if (!empty($member['ip']))
echo '
(<a href="' . $scripturl . '?action=trackip;searchip=' . $member['ip'] . '" target="_blank">' . $member['ip'] . '</a>)';

echo '
</td>
<td nowrap="nowrap">', $member['time'], '</td>
<td>', $member['action'], '</td>
</tr>';


Replace
if (!$member['is_guest'])
{
echo '
<div style="float: right; width: 14ex;">
', $context['can_send_pm'] ? '<a href="' . $member['online']['href'] . '" title="' . $member['online']['label'] . '">' : '', $settings['use_image_buttons'] ? '<img src="' . $member['online']['image_href'] . '" alt="' . $member['online']['text'] . '" align="middle" />' : $member['online']['text'], $context['can_send_pm'] ? '</a>' : '', '
', $member['icq']['link'], ' ', $member['msn']['link'], ' ', $member['yim']['link'], ' ', $member['aim']['link'], '
</div>';


echo '
<span', $member['is_hidden'] ? ' style="font-style: italic;"' : '', '>', $member['is_guest'] ? '' : '<a href="' . $member['href'] . '" title="' . $txt[92] . ' ' . $member['name'] . '"' . (empty($member['color']) ? '' : ' style="color: ' . $member['color'] . '"') . '>' . $member['name'] . '</a>', '</span>';

if (!empty($member['ip']))
echo '
(<a href="' . $scripturl . '?action=trackip;searchip=' . $member['ip'] . '" target="_blank">' . $member['ip'] . '</a>)';
       
echo '
</td>
<td nowrap="nowrap">', $member['time'], '</td>
<td>', $member['action'], '</td>';
}

echo '</tr>';

Zeebra

Thank you Sebastian!!!  You are a God-send...that was perfect!

haito

hello...
i like this...
but when i used this, each i modified post or post somehing always appeared ""Session verification failed. Please try logging out and back in again, and then try again. ""

so when i removed sign.php, i can modify and post again...
any sollution? i still want to use signature info stats
www.japanesia.co.id | Portal Berita & Komunitas Untuk Kamu yang Suka Jepang

Dzonny

Can this work with smf 1.1.8?
I tried but dont know where to add code from step 3? :/
When i try to browse signature_info.php it says:
QuoteThe image "http://www.samo-opusteno.info/forum/signature_info.php" cannot be displayed, because it contains errors.

allenz

Hi,
Thanks for sharing the  lovely signature codes , indeed one..................... :)

agbattery

Great coding thanks for the help
OEM hxxp:www.accessorygenie.com/batteries-c-1.html [nonactive], hxxp:www.accessorygenie.com/battery-chargers-c-2.html [nonactive], hxxp:www.accessorygenie.com/ac-adapters-c-3.html [nonactive], hxxp:www.accessorygenie.com/memory-cards-c-4.html [nonactive], hxxp:www.accessorygenie.com/gps-c-102.html [nonactive], hxxp:www.accessorygenie.com/radar-detectors-c-103.html [nonactive], and other hxxp:www.accessorygenie.com [nonactive]

kizko

Hi, i have some custom profiles made by this mod: http://custom.simplemachines.org/mods/index.php?mod=319

How can i add: Avatar, username, and thoose custom fields to my signature ?
What i have to create, sorry, my english is a little bit bad. I want to tell me please the steps again to make that what i asked.

MiXailo

SMF: 2.0.6
Problem: I found some code on page 6 in this topic and I do everything that need and it won't works!!
<?php

if (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(
dirname(__FILE__) . '/SSI.php');
}
else die();

getinfos();
signature();

function 
getinfos()
{
global 
$smcFunc$context$memberContext;

$mommy '';

if (
$_GET['u'] >= 1)
    
$id_mem = isset($_GET['u']) ? (int) $_GET['u'] : die();
else die();

    
$result $smcFunc['db_query']('''
        SELECT member_name
        FROM {db_prefix}members
        WHERE id_member = '
. (int) $id_mem.' AND is_activated = 1
        LIMIT 1
        '
,
        array()
    );

     if (
$smcFunc['db_fetch_row']($result) > 0)  
{

 
$mprofile[] = (int) $id_mem;

loadMemberData($mprofilefalse'profile');

foreach (
$mprofile as $profile)
{
loadMemberContext($profile);


$context['item_comms'] = array();

$context['item_comms'][] = array(
    
'lbuser' => $memberContext[$id_mem]
);

foreach (
$context['item_comms'] as $item_comm)
    {
$context['membername'] = $item_comm['lbuser']['name'];
$context['posts'] = $item_comm['lbuser']['posts'];
$context['gender'] = $item_comm['lbuser']['gender']['image'];
$context['karmaBad'] = $item_comm['lbuser']['karma']['bad'];
$context['karmaGood'] = $item_comm['lbuser']['karma']['good'];
$context['avatar'] = $item_comm['lbuser']['avatar']['href'];
    }

} else die();

if (!empty(
$context['avatar']))
  {
  
$mommy = !empty($context['avatar']) ? $context['avatar'] : ''
  
$mommy preg_split('/;/',$mommy, -1PREG_SPLIT_OFFSET_CAPTURE);
  
$mommy $mommy [1][0];
  
$mommy trim(substr(strrchr($mommy'='), 1));

$result2 $smcFunc['db_query']('','
SELECT filename
FROM {db_prefix}attachments
WHERE id_attach = ' 
. (int) $mommy ' AND attachment_type = 0 AND approved = 1
LIMIT 1'
,
array()
);

list(
$count_result) = $smcFunc['db_fetch_row']($result2);

   
$context['filename_avatar'] = $count_result;
   
$smcFunc['db_free_result']($result2);
      
  }
  
  
$smcFunc['db_free_result']($result);
 }
 

function 
signature()
{
global 
$context$settings$modSettings;

$lemo '';
$img_url $settings['default_theme_url']; 

$membername $context['membername'];
$posts $context['posts'];

    if (!empty(
$context['filename_avatar'])) 
     {
       
$lemo $context['filename_avatar'];
     }
    else {
       
$lemo '';
     } 

$avatar $context['avatar'];
$gender $context['gender'];

if (
preg_match'/Male/'$gender))
{
    
$gender "male";
$img_gender "$img_url/images/Male.gif";

elseif (
preg_match'/Female/'$gender)) {
    
$gender "female";
    
$img_gender "$img_url/images/Female.gif"; }
else {
$gender "n/a"$img_gender "$img_url/images/star.gif";}

$karmaBad $context['karmaBad'];
$karmaGood $context['karmaGood'];   
if (
$modSettings['karmaMode'] == '1'

$karma $karmaGood $karmaBad;
} elseif (
$modSettings['karmaMode'] == '2')
{
$karma '+'.$karmaGood.' / '.'-'.$karmaBad;
} elseif (
$modSettings['karmaMode'] == '0'
{
$karma 'n/a';
}
// Your settings +++++++++++++++++++++++++++++++++++ 
$backimg "$img_url/images/sign.png"// or where you want 
$noavatar "$img_url/images/noavatar.png"// or where you want
$set_avatar_height 0//move avatar up/down
$set_avatar_width 0//move avatar left/right
$set_gender_style 0// 0 text , 1 image
$set_gender_height = -92//move gender up/down
$set_gender_width = -230//move gender left/right
// Your settings +++++++++++++++++++++++++++++++++++

if (!empty($avatar)) {$avatar $avatar;}
else {
$avatar $noavatar;}

if (!empty(
$lemo)) { $ext substr(strrchr($lemo'.'), 1); }
else {
$ext substr(strrchr($avatar'.'), 1);}

unset(
$lemo);

if (
$ext == 'png') {$img_bgr imagecreatefrompng($avatar); }
elseif (
$ext == 'jpg') {$img_bgr imagecreatefromjpeg($avatar); }
elseif (
$ext == 'gif') {$img_bgr imagecreatefromgif($avatar); }
else die();

$size getimagesize($backimg);

if (
$set_gender_style == 1) {
$img_bgr_gender imagecreatefromgif($img_gender);
$image_width_gender imagesx($img_bgr_gender);  
$image_height_gender imagesy($img_bgr_gender);
$dest_x_gender $size[0] - $image_width_gender $set_gender_width;  
$dest_y_gender $size[1] - $image_height_gender $set_gender_height;
}

$image_width imagesx($img_bgr);  
$image_height imagesy($img_bgr);

//______________avatar  width & height must be <=106
if ($image_width <=106 && $image_width >=10 && $image_height <=106 && $image_height >=10)
  {
$set_avatar_width =  $set_avatar_width + (($image_width 101) * 0.35);
$set_avatar_height =  $set_avatar_height + (($image_height 101) * 0.35);
 }
else { die();}

$image imagecreatetruecolor($image_width$image_height); 
$image imagecreatefrompng($backimg);  

$dest_x $size[0] - $image_width $set_avatar_width;  
$dest_y $size[1] - $image_height $set_avatar_height
imagecopymerge($image$img_bgr,  $dest_x$dest_y00$image_width$image_height100);
if (
$set_gender_style == 1) {
imagecopymerge($image$img_bgr_gender,  $dest_x_gender$dest_y_gender00$image_width_gender$image_height_gender100);
}
 
$green ImageColorAllocate ($image2312417); 
$blue ImageColorAllocate ($image00255); 
$red ImageColorAllocate ($image25500);
$white ImageColorAllocate ($image255255255);
$black ImageColorAllocate ($image000);

ImageString($image42035"Postova: $posts"$black);
ImageString($image42051"Karma: $karma"$black);
if (
$set_gender_style == 0) {
ImageString($image5314"$membername"$black);
ImageString($image42066"Pol: $gender"$black);
} else {
ImageString($image5444"$membername"$black);}

header("Content-Type: image/png"); 

$php PHP_VERSION
if (@
version_compare(PHP_VERSION'5.1.0'">="))
  {
  
// if PHP v5.1 ++
Imagepng($image,null,9,null); 
  }
else {
Imagepng($image,null,90,null); 
  }    
ImageDestroy ($image);
ImageDestroy ($img_bgr);  
}


?>

I have uploaded file sign.php in public_html where is my forum (up code)
I made some photos in photoshop
I'm uploaded this to Themes/default/images I named this as noavatar.png
and this I'm uploaded to Themes/default/images I named this as sign.png
When I put this in signature area shows this
I used this code
[img]http://www.gti-roleplay.net/sign.php?u=1[/img]
Sorry for bad English!

MoreBloodWine

I still use this quite successully for a few forums, and even adapted it to display some of my user stats on a bitcoin mining site.

However, why I am here today, even though support is stated as no longer offered is just to see if anyone can tell me how to make, if possible, one of the text strings underlined... Ty.
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Arantor

imageline() will be your friend. You will have to draw the underline in yourself since imagestring() has no function for it.

MoreBloodWine

#199
Quote from: Sir Cumber-Patcher on January 28, 2014, 06:48:14 PM
imageline() will be your friend. You will have to draw the underline in yourself since imagestring() has no function for it.
I hate to ask because support on this is no longer offered and all I originally asked for was an idea but I looked at the imageline() php manual and got a little lose, could you maybe please help me with this one small thing ?

REMOVED

This is the line I want underlined using the same color variable.

ImageString($im, 3, 47, 40, "BTC-Guild User: MoreBloodWine", $lightblue);
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Advertisement: