TinyPortal

Development => Block Codes => Topic started by: alhaudhie on October 10, 2009, 06:26:58 PM

Title: Adding Ghost Member
Post by: alhaudhie on October 10, 2009, 06:26:58 PM
Link Related: http://www.simplemachines.org/community/index.php?topic=337319.0
                    http://custom.simplemachines.org/mods/index.php?mod=2128
How can we add ghost member in user online block?
Title: Re: Adding Ghost Member
Post by: G6Cad on October 10, 2009, 06:33:54 PM
TP uses the database calls from SMF so if you have ghost users in your SMF online list, they should also show up in the block for tps stats block

I might understand you wrong, but with the info you gave this is the only answer i can give until you explain more what your asking us about.

Also, Please read the Posting Guidelines.html (http://www.tinyportal.net/index.php/topic,581)
Title: Re: Adding Ghost Member
Post by: jebong on October 10, 2009, 06:39:38 PM
related to the package parser for that mod.. we must adding

    if (!(empty($modSettings['ghost_total_members'])))
echo '
', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', $context['num_guests'], ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', $ghostmember = ($context['num_guests'] + $modSettings['ghost_total_members']), ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'], ' ';
      else
      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'], ' ';



and

// Begin Ghost Members
if (!empty($modSettings['allow_ghost']))
{

if (!empty($modSettings['ghost_mem_1']))
echo ',&nbsp;<a href="', $scripturl, '?action=profile;u=', $modSettings['ghost_pro_1'], '">', $modSettings['ghost_mem_1'], '</a>';
if (!empty($modSettings['ghost_mem_2']))
echo ',<a href="', $scripturl, '?action=profile;u=', $modSettings['ghost_pro_2'], '"> ', $modSettings['ghost_mem_2'], '</a>';
if (!empty($modSettings['ghost_mem_3']))
echo ',<a href="', $scripturl, '?action=profile;u=', $modSettings['ghost_pro_3'], '"> ', $modSettings['ghost_mem_3'], '</a>';
if (!empty($modSettings['ghost_mem_4']))
echo ',<a href="', $scripturl, '?action=profile;u=', $modSettings['ghost_pro_4'], '"> ', $modSettings['ghost_mem_4'], '</a>';
if (!empty($modSettings['ghost_mem_5']))
echo ',<a href="', $scripturl, '?action=profile;u=', $modSettings['ghost_pro_5'], '"> ', $modSettings['ghost_mem_5'], '</a>';
if (!empty($modSettings['ghost_mem_6']))
echo ',<a href="', $scripturl, '?action=profile;u=', $modSettings['ghost_pro_6'], '"> ', $modSettings['ghost_mem_6'], '</a>';
if (!empty($modSettings['ghost_mem_7']))
echo ',<a href="', $scripturl, '?action=profile;u=', $modSettings['ghost_pro_7'], '"> ', $modSettings['ghost_mem_7'], '</a>';
if (!empty($modSettings['ghost_mem_8']))
echo ',<a href="', $scripturl, '?action=profile;u=', $modSettings['ghost_pro_8'], '"> ', $modSettings['ghost_mem_8'], '</a>';
if (!empty($modSettings['ghost_mem_9']))
echo ',<a href="', $scripturl, '?action=profile;u=', $modSettings['ghost_pro_9'], '"> ', $modSettings['ghost_mem_9'], '</a>';
if (!empty($modSettings['ghost_mem_10']))
echo ',<a href="', $scripturl, '?action=profile;u=', $modSettings['ghost_pro_10'], '"> ', $modSettings['ghost_mem_10'], '</a>';
if (!empty($modSettings['ghost_mem_11']))
echo ',<a href="', $scripturl, '?action=profile;u=', $modSettings['ghost_pro_11'], '"> ', $modSettings['ghost_mem_11'], '</a>';
if (!empty($modSettings['ghost_mem_12']))
echo ',<a href="', $scripturl, '?action=profile;u=', $modSettings['ghost_pro_12'], '"> ', $modSettings['ghost_mem_12'], '</a>';
if (!empty($modSettings['ghost_mem_13']))
echo ',<a href="', $scripturl, '?action=profile;u=', $modSettings['ghost_pro_13'], '"> ', $modSettings['ghost_mem_13'], '</a>';
if (!empty($modSettings['ghost_mem_14']))
echo ',<a href="', $scripturl, '?action=profile;u=', $modSettings['ghost_pro_14'], '"> ', $modSettings['ghost_mem_14'], '</a>';
if (!empty($modSettings['ghost_mem_15']))
echo ',<a href="', $scripturl, '?action=profile;u=', $modSettings['ghost_pro_15'], '"> ', $modSettings['ghost_mem_15'], '</a>';
if (!empty($modSettings['ghost_mem_16']))
echo ',<a href="', $scripturl, '?action=profile;u=', $modSettings['ghost_pro_16'], '"> ', $modSettings['ghost_mem_16'], '</a>';
if (!empty($modSettings['ghost_mem_17']))
echo ',<a href="', $scripturl, '?action=profile;u=', $modSettings['ghost_pro_17'], '"> ', $modSettings['ghost_mem_17'], '</a>';
if (!empty($modSettings['ghost_mem_18']))
echo ',<a href="', $scripturl, '?action=profile;u=', $modSettings['ghost_pro_18'], '"> ', $modSettings['ghost_mem_18'], '</a>';
if (!empty($modSettings['ghost_mem_19']))
echo ',<a href="', $scripturl, '?action=profile;u=', $modSettings['ghost_pro_19'], '"> ', $modSettings['ghost_mem_19'], '</a>';
if (!empty($modSettings['ghost_mem_20']))
echo ',<a href="', $scripturl, '?action=profile;u=', $modSettings['ghost_pro_20'], '"> ', $modSettings['ghost_mem_20'], '</a>';
}
// End Ghost Members


in the boardindex.template.php
............................................

thats why i think we must change some tp file...
Title: Re: Adding Ghost Member
Post by: ZarPrime on October 11, 2009, 02:40:50 PM
There shouldn't be any TP files that need to be changed for this to work.  After the install in the default theme, the only file that might need to be edited is the ./Themes/custom_theme/BoardIndex.template.php if there is one.

It sounds like a nice Mod and it may be something I'll look at using but not until the author has edited it to allow the Ghost members profiles to show up when someone wants to look at them.

ZarPrime
Title: Re: Adding Ghost Member
Post by: alhaudhie on October 17, 2009, 02:22:01 PM
Quote from: ZarPrime on October 11, 2009, 02:40:50 PM
There shouldn't be any TP files that need to be changed for this to work.  After the install in the default theme, the only file that might need to be edited is the ./Themes/custom_theme/BoardIndex.template.php if there is one.

It sounds like a nice Mod and it may be something I'll look at using but not until the author has edited it to allow the Ghost members profiles to show up when someone wants to look at them.

ZarPrime
i have tried it.. but cant be done.. can we add in ssi_whosOnline in ssi.php file?
Title: Re: Adding Ghost Member
Post by: alhaudhie on December 16, 2009, 03:16:00 PM
hope anybody can help for this...
Title: Re: Adding Ghost Member
Post by: JPDeni on December 16, 2009, 05:04:59 PM
Do you need the ssi_whosOnline function? Put this into the SSI.php file.


// Shows a list of online users:  YY Guests, ZZ Users and then a list...
function ssi_whosOnline($output_method = 'echo')
{
global $scripturl, $db_prefix, $user_info, $txt;

// Load the users online right now.
$result = db_query("
SELECT
lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline,
mg.onlineColor, mg.ID_GROUP
FROM {$db_prefix}log_online AS lo
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))", __FILE__, __LINE__);

$return['users'] = array();
$return['guests'] = 0;
$return['hidden'] = 0;
$return['buddies'] = 0;
$show_buddies = !empty($user_info['buddies']);

while ($row = mysql_fetch_assoc($result))
{
if (!isset($row['realName']))
$return['guests']++;
elseif (!empty($row['showOnline']) || allowedTo('moderate_forum'))
{
// Some basic color coding...
if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" class="' . $row['onlineColor'] . '">' . $row['realName'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';

// Bold any buddies.
if ($show_buddies && in_array($row['ID_MEMBER'], $user_info['buddies']))
{
$return['buddies']++;
$link = '<b>' . $link . '</b>';
}

$return['users'][$row['logTime'] . $row['memberName']] = array(
'id' => $row['ID_MEMBER'],
'username' => $row['memberName'],
'name' => $row['realName'],
'group' => $row['ID_GROUP'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => $link,
'hidden' => empty($row['showOnline']),
'is_last' => false,
);
}
else
$return['hidden']++;
}
mysql_free_result($result);

if (!empty($return['users']))
{
krsort($return['users']);
$userlist = array_keys($return['users']);
$return['users'][$userlist[count($userlist) - 1]]['is_last'] = true;
}
$return['num_users'] = count($return['users']) + $return['hidden'];
$return['total_users'] = $return['num_users'] + $return['guests'];

if ($output_method != 'echo')
return $return;

echo '
', $return['guests'], ' ', $return['guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', $return['num_users'], ' ', $return['num_users'] == 1 ? $txt['user'] : $txt['users'];

// Hidden users, or buddies?
if ($return['hidden'] > 0 || $show_buddies)
echo '
(' . ($show_buddies ? ($return['buddies'] . ' ' . ($return['buddies'] == 1 ? $txt['buddy'] : $txt['buddies'])) : '') . ($show_buddies && $return['hidden'] ? ', ' : '') . (!$return['hidden'] ? '' : $return['hidden'] . ' ' . $txt['hidden']) . ')';

echo '<br />';
foreach ($return['users'] as $user)
echo $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'], $user['is_last'] ? '' : ', ';
}
Title: Re: Adding Ghost Member
Post by: alhaudhie on December 16, 2009, 05:41:30 PM
Quote from: JPDeni on December 16, 2009, 05:04:59 PM
Do you need the ssi_whosOnline function? Put this into the SSI.php file.


// Shows a list of online users:  YY Guests, ZZ Users and then a list...
function ssi_whosOnline($output_method = 'echo')
{
global $scripturl, $db_prefix, $user_info, $txt;

// Load the users online right now.
$result = db_query("
SELECT
lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline,
mg.onlineColor, mg.ID_GROUP
FROM {$db_prefix}log_online AS lo
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))", __FILE__, __LINE__);

$return['users'] = array();
$return['guests'] = 0;
$return['hidden'] = 0;
$return['buddies'] = 0;
$show_buddies = !empty($user_info['buddies']);

while ($row = mysql_fetch_assoc($result))
{
if (!isset($row['realName']))
$return['guests']++;
elseif (!empty($row['showOnline']) || allowedTo('moderate_forum'))
{
// Some basic color coding...
if (!empty($row['onlineColor']))
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '" class="' . $row['onlineColor'] . '">' . $row['realName'] . '</a>';
else
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>';

// Bold any buddies.
if ($show_buddies && in_array($row['ID_MEMBER'], $user_info['buddies']))
{
$return['buddies']++;
$link = '<b>' . $link . '</b>';
}

$return['users'][$row['logTime'] . $row['memberName']] = array(
'id' => $row['ID_MEMBER'],
'username' => $row['memberName'],
'name' => $row['realName'],
'group' => $row['ID_GROUP'],
'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'],
'link' => $link,
'hidden' => empty($row['showOnline']),
'is_last' => false,
);
}
else
$return['hidden']++;
}
mysql_free_result($result);

if (!empty($return['users']))
{
krsort($return['users']);
$userlist = array_keys($return['users']);
$return['users'][$userlist[count($userlist) - 1]]['is_last'] = true;
}
$return['num_users'] = count($return['users']) + $return['hidden'];
$return['total_users'] = $return['num_users'] + $return['guests'];

if ($output_method != 'echo')
return $return;

echo '
', $return['guests'], ' ', $return['guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ', $return['num_users'], ' ', $return['num_users'] == 1 ? $txt['user'] : $txt['users'];

// Hidden users, or buddies?
if ($return['hidden'] > 0 || $show_buddies)
echo '
(' . ($show_buddies ? ($return['buddies'] . ' ' . ($return['buddies'] == 1 ? $txt['buddy'] : $txt['buddies'])) : '') . ($show_buddies && $return['hidden'] ? ', ' : '') . (!$return['hidden'] ? '' : $return['hidden'] . ' ' . $txt['hidden']) . ')';

echo '<br />';
foreach ($return['users'] as $user)
echo $user['hidden'] ? '<i>' . $user['link'] . '</i>' : $user['link'], $user['is_last'] ? '' : ', ';
}


yes.. because i want to show ghost in tp online users.. i will try it.. tq
Title: Re: Adding Ghost Member
Post by: alhaudhie on December 16, 2009, 06:04:10 PM
i cant see any code for Ghost in your ssi.php...

related: http://custom.simplemachines.org/mods/index.php?mod=2128
Title: Re: Adding Ghost Member
Post by: JPDeni on December 16, 2009, 07:08:14 PM
I don't know what Ghost members even are. (People who have died but still log in?) I just saw your question

Quote
can we add in ssi_whosOnline in ssi.php file?

and answered it. Someone who has a clue about Ghost Members (in the sky-y) will have to go further.
Title: Re: Adding Ghost Member
Post by: ZarPrime on December 18, 2009, 12:51:34 AM
Quote from: JPDeni on December 16, 2009, 07:08:14 PM
I don't know what Ghost members even are. (People who have died but still log in?)

ROFLMAO  :2funny: :2funny: <Ha Ha> I read this post last night and I'm still laughing as much as I did when I first read it.  Good one JPD.  :2funny: :2funny: :2funny:

This Ghost Members is from a Mod that someone did on SMF which lists "Ghost Members" in the Forum Info Center, but the function doesn't work for <?php ssi_whosOnline(); ?>, thus it won't work in a TP block.

Mrcare, I already asked this question on the SMF site over 2 months ago without an answer from the Mod author ...
http://www.simplemachines.org/community/index.php?topic=337319.msg2306411#msg2306411

Since this is the only way I can see to put it into a TP block, I suggest that you keep pestering the Mod Author about it since it's not a normal function of the Mod.  He will have to tell you what to do.

ZarPrime
Title: Re: Adding Ghost Member
Post by: JPDeni on December 18, 2009, 01:44:20 AM
I'm glad I made you laugh, ZP, but I still don't get what it is. I looked at the mod, which didn't explain it, and I looked at the topic, but it was unclear. One post seemed to say it displayed the login name instead of the preferred display name for selected people. Another post seemed to indicate that it was non-existent members in order to trick real people into thinking that there are more members than there really are.

If I could figure out what Ghost Members are, I might be able to write code for it.
Title: Re: Adding Ghost Member
Post by: ZarPrime on December 18, 2009, 01:58:14 AM
 ;D I think it's the second one, fake members who aren't really members.  I installed it on my SMF 2 site and tried it out.  It seems pretty useless to me actually.  I could see no way to display the Ghost Members if the Forum Admin wasn't logged into the site.  If it actually created a profile for the fake members and maybe allowed you to set a time of the day when the Ghost Members would display as being online, I could possibly see the usefulness of it.  I think I uninstalled it at this point.

ZarPrime
Title: Re: Adding Ghost Member
Post by: JPDeni on December 18, 2009, 05:24:12 AM
Okay. It does seem pretty useless.

Thanks. :D
Title: Re: Adding Ghost Member
Post by: WillyP on December 19, 2009, 02:57:25 PM
Do you really think having it appear more people online will make real people stay online and participate?

Not to crap on anyone's mod but you don't need fake people online, you need content! If you need help creating content, there are websites devoted to that, just look around the web and you will find plenty of free content you can copy/ paste to your forum for only a link back to the original.
Title: Re: Adding Ghost Member
Post by: Freddy on December 19, 2009, 03:18:19 PM
Well said WillyP, I agree.
Title: Re: Adding Ghost Member
Post by: Skhilled on December 19, 2009, 11:14:48 PM
There is no substitute for content. The web is all about reading what you see on a site. If there is nothing there or nothing interesting to read or no current news/updates then even the people you have there will end up leaving.

Check out other sites that have the same theme or subjects as you do. Search the industry for the latest topics, etc. Your website is a work in progress and you'll need the latest info to keep up.
Title: Re: Adding Ghost Member
Post by: MrCare on September 05, 2012, 12:22:26 AM
Still waiting for a long long time to make this reality...
Title: Re: Adding Ghost Member
Post by: ZarPrime on September 10, 2012, 05:51:32 AM
Still waiting on someone to tell me why anyone would want to try to fool their members into believing there are more members on their forum than there really is ...

Quote from: ZarPrime on November 29, 2010, 12:01:57 PM
QUBBAH,

FWIW, if you look back through that topic on SMF, you will see that I asked the same question a while back because I couldn't figure it out.  I was trying to do the same thing you were.  If I thought it was worth it, I could probably dig down deep into the code and figure out what he's doing with it but, in all honesty, the only reason for that Mod is to deceive your members into thinking there are more members on your site then there really is.  I gave up on it when the Mod author wouldn't respond.  I think that Mod Authors that don't respond to support requests should have their Mods removed until they decide to help the members but that's just my opinion.

The author should have designed this thing to work with an ssi call but obviously he didn't.

ZarPrime

I last looked at this nearly 2 years ago, and it still doesn't make any more sense to me now than it did then.

ZarPrime