4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: Stoleti on January 15, 2006, 02:55:33 AM
-
I've see it in some sites and this can be useful , if we have 2 who's online list , make the default on main page and another one in a new page with more info about users online:
Getting info from MOD's like (Member personal info,Gender/country,Age)...
make show rows with : Pic ($userpic) + Username , Country ($user_country), Gender ($user_gender) and more options for who have added more info at profiles :)
this is possible ??
Cheers :)
-
Could you give a specific example on this ?
-
here you've :)
-
And what if the USERS_TABLE contains several hundreds of users within ?
-
And what if the USERS_TABLE contains several hundreds of users within ?
they are talking about "who is online" page and not about "memberlist". Also, I see paging in the example, so even several hundreds online should not be a problem ;)
-
they are talking about "who is online" page and not about "memberlist".
This has already been assumed. What I meant is that all users accounts are in the USERS_TABLE and each pictures would need to be loaded at the same time.
Also, I see paging in the example, so even several hundreds online should not be a problem
Indeed. I saw it as well but just don't know how to proceed with paging rather than beginning with the : $get_paging = new paging(); from includes/sessions.php file. ;)
-
they are talking about "who is online" page and not about "memberlist".
This has already been assumed. What I meant is that all users accounts are in the USERS_TABLE and each pictures would need to be loaded at the same time.
Sorry, I dont understand your point..what is the problem with that? You dont need to load any pictures that are not supposed to be showed on the page...
-
Sorry, I dont understand your point..what is the problem with that? You dont need to load any pictures that are not supposed to be showed on the page...
No, of course not. Althought, what if several members are logged at the same already and the script has to load each pictures from these online users ? Wouldn't that use more ressources on the site ?
Since paging seems to be the solution, on how many pages could this be seperated (or globally configured from the configuration page - ' if ' this can also be done) ? ;)
-
No, of course not. Althought, what if several members are logged at the same already and the script has to load each pictures from these online users ? Wouldn't that use more ressources on the site ?
Well, do you see more then one the same username on home page? - no, same here.
-
I meant several different users at the same time. Right now, it is currently under a dropdown list (at least, from the default package). Meaning, if each pictures needs to be selected with the user account to know who's online ... won't it take more time to load (also depending of the size of active user accounts) ? ;)
-
yes this ill work liek default list, more in new page more detailed, getting info from users profiles :) (avatar,gender,etc...) ...
yes about time to load, number of user, i understnadwhat u mean ... but i can't give exactly number, important ill be work :) so users can check and get info from users online list. :)
-
but i can't give exactly number
Then perhaps you could state the max number of users ' per page ' you'd like to show ? ;)
-
yes :) same of pagging comments, make for example " 10 users " peer page :mrgreen:
-
Very well. 10 users per page sounds good enough. If no one else posts this, then I think it is time for me to try out the $get_paging class since I have never made a MOD with it before. ;)
-
Very well. 10 users per page sounds good enough. If no one else posts this, then I think it is time for me to try out the $get_paging class since I have never made a MOD with it before. ;)
Perfect :D
But this ill get info from users profiles (avatar {userpic} ; username, age, gender, country..etc ) ;) i hope u don't forget it :D
-
First, I will try to re-build what's from the screenshot. ;)
-
First, I will try to re-build what's from the screenshot. ;)
Yea , i totally agree :mrgreen: , first try make work the same from screenshot , and after modifications 8)
-
Ok, so let's try the very basic way first. If you do see the picture beside the username (in a most cheap way I must say "for now") then it means it's working perfectly (in case you wonder why the presentation might be a little funky for the first time).
Assuming you're using the original block of 4images from your includes/sessions.php file, make a backup of it first.
Then, find :
if (defined("GET_USER_ONLINE") && ($config['display_whosonline'] == 1 || $user_info['user_level'] == ADMIN)) {
$time_out = time() - 300;
$sql = "SELECT s.session_user_id, s.session_lastaction, s.session_ip".get_user_table_field(", u.", "user_id").get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_invisible")."
FROM ".SESSIONS_TABLE." s
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = s.session_user_id)
WHERE s.session_lastaction >= $time_out
ORDER BY ".get_user_table_field("u.", "user_id")." ASC, s.session_ip ASC";
$result = $site_db->query($sql);
while ($row = $site_db->fetch_array($result)) {
if ($row['session_user_id'] != GUEST && (isset($row['user_id']) && $row['user_id'] != GUEST)) {
if (!isset($prev_user_ids[$row['session_user_id']])) {
$is_invisible = (isset($row[$user_table_fields['user_invisible']]) && $row[$user_table_fields['user_invisible']] == 1) ? 1 : 0;
$invisibleuser = ($is_invisible) ? "*" : "";
$username = (isset($row[$user_table_fields['user_level']]) && $row[$user_table_fields['user_level']] == ADMIN && $config['highlight_admin'] == 1) ? sprintf("<b>%s</b>", $row[$user_table_fields['user_name']]) : $row[$user_table_fields['user_name']];
if (!$is_invisible || $user_info['user_level'] == ADMIN) {
$user_online_list .= ($user_online_list != "") ? ", " : "";
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $row['session_user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$row['session_user_id'];
$user_online_list .= "<a href=\"".$site_sess->url($user_profile_link)."\">".$username."</a>".$invisibleuser;
}
(!$is_invisible) ? $num_visible_online++ : $num_invisible_online++;
$num_registered_online++;
}
$prev_user_ids[$row['session_user_id']] = 1;
}
else {
if (!isset($prev_session_ips[$row['session_ip']])) {
$num_guests_online++;
}
}
$prev_session_ips[$row['session_ip']] = 1;
}
$num_total_online = $num_registered_online + $num_guests_online;
//$num_invisible_online = $num_registered_online - $num_visible_online;
$site_template->register_vars(array(
"num_total_online" => $num_total_online,
"num_invisible_online" => $num_invisible_online,
"num_registered_online" => $num_registered_online,
"num_guests_online" => $num_guests_online,
"user_online_list" => $user_online_list
));
$whos_online = $site_template->parse_template("whos_online");
$site_template->register_vars("whos_online", $whos_online);
unset($whos_online);
unset($prev_user_ids);
unset($prev_session_ips);
}
replace with :
if (defined("GET_USER_ONLINE") && ($config['display_whosonline'] == 1 || $user_info['user_level'] == ADMIN)) {
$time_out = time() - 300;
$sql = "SELECT s.session_user_id, s.session_lastaction, s.session_ip".get_user_table_field(", u.", "user_id").get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "userpic").get_user_table_field(", u.", "user_invisible")."
FROM ".SESSIONS_TABLE." s
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = s.session_user_id)
WHERE s.session_lastaction >= $time_out
ORDER BY ".get_user_table_field("u.", "user_id")." ASC, s.session_ip ASC";
$result = $site_db->query($sql);
while ($row = $site_db->fetch_array($result)) {
if ($row['session_user_id'] != GUEST && (isset($row['user_id']) && $row['user_id'] != GUEST)) {
if (!isset($prev_user_ids[$row['session_user_id']])) {
$is_invisible = (isset($row[$user_table_fields['user_invisible']]) && $row[$user_table_fields['user_invisible']] == 1) ? 1 : 0;
$invisibleuser = ($is_invisible) ? REPLACE_EMPTY : "";
$username = (isset($row[$user_table_fields['user_level']]) && $row[$user_table_fields['user_level']] == ADMIN && $config['highlight_admin'] == 1 && !empty($row[$user_table_fields['userpic']])) ? sprintf("<b>%s</b>", $row[$user_table_fields['userpic']]. $row[$user_table_fields['user_name']]) : (!empty($row[$user_table_fields['userpic']])) ? $row[$user_table_fields['userpic']]. $row[$user_table_fields['user_name']] : $row[$user_table_fields['user_name']];
if (!$is_invisible || $user_info['user_level'] == ADMIN) {
$user_online_list .= ($user_online_list != "") ? ", " : "";
$user_profile_link = (!empty($url_show_profile)) ? str_replace("{user_id}", $row['session_user_id'], $url_show_profile) : ROOT_PATH."index.php?pg=member_profile&action=showprofile&".URL_USER_ID."=".$row['session_user_id'];
$user_online_list .= "<a href=\"".$site_sess->url($user_profile_link)."\">".$username."</a>".$invisibleuser;
}
(!$is_invisible) ? $num_visible_online++ : $num_invisible_online++;
$num_registered_online++;
}
$prev_user_ids[$row['session_user_id']] = 1;
}
else {
if (!isset($prev_session_ips[$row['session_ip']])) {
$num_guests_online++;
}
}
$prev_session_ips[$row['session_ip']] = 1;
}
$num_total_online = $num_registered_online + $num_guests_online;
//$num_invisible_online = $num_registered_online - $num_visible_online;
$site_template->register_vars(array(
"num_total_online" => $num_total_online,
"num_invisible_online" => $num_invisible_online,
"num_registered_online" => $num_registered_online,
"num_guests_online" => $num_guests_online,
"user_online_list" => $user_online_list
));
$whos_online = $site_template->parse_template("whos_online");
$site_template->register_vars("whos_online", $whos_online);
unset($whos_online);
unset($prev_user_ids);
unset($prev_session_ips);
}
-
this is my block of code with modifications (i've not the original,because i've installed some MOD's)
if (defined("GET_USER_ONLINE") && ($config['display_whosonline'] == 1 || $user_info['user_level'] == ADMIN)) {
$time_out = time() - 300;
$sql = "SELECT s.session_user_id, s.session_lastaction, s.session_ip".get_user_table_field(", u.", "user_id").get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "userpic").get_user_table_field(", u.", "user_invisible")."
FROM ".SESSIONS_TABLE." s
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = s.session_user_id)
WHERE s.session_lastaction >= $time_out
ORDER BY ".get_user_table_field("u.", "user_id")." ASC, s.session_ip ASC";
$result = $site_db->query($sql);
while ($row = $site_db->fetch_array($result)) {
if ($row['session_user_id'] != GUEST && (isset($row['user_id']) && $row['user_id'] != GUEST)) {
if (!isset($prev_user_ids[$row['session_user_id']])) {
$is_invisible = (isset($row[$user_table_fields['user_invisible']]) && $row[$user_table_fields['user_invisible']] == 1) ? 1 : 0;
$invisibleuser = ($is_invisible) ? REPLACE_EMPTY : "";
$username = (isset($row[$user_table_fields['user_level']]) && $row[$user_table_fields['user_level']] == ADMIN && $config['highlight_admin'] == 1 && !empty($row[$user_table_fields['userpic']])) ? sprintf("<b>%s</b>", $row[$user_table_fields['userpic']]. $row[$user_table_fields['user_name']]) : (!empty($row[$user_table_fields['userpic']])) ? $row[$user_table_fields['userpic']]. $row[$user_table_fields['user_name']] : $row[$user_table_fields['user_name']];
if (!$is_invisible || $user_info['user_level'] == ADMIN) {
$user_online_list .= ($user_online_list != "") ? ", " : "";
$user_profile_link = (!empty($url_show_profile)) ? str_replace("{user_id}", $row['session_user_id'], $url_show_profile) : ROOT_PATH."index.php?pg=member_profile&action=showprofile&".URL_USER_ID."=".$row['session_user_id'];
/*
MOD VISITORS COUNTRY FLAGS
START INSERT
*/
$cid = geoip_country_code_by_addr($gi, $row['session_ip']);
if (empty($cid)) $cid = "lan";
$countries[$cid] = isset($countries[$cid]) ? $countries[$cid]+1 : 1;
$username = "<img src=\"".ROOT_PATH."flags/".strtolower($cid).".png"."\" alt=\"".(($cid != "lan") ? $gi->GEOIP_COUNTRY_NAMES[$gi->GEOIP_COUNTRY_CODE_TO_NUMBER[$cid]] : "Unknown or LAN")."\" border=0> ".$username;
/*
MOD VISITORS COUNTRY FLAGS
END INSERT
*/
$user_online_list .= "<a href=\"".$site_sess->url($user_profile_link)."\">".$username."</a>".$invisibleuser;
}
(!$is_invisible) ? $num_visible_online++ : $num_invisible_online++;
$num_registered_online++;
}
$prev_user_ids[$row['session_user_id']] = 1;
}
else {
if (!isset($prev_session_ips[$row['session_ip']])) {
$num_guests_online++;
/*
MOD VISITORS COUNTRY FLAGS
START INSERT
*/
$cid = geoip_country_code_by_addr($gi, $row['session_ip']);
if (empty($cid)) $cid = "lan";
$countries[$cid] = isset($countries[$cid]) ? $countries[$cid]+1 : 1;
$invitado_online_list = "<font color=\"#00FFFF\">".$num_guests_online."</font><img src=\"".ROOT_PATH."flags/".strtolower($cid).".png"."\" alt=\"".(($cid != "lan") ? $gi->GEOIP_COUNTRY_NAMES[$gi->GEOIP_COUNTRY_CODE_TO_NUMBER[$cid]] : "Unknown or LAN")."\" border=0> ".$invitado_online_list ;
/*
MOD VISITORS COUNTRY FLAGS
END INSERT
*/
if ($num_guests_online > 1){
$invitado_online_list .= " , ";
}
}
}
$prev_session_ips[$row['session_ip']] = 1;
}
$num_total_online = $num_registered_online + $num_guests_online;
//$num_invisible_online = $num_registered_online - $num_visible_online;
$site_template->register_vars(array(
"num_total_online" => $num_total_online,
"num_invisible_online" => $num_invisible_online,
"num_registered_online" => $num_registered_online,
"num_guests_online" => $num_guests_online,
"user_online_list" => $user_online_list
));
$whos_online = $site_template->parse_template("whos_online");
$site_template->register_vars("whos_online", $whos_online);
unset($whos_online);
unset($prev_user_ids);
unset($prev_session_ips);
}
i've added your code already here 8)
-
i've added your code already here
Ok so ... what's the status ?
-
{lang_user_online}
Doesn't work 8O
-
Doesn't work
Specifics please !!!
-
well just not show "empty space" :|
-
And, just to check, you do have the userpic row under your USERS_TABLE right ?
If so, in the mean time, I just noticed I made a slight mistake from my last post.
Find this line :
$username = (isset($row[$user_table_fields['user_level']]) && $row[$user_table_fields['user_level']] == ADMIN && $config['highlight_admin'] == 1 && !empty($row[$user_table_fields['userpic']])) ? sprintf("<b>%s</b>", $row[$user_table_fields['userpic']]. $row[$user_table_fields['user_name']]) : (!empty($row[$user_table_fields['userpic']])) ? $row[$user_table_fields['userpic']]. $row[$user_table_fields['user_name']] : $row[$user_table_fields['user_name']];
replace with :
$username = (isset($row[$user_table_fields['user_level']]) && $row[$user_table_fields['user_level']] == ADMIN && $config['highlight_admin'] == 1 && !empty($row[$user_table_fields['userpic']])) ? sprintf("<b>%s</b>", "<img src=\"".ROOT_PATH."data/userpic/".$row[$user_table_fields['userpic']]."\">".REPLACE_EMPTY. $row[$user_table_fields['user_name']]) : (!empty($row[$user_table_fields['userpic']])) ? "<img src=\"".ROOT_PATH."data/userpic/".$row[$user_table_fields['userpic']]."\">".REPLACE_EMPTY. $row[$user_table_fields['user_name']] : $row[$user_table_fields['user_name']];
Keep me posted on this.
-
yes it's under "4images_users" 8) ( i hope i've understand what u mean ...) :roll:
-
Ok so ... did the latest codings showed you the userpic ? :roll:
-
no , this have just show the users list with country flags (MOD before installed) :?
-
It's obvious that if you already installed a MOD over the original codings before, it will be harder for you to make the replacement (rather than just replacing the original codings). ;)
-
maybe you take a look into my sessions.php (now without any of this changes) ... only modifications by another mod's ..(country flags,lightbox..) !
-
I'm not sure what you're asking ... you wish, for me, to investigate the country, flags, lightbox you installed ? If so, I don't think so. ;)
-
no no just for u take a look, cuz you've made that for a original code, so i've installed mod's before, so i've think better u take a look and see if ill be necessary change something from ur code (before posted) :mrgreen:
I mean , make a code but already count with modifications (i've made before) :) thats nothing about investigation :) just to take a look :)
-
@Stoleti:
Good news. I have just added the userpic row into the "who's online" template and it looks pretty great actually. You can customize your HTML Table the way you want it from now on (still with the userpic subject). I will post the results sometime tonight. ;)
-
awesome new :)
but i think i've forgot tell you , this can work in a new page ?
make 2 ways to see :
1 ) the default list (in my case country flag + username)
2 ) This one the detailed version of who's online ( i.e : users_online.php) where we make a detailed version of who's online .
and here that you've said about we customize the HTML ill be a very good new :)
-
this can work in a new page ?
My modifications only applys from the core files as no new files are / will be involved.
-
:? because i've who's online work in all pages, in small table (vertical mode)...so thats my ideia of make new file for this, for not affect whole templates style :roll:
-
For now, since my knowledge is quite limited with paging, I have - at least - presented users from the who's online table the way you wanted (according to your screenshot).
Meaning, no paging is currently involved under the first release since it is the first time I'm trying this kind of feature ...
Is it still alright if no paging is in ? For the moment, I think it would be great to know if, what I already did, does fit your needs first - before jumping into any additional details. ;)
-
yes thats no problem :) the question its another one ... make that work in another file ? example "users_online.php" ??? with paging or without :)
-
make that work in another file ?
I thought I made myself clear the first time. The first release will be from core files - such as includes/sessions.php file. :?
Then, if everything works great, I will make further codings in a new file so that users won't use paging directly from includes/sessions.php (too dangerous). ;)
-
Now, here's the modifications I did yesterday.
First, make a backup of your includes/sessions.php file, your templates/<your_template>/whos_online.html file and your USERS_TABLE.
// Step 1
In your includes/sessions.php file - based from the original block of 4images,
find :
if (defined("GET_USER_ONLINE") && ($config['display_whosonline'] == 1 || $user_info['user_level'] == ADMIN)) {
$time_out = time() - 300;
$sql = "SELECT s.session_user_id, s.session_lastaction, s.session_ip".get_user_table_field(", u.", "user_id").get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_invisible")."
FROM ".SESSIONS_TABLE." s
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = s.session_user_id)
WHERE s.session_lastaction >= $time_out
ORDER BY ".get_user_table_field("u.", "user_id")." ASC, s.session_ip ASC";
$result = $site_db->query($sql);
while ($row = $site_db->fetch_array($result)) {
if ($row['session_user_id'] != GUEST && (isset($row['user_id']) && $row['user_id'] != GUEST)) {
if (!isset($prev_user_ids[$row['session_user_id']])) {
$is_invisible = (isset($row[$user_table_fields['user_invisible']]) && $row[$user_table_fields['user_invisible']] == 1) ? 1 : 0;
$invisibleuser = ($is_invisible) ? "*" : "";
$username = (isset($row[$user_table_fields['user_level']]) && $row[$user_table_fields['user_level']] == ADMIN && $config['highlight_admin'] == 1) ? sprintf("<b>%s</b>", $row[$user_table_fields['user_name']]) : $row[$user_table_fields['user_name']];
if (!$is_invisible || $user_info['user_level'] == ADMIN) {
$user_online_list .= ($user_online_list != "") ? ", " : "";
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $row['session_user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$row['session_user_id'];
$user_online_list .= "<a href=\"".$site_sess->url($user_profile_link)."\">".$username."</a>".$invisibleuser;
}
(!$is_invisible) ? $num_visible_online++ : $num_invisible_online++;
$num_registered_online++;
}
$prev_user_ids[$row['session_user_id']] = 1;
}
else {
if (!isset($prev_session_ips[$row['session_ip']])) {
$num_guests_online++;
}
}
$prev_session_ips[$row['session_ip']] = 1;
}
$num_total_online = $num_registered_online + $num_guests_online;
//$num_invisible_online = $num_registered_online - $num_visible_online;
$site_template->register_vars(array(
"num_total_online" => $num_total_online,
"num_invisible_online" => $num_invisible_online,
"num_registered_online" => $num_registered_online,
"num_guests_online" => $num_guests_online,
"user_online_list" => $user_online_list
));
$whos_online = $site_template->parse_template("whos_online");
$site_template->register_vars("whos_online", $whos_online);
unset($whos_online);
unset($prev_user_ids);
unset($prev_session_ips);
}
replace with :
if (defined("GET_USER_ONLINE") && ($config['display_whosonline'] == 1 || $user_info['user_level'] == ADMIN)) {
$time_out = time() - 300;
$sql = "SELECT s.session_user_id, s.session_lastaction, s.session_ip".get_user_table_field(", u.", "user_id").get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_invisible")."
FROM ".SESSIONS_TABLE." s
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = s.session_user_id)
WHERE s.session_lastaction >= $time_out
ORDER BY ".get_user_table_field("u.", "user_id")." ASC, s.session_ip ASC";
$result = $site_db->query($sql);
while ($row = $site_db->fetch_array($result)) {
$sql = "SELECT user_country, user_age, user_hobbies, userpic FROM ".USERS_TABLE;
$additional_results = $site_db->query($sql);
while ($additional_user_rows = $site_db->fetch_array($additional_results)) {
if ($row['session_user_id'] != GUEST && (isset($row['user_id']) && $row['user_id'] != GUEST)) {
if (!isset($prev_user_ids[$row['session_user_id']])) {
$is_invisible = (isset($row[$user_table_fields['user_invisible']]) && $row[$user_table_fields['user_invisible']] == 1) ? 1 : 0;
$invisibleuser = ($is_invisible) ? "*" : "";
$username = (isset($row[$user_table_fields['user_level']]) && $row[$user_table_fields['user_level']] == ADMIN && $config['highlight_admin'] == 1) ? sprintf("<b>%s</b>", $row[$user_table_fields['userpic']]. $row[$user_table_fields['user_name']]) : $row[$user_table_fields['user_name']];
if (!$is_invisible || $user_info['user_level'] == ADMIN) {
$user_online_list .= ($user_online_list != "") ? "<br />" : "";
$user_profile_link = (!empty($url_show_profile)) ? str_replace("{user_id}", $row['session_user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$row['session_user_id'];
$userpic_source = (isset($additional_user_rows['userpic']) && $additional_user_rows['userpic'] && $config['userpic']) ? $additional_user_rows['userpic'] : "";
$userpic_img = $site_sess->url(ROOT_PATH."data/userpic/".$userpic_source);
$user_hobbies = (isset($additional_user_rows['user_hobbies']) && $additional_user_rows['user_hobbies']) ? $additional_user_rows['user_hobbies'] : $lang['no_comments'];
$user_age = (isset($additional_user_rows['user_age']) && $additional_user_rows['user_age']) ? $additional_user_rows['user_age']. REPLACE_EMPTY. $lang['years_old'] : "";
$user_country = (isset($additional_user_rows['user_country']) && $additional_user_rows['user_country']) ? $additional_user_rows['user_country'] : "";
$user_gender = (isset($additional_user_rows['user_gender']) && $additional_user_rows['user_gender']) ? $additional_user_rows['user_gender'] : "";
$user_online_list .= "<a href=\"".$site_sess->url($user_profile_link)."\">".$username."</a>".$invisibleuser;
}
(!$is_invisible) ? $num_visible_online++ : $num_invisible_online++;
$num_registered_online++;
}
$prev_user_ids[$row['session_user_id']] = 1;
}
else {
if (!isset($prev_session_ips[$row['session_ip']])) {
$num_guests_online++;
}
}
}
$prev_session_ips[$row['session_ip']] = 1;
}
$num_total_online = $num_registered_online + $num_guests_online;
//$num_invisible_online = $num_registered_online - $num_visible_online;
$site_template->register_vars(array(
"num_total_online" => $num_total_online,
"num_invisible_online" => $num_invisible_online,
"num_registered_online" => $num_registered_online,
"num_guests_online" => $num_guests_online,
"userpic_img" => $userpic_img,
"user_hobbies" => $user_hobbies,
"user_age" => $user_age,
"user_country" => $user_country,
"user_gender" => $user_gender,
"user_online_list" => $user_online_list,
"lang_user_online" => str_replace('{num_total_online}', $num_total_online, $lang['user_online']),
"lang_user_online_detail" => str_replace(array('{num_registered_online}','{num_invisible_online}','{num_guests_online}'), array($num_registered_online,$num_invisible_online,$num_guests_online), $lang['user_online_detail']),
));
$whos_online = $site_template->parse_template("whos_online");
$site_template->register_vars("whos_online", $whos_online);
unset($whos_online);
unset($prev_user_ids);
unset($prev_session_ips);
}
Now, I don't know for you but these are the fields that I have added :
user_hobbies
user_age
user_country
user_gender
Meaning, some rows might contain different names as yours. If so, simply change the names from that paragraph in order to match yours. ;)
// Step 2
In your templates/<your_template>/whos_online.html file, you may customize it the way you like it as I use these tags :
{if userpic_img}
<img src="{userpic_img}">
{endif userpic_img}
{if user_online_list}
{user_online_list}
{endif user_online_list}
{if user_age}
{user_age}
{endif user_age}
{if user_country}
{user_country}
{endif user_country}
{if user_hobbies}
{user_hobbies}
{endif user_hobbies}
{if user_gender}
{user_gender}
{endif user_gender}
// Step 3
In your lang/english/main.php file,
add above the "?>" tag :
$lang['years_old'] = "years old.";
// Step 4
Make sure you have these field names correctly set from your USERS_TABLE and from your includes/db_field_definitions.php file.
Let me know how it goes. ;)
-
ok i ill make a full backup (DB, and another files) before ;) tonight i give u the results :mrgreen:
-
Update :
I forgot to specify the $lang['years_old'] field (if you don't already have it). I have just updated my post above (Step 3). ;)
-
Parse error: parse error, unexpected $ in /home/blacktra/public_html/includes/sessions.php on line 646
Line 555 - 646
if (defined("GET_USER_ONLINE") && ($config['display_whosonline'] == 1 || $user_info['user_level'] == ADMIN)) {
$time_out = time() - 300;
$sql = "SELECT s.session_user_id, s.session_lastaction, s.session_ip".get_user_table_field(", u.", "user_id").get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_invisible")."
FROM ".SESSIONS_TABLE." s
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = s.session_user_id)
WHERE s.session_lastaction >= $time_out
ORDER BY ".get_user_table_field("u.", "user_id")." ASC, s.session_ip ASC";
$result = $site_db->query($sql);
while ($row = $site_db->fetch_array($result)) {
$sql = "SELECT user_country, user_age, user_hobbies, userpic FROM ".USERS_TABLE;
$additional_results = $site_db->query($sql);
while ($additional_user_rows = $site_db->fetch_array($additional_results)) {
if ($row['session_user_id'] != GUEST && (isset($row['user_id']) && $row['user_id'] != GUEST)) {
if (!isset($prev_user_ids[$row['session_user_id']])) {
$is_invisible = (isset($row[$user_table_fields['user_invisible']]) && $row[$user_table_fields['user_invisible']] == 1) ? 1 : 0;
$invisibleuser = ($is_invisible) ? "*" : "";
$username = (isset($row[$user_table_fields['user_level']]) && $row[$user_table_fields['user_level']] == ADMIN && $config['highlight_admin'] == 1) ? sprintf("<b>%s</b>", $row[$user_table_fields['userpic']]. $row[$user_table_fields['user_name']]) : $row[$user_table_fields['user_name']];
if (!$is_invisible || $user_info['user_level'] == ADMIN) {
$user_online_list .= ($user_online_list != "") ? "<br />" : "";
$user_profile_link = (!empty($url_show_profile)) ? str_replace("{user_id}", $row['session_user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$row['session_user_id'];
/*
MOD VISITORS COUNTRY FLAGS
START INSERT
*/
$cid = geoip_country_code_by_addr($gi, $row['session_ip']);
if (empty($cid)) $cid = "lan";
$countries[$cid] = isset($countries[$cid]) ? $countries[$cid]+1 : 1;
$username = "<img src=\"".ROOT_PATH."flags/".strtolower($cid).".png"."\" alt=\"".(($cid != "lan") ? $gi->GEOIP_COUNTRY_NAMES[$gi->GEOIP_COUNTRY_CODE_TO_NUMBER[$cid]] : "Unknown or LAN")."\" border=0> ".$username;
/*
MOD VISITORS COUNTRY FLAGS
END INSERT
*/
$userpic_source = (isset($additional_user_rows['userpic']) && $additional_user_rows['userpic'] && $config['userpic']) ? $additional_user_rows['userpic'] : "";
$userpic_img = $site_sess->url(ROOT_PATH."data/userpic/".$userpic_source);
$user_sexuality = (isset($additional_user_rows['user_sexuality']) && $additional_user_rows['user_sexuality']) ? $additional_user_rows['user_sexuality'] : $lang['no_comments'];
$user_age = (isset($additional_user_rows['user_age']) && $additional_user_rows['user_age']) ? $additional_user_rows['user_age']. REPLACE_EMPTY. $lang['years_old'] : "";
$user_country = (isset($additional_user_rows['user_country']) && $additional_user_rows['user_country']) ? $additional_user_rows['user_country'] : "";
$user_gender = (isset($additional_user_rows['user_gender']) && $additional_user_rows['user_gender']) ? $additional_user_rows['user_gender'] : "";
$user_online_list .= "<a href=\"".$site_sess->url($user_profile_link)."\">".$username."</a>".$invisibleuser;
}
(!$is_invisible) ? $num_visible_online++ : $num_invisible_online++;
$num_registered_online++;
}
$prev_user_ids[$row['session_user_id']] = 1;
}
else {
if (!isset($prev_session_ips[$row['session_ip']])) {
$num_guests_online++;
/*
MOD VISITORS COUNTRY FLAGS
START INSERT
*/
$cid = geoip_country_code_by_addr($gi, $row['session_ip']);
if (empty($cid)) $cid = "lan";
$countries[$cid] = isset($countries[$cid]) ? $countries[$cid]+1 : 1;
$invitado_online_list = "<font color=\"#00FFFF\">".$num_guests_online."</font><img src=\"".ROOT_PATH."flags/".strtolower($cid).".png"."\" alt=\"".(($cid != "lan") ? $gi->GEOIP_COUNTRY_NAMES[$gi->GEOIP_COUNTRY_CODE_TO_NUMBER[$cid]] : "Unknown or LAN")."\" border=0> ".$invitado_online_list ;
/*
MOD VISITORS COUNTRY FLAGS
END INSERT
*/
if ($num_guests_online > 1){
$invitado_online_list .= " , ";
}
}
}
$prev_session_ips[$row['session_ip']] = 1;
}
$num_total_online = $num_registered_online + $num_guests_online;
//$num_invisible_online = $num_registered_online - $num_visible_online;
$site_template->register_vars(array(
"num_total_online" => $num_total_online,
"num_invisible_online" => $num_invisible_online,
"num_registered_online" => $num_registered_online,
"num_guests_online" => $num_guests_online,
"userpic_img" => $userpic_img,
"user_sexuality" => $user_sexuality,
"user_age" => $user_age,
"user_country" => $user_country,
"user_gender" => $user_gender,
"user_online_list" => $user_online_list,
"lang_user_online" => str_replace('{num_total_online}', $num_total_online, $lang['user_online']),
"lang_user_online_detail" => str_replace(array('{num_registered_online}','{num_invisible_online}','{num_guests_online}'), array($num_registered_online,$num_invisible_online,$num_guests_online), $lang['user_online_detail']),
));
$whos_online = $site_template->parse_template("whos_online");
$site_template->register_vars("whos_online", $whos_online);
unset($whos_online);
unset($prev_user_ids);
unset($prev_session_ips);
}
?>
:?:
-
Obviously, we don't have the same routines since you added a none related MOD with this MOD. The error you're having means there's a missing closed braket (this time probably from the while loop statement - as an end argument).
For your case,
find :
unset($prev_session_ips);
}
replace with :
unset($prev_session_ips);
}
}
This should do the trick.
-
In the mean time, since you're not using the "user_hobbies" row, I'd suggest to remove it from the SQL's SELECT line statement as well (since it would seems you removed it from one of the $additional_user_rows below). ;)
Once removed, you should rather replace it with the user_sexuality name you created as an additional field instead. ;)
-
In the mean time, since you're not using the "user_hobbies" row, I'd suggest to remove it from the SQL's SELECT line statement as well (since it would seems you removed it from one of the $additional_user_rows below). ;)
Once removed, you should rather replace it with the user_sexuality name you created as an additional field instead. ;)
i've just replaced with that, cuz i've that on user_table , and no "hobbies" :)
being on USER_TABLE must work , i think :?
-
being on USER_TABLE must work , i think
The users table is : USERS_TABLE. ;)
As for the rest, if you did added the ending braket at the end, everything should work out as you planned (for the first release).
-
error has gone :D
but still showing only the default stuff (country flag + username) , other stuff no :roll:
yes USERS_TABLE ..lil grammar mistake :mrgreen:
-
But still showing only the default stuff (country flag + username) , other stuff no
If you're saying that the userpic row is not showing up, then it is clairly an implementation issue.
However, just to see if I'm right ;
[ edit ]
let's remain with this line :
FROM ".USERS_TABLE;
-
still showing the default users list (who's online)
my code with updates :
if (defined("GET_USER_ONLINE") && ($config['display_whosonline'] == 1 || $user_info['user_level'] == ADMIN)) {
$time_out = time() - 300;
$sql = "SELECT s.session_user_id, s.session_lastaction, s.session_ip".get_user_table_field(", u.", "user_id").get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_invisible")."
FROM ".SESSIONS_TABLE." s
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = s.session_user_id)
WHERE s.session_lastaction >= $time_out
ORDER BY ".get_user_table_field("u.", "user_id")." ASC, s.session_ip ASC";
$result = $site_db->query($sql);
while ($row = $site_db->fetch_array($result)) {
$sql = "SELECT user_country, user_age, user_sexuality, userpic FROM ".USERS_TABLE." WHERE ".get_user_table_field("", "user_id")." = ".$user_info['user_id'];
$additional_results = $site_db->query($sql);
while ($additional_user_rows = $site_db->fetch_array($additional_results)) {
if ($row['session_user_id'] != GUEST && (isset($row['user_id']) && $row['user_id'] != GUEST)) {
if (!isset($prev_user_ids[$row['session_user_id']])) {
$is_invisible = (isset($row[$user_table_fields['user_invisible']]) && $row[$user_table_fields['user_invisible']] == 1) ? 1 : 0;
$invisibleuser = ($is_invisible) ? "*" : "";
$username = (isset($row[$user_table_fields['user_level']]) && $row[$user_table_fields['user_level']] == ADMIN && $config['highlight_admin'] == 1) ? sprintf("<b>%s</b>", $row[$user_table_fields['userpic']]. $row[$user_table_fields['user_name']]) : $row[$user_table_fields['user_name']];
if (!$is_invisible || $user_info['user_level'] == ADMIN) {
$user_online_list .= ($user_online_list != "") ? "<br />" : "";
$user_profile_link = (!empty($url_show_profile)) ? str_replace("{user_id}", $row['session_user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$row['session_user_id'];
/*
MOD VISITORS COUNTRY FLAGS
START INSERT
*/
$cid = geoip_country_code_by_addr($gi, $row['session_ip']);
if (empty($cid)) $cid = "lan";
$countries[$cid] = isset($countries[$cid]) ? $countries[$cid]+1 : 1;
$username = "<img src=\"".ROOT_PATH."flags/".strtolower($cid).".png"."\" alt=\"".(($cid != "lan") ? $gi->GEOIP_COUNTRY_NAMES[$gi->GEOIP_COUNTRY_CODE_TO_NUMBER[$cid]] : "Unknown or LAN")."\" border=0> ".$username;
/*
MOD VISITORS COUNTRY FLAGS
END INSERT
*/
$userpic_source = (isset($additional_user_rows['userpic']) && $additional_user_rows['userpic'] && $config['userpic']) ? $additional_user_rows['userpic'] : "";
$userpic_img = $site_sess->url(ROOT_PATH."data/userpic/".$userpic_source);
$user_sexuality = (isset($additional_user_rows['user_sexuality']) && $additional_user_rows['user_sexuality']) ? $additional_user_rows['user_sexuality'] : $lang['no_comments'];
$user_age = (isset($additional_user_rows['user_age']) && $additional_user_rows['user_age']) ? $additional_user_rows['user_age']. REPLACE_EMPTY. $lang['years_old'] : "";
$user_country = (isset($additional_user_rows['user_country']) && $additional_user_rows['user_country']) ? $additional_user_rows['user_country'] : "";
$user_gender = (isset($additional_user_rows['user_gender']) && $additional_user_rows['user_gender']) ? $additional_user_rows['user_gender'] : "";
$user_online_list .= "<a href=\"".$site_sess->url($user_profile_link)."\">".$username."</a>".$invisibleuser;
}
(!$is_invisible) ? $num_visible_online++ : $num_invisible_online++;
$num_registered_online++;
}
$prev_user_ids[$row['session_user_id']] = 1;
}
else {
if (!isset($prev_session_ips[$row['session_ip']])) {
$num_guests_online++;
/*
MOD VISITORS COUNTRY FLAGS
START INSERT
*/
$cid = geoip_country_code_by_addr($gi, $row['session_ip']);
if (empty($cid)) $cid = "lan";
$countries[$cid] = isset($countries[$cid]) ? $countries[$cid]+1 : 1;
$invitado_online_list = "<font color=\"#00FFFF\">".$num_guests_online."</font><img src=\"".ROOT_PATH."flags/".strtolower($cid).".png"."\" alt=\"".(($cid != "lan") ? $gi->GEOIP_COUNTRY_NAMES[$gi->GEOIP_COUNTRY_CODE_TO_NUMBER[$cid]] : "Unknown or LAN")."\" border=0> ".$invitado_online_list ;
/*
MOD VISITORS COUNTRY FLAGS
END INSERT
*/
if ($num_guests_online > 1){
$invitado_online_list .= " , ";
}
}
}
}
$prev_session_ips[$row['session_ip']] = 1;
}
$num_total_online = $num_registered_online + $num_guests_online;
//$num_invisible_online = $num_registered_online - $num_visible_online;
$site_template->register_vars(array(
"num_total_online" => $num_total_online,
"num_invisible_online" => $num_invisible_online,
"num_registered_online" => $num_registered_online,
"num_guests_online" => $num_guests_online,
"userpic_img" => $userpic_img,
"user_sexuality" => $user_sexuality,
"user_age" => $user_age,
"user_country" => $user_country,
"user_gender" => $user_gender,
"user_online_list" => $user_online_list,
"lang_user_online" => str_replace('{num_total_online}', $num_total_online, $lang['user_online']),
"lang_user_online_detail" => str_replace(array('{num_registered_online}','{num_invisible_online}','{num_guests_online}'), array($num_registered_online,$num_invisible_online,$num_guests_online), $lang['user_online_detail']),
));
$whos_online = $site_template->parse_template("whos_online");
$site_template->register_vars("whos_online", $whos_online);
unset($whos_online);
unset($prev_user_ids);
unset($prev_session_ips);
}
-
And what about your whos_online.html file ? Could you post it as well ? In the mean time, you did not added the "user_gender" row in your SQL's SELECT statement.
-
all stuff i've in my USERS_TABLES , and i've put all tags you'e before posted on whos_online.html :), i've make all you've said 8)
-
all stuff i've in my USERS_TABLES , and i've put all tags you'e before posted on whos_online.html :), i've make all you've said 8)
If so ... then why do I see :
$user_gender = (isset($additional_user_rows['user_gender']) && $additional_user_rows['user_gender']) ? $additional_user_rows['user_gender'] : "";
and is NOT in :
$sql = "SELECT user_country, user_age, user_sexuality, userpic, where's user_gender ??? FROM ".USERS_TABLE." WHERE ".get_user_table_field("", "user_id")." = ".$user_info['user_id'];
:?:
-
added :D wooooow its working !!!!!!!! :mrgreen:
and about paging, any news ?
a lil question how make i show each user by row with diferent background ??
-
and about paging, any news ?
Since it would seems, by your report, that all is working properly. I should start considering plans to build an additional routines for the whos_online with paging. I will keep this topic updated once I succeed.
a lil question how make i show each user by row with diferent background ??
One feature at the time - shall we ? !
-
sure :D !!! for now thats a very good work, succefull :mrgreen:
-
May I ask you to post your URL so that others might see a preview of these successful codings ? ;)
-
actually i'm having a problem about user age....
this show birthday date and not a user age ( show "------------" )
-----
But in member profile the tag {user_age} works and here only {user_age_birthday} 8O
the info about Age MOD in attach 8)
-------
well i ill show when all works fine :mrgreen: , and probably if thats not against rulez move to publish mod's ????? :roll:
-
this means
{user_age } => XX
{user_age_birthday} => XXXX - XX - XX
but why in profile both work and here only birthday work 8O
from DB_Field_Definitions.php
$additional_user_fields['user_age_birthday'] = array($lang['user_age_birthday'], "text", 1);
but why {user_age} not work like in member_profile ?? 8O
-
but why {user_age} not work like in member_profile ??
Please read the footer of Step 1 for the answer of that question.
-
another problem this only show my info, another users, not show at this way 8O , show default way....
8O 8O
-
I have took a look at the ZIP file you posted regarding the user age MOD and I'm afraid to report that it contains too much expensive codings in order to implement in this MOD. No support will be given on this one. Sorry.
-
so let's forget the AGE , and solving the another problem , why that only work at right way to me and for another users,this show as default way? without userpic ..etc ???
:?:
-
another problem this only show my info, another users, not show at this way 8O , show default way....
8O 8O
Look, you said it was working properly. Is it my understanding you overlooked before answering ? :?
-
yes i've said, but i've been alone , and for this this is working, maybe cuz be ADMIN , but i've join at site with my another pc , and this doesn't work , show country flag + username
-
this have just show my info ........ from another user this have show the defaul ..only :?
-
this have just show my info ........ from another user this have show the defaul ..only :?
Then, I have just modified this post :
http://www.4homepages.de/forum/index.php?topic=11168.msg57606#msg57606
Put back the USERS_TABLE; (the way it was before).
-
i've put back FROM ".USERS_TABLE;
and now show the noimage.png (at userpic) and only work username ...
$sql = "SELECT user_country, user_age, user_sexuality, userpic,user_gender FROM ".USERS_TABLE;
-
Ok, I see what you mean now. The 2nd username (and so on) gets below the same table as the first. We do not see each table for each users but the same table from the first user through the last. :(
I guess I'll have to look deeper into this problem.
-
ideia ill be :
1 - one user peer row
2 - Make it work for "All" users, on that case that have only work for me , but for that user, that have show in same row, and show as default way "flag+username" ;)
Keep me on for updates 8)
-
Ok, here's the thing. Whos_online.html's HTML Table structure is not under any while loop statement. Meaning, the username only appears in one whole table presentation and is, defaultly, seperated with commas under includes/sessions.php file (to make seperations of each usernames from a single TD alignment).
Meaning, in order to accomplish your request, you would NOT be able to make any modifications under whois_online.html file since the HTML Table will have to be re-coded from includes/sessions.php file entirely.
That said, are you sure you wish to have this ? Since you will be limited to edit your HTML file after this.
Please advise.
[EDIT]
OR, I don't know (yet) if this can be done but, by simply adding the TD alignment as part of the while loop then register that new related string to the whois_online.html, perhaps it could work. Althought, I can't be a 100% sure on this one since I did not tested this before. :|
-
without change html file ? how can i ,make it look like the first example (attach image) ? for me if this look like that for me ill be perfect :mrgreen:
-
I'll see what I can do. I'll work on it sometime today and keep this topic updated eventually.
-
alright :) i ill wait for new updates :mrgreen: , if i've any ideia i ill post them here !
-
how can i make a hidden/expanded online list work i mean :
normal/expanded ill be :
Currently active users: XX
user 1
user 2
user 3
a Hidden version :
Currently active users: XX
being as link " Currently active users: XX " link for both versions 8) can be useful to save space in templates, and with option to expand for who want see full version :)
this ideia its for "Default version of user online list" not for detailed 8)
-
Please stop asking for several requests at the time (on the same subject). You have already requested one modification as I'm currently developping it. However, If you wish to switch features, it is not too late to state it. :?
-
Please stop asking for several requests at the time (on the same subject). You have already requested one modification as I'm currently developping it. However, If you wish to switch features, it is not too late to state it. :?
ok ok sorry :|
-
@Stoleti :
Update :
The whos_online function has been seperated into it's own file as I'm currently finalizing the codes in order to be used (well, mostly) as your screenshot describes. ;)
As for the paging class, this will have to wait a little since I don't know how to use it yet. Obviously, it is unlikely I will get any help on this one too ...
Next update to come soon . . .
-
Thats Good new , about the age problem skip it :wink: , let's make it more easy and simple :mrgreen:
I ill wait for the next update go on !! :D
-
I forgot to ask ; do you wish GUEST level to see these additional features as well or just logged in users & admin ?
-
I forgot to ask ; do you wish GUEST level to see these additional features as well or just logged in users & admin ?
Yes :) they can see !
-
Yes Smile they can see !
Which one ? :?
-
GUEST's correct ? ;)
The GUEST's can see the additional features .
-
The GUEST's can see the additional features
Very well. I'll see what I can do.
-
but a bit out of question for example on " 20 users online " this can only count the reg. members , without guest's ? i mean it because on "corrently active users" this count guest's + reg, members ;) just wondering about it, nothing so special .
-
but a bit out of question for example on " 20 users online " this can only count the reg. members , without guest's ? i mean it because on "corrently active users" this count guest's + reg, members ;) just wondering about it, nothing so special .
Forget I asked. ;)
You're correct. The who's online function does not currently track GUEST level but only registered users. I guess it will remain this way. ;)
-
yea, you've got the ideia :mrgreen: