4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: thunderstrike on November 24, 2007, 10:29:40 PM
-
I code MOD: Who viewed my profile (free). Each user see result in uniq page.
- Additional user fields in uniq page - include.
- Paging in uniq page - include (need: Universal Paging class from V@no).
- Total visit count in uniq page - include.
- Total visit in member profile - include.
- Function check for insert / update - each user - include.
- If want add userpic - possible.
- If want add avatar - possible.
- Test - 4images v1.74 - is test.
// Step 1
In ROOT_PATH , create file: member_viewprofile.php .
Add:
<?php
$main_template = "member_viewprofile";
define('ROOT_PATH', './');
include(ROOT_PATH . 'global.php');
require(ROOT_PATH . 'includes/sessions.php');
@include_once(ROOT_PATH . 'includes/page_header.php');
if ($user_info['user_level'] < USER) {
redirect($url);
}
if ($action == "") {
$action = "viewprofile";
}
if ($action == "viewprofile") {
$sql = "
SELECT SUM(uvp.view_count) AS total_visits
FROM " . USERS_VIEWPROFILE_TABLE . " uvp
LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = uvp.user_id)
WHERE uvp.other_user_id = " . $user_info['user_id'] . " AND " . get_user_table_field("u.", "user_level") . " >= '" . USER . "'
ORDER BY uvp.view_date DESC
";
$row = $site_db->query_firstrow($sql);
$total_visits = (isset($row['total_visits'])) ? (int)$row['total_visits'] : 0;
$sql = "
SELECT SUM(uvp.user_id) AS total_rows
FROM " . USERS_VIEWPROFILE_TABLE . " uvp
LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = uvp.user_id)
WHERE uvp.other_user_id = " . $user_info['user_id'] . " AND " . get_user_table_field("u.", "user_level") . " >= '" . USER . "'
ORDER BY uvp.view_date DESC
";
$row = $site_db->query_firstrow($sql);
$member_viewprofile_num_all = (isset($row['total_rows'])) ? (int)$row['total_rows'] : 0;
if (defined('MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION') && MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION == 1) {
@include_once(ROOT_PATH.'includes/paging.php');
$member_viewprofile_perpage = (defined('MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION') && MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION == 1 && defined('MEMBER_VIEWPROFILE_SET_PERPAGE') && MEMBER_VIEWPROFILE_SET_PERPAGE > 0) ? intval(trim(MEMBER_VIEWPROFILE_SET_PERPAGE)) : 0;
$link_arg = $site_sess->url(ROOT_PATH."member_viewprofile.php?action=viewprofile&".URL_USER_ID."=".intval(trim($user_info['user_id'])));
$text = preg_replace("/".$site_template->start."total_member_viewprofile_posts".$site_template->end."/siU", "{total_cat_images}", $lang['member_viewprofile_total_paging_result']);
$form = false;
$getpaging = new Paging($page, $member_viewprofile_perpage, $member_viewprofile_num_all, $link_arg, $text, '', '', '', '', $form);
$offset = (defined('MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION') && MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION == 1 && defined('MEMBER_VIEWPROFILE_SET_PERPAGE') && MEMBER_VIEWPROFILE_SET_PERPAGE > 0) ? $getpaging->get_offset() : "";
$site_template->register_vars(array(
"member_viewprofile_paging" => (defined('MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION') && MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION == 1 && defined('MEMBER_VIEWPROFILE_SET_PERPAGE') && MEMBER_VIEWPROFILE_SET_PERPAGE > 0) ? $getpaging->get_paging() : "",
"member_viewprofile_paging_stats" => (defined('MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION') && MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION == 1 && defined('MEMBER_VIEWPROFILE_SET_PERPAGE') && MEMBER_VIEWPROFILE_SET_PERPAGE > 0) ? $getpaging->get_paging_stats() : ""
));
$condition = (defined('MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION') && MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION == 1 && defined('MEMBER_VIEWPROFILE_SET_PERPAGE') && MEMBER_VIEWPROFILE_SET_PERPAGE > 0) ? "LIMIT ".$offset.", ".$member_viewprofile_perpage : "";
} else {
$no_paging_activated = $lang['member_viewprofile_total_paging_no_result'];
$site_template->register_vars("no_paging_activated", trim($no_paging_activated));
}
if (isset($additional_user_fields) && is_array($additional_user_fields) && !empty($additional_user_fields)) {
$additional_sql = "";
foreach ($additional_user_fields as $key => $val) {
$additional_sql .= ", u." . $key;
}
}
$sql = "
SELECT uvp.user_id, uvp.view_date, uvp.view_count" . get_user_table_field(", u.", "user_name") . $additional_sql . "
FROM " . USERS_VIEWPROFILE_TABLE . " uvp
LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = uvp.user_id)
WHERE uvp.other_user_id = " . $user_info['user_id'] . " AND " . get_user_table_field("u.", "user_level") . " >= '" . USER . "'
ORDER BY uvp.view_date DESC
" . ((isset($condition) && !empty($condition)) ? $condition : "");
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
if (isset($num_rows) && $num_rows <= 0) {
$msg = preg_replace("/" . $site_template->start . "user_name" . $site_template->end . "/siU", format_text(trim($user_info['user_name']), 2), $lang['member_viewprofile_no_content']);
} elseif (isset($num_rows) && $num_rows > 0) {
$viewprofile_content = "";
while ($view_row = $site_db->fetch_array($result)) {
$user_id = $view_row['user_id'];
$user_name = format_text(trim($view_row[$user_table_fields['user_name']]), 2);
$view_date = format_date($config['date_format'] . ", " . $config['time_format'], $view_row['view_date']);
$view_count = $view_row['view_count'];
$site_template->register_vars(array(
"user_id" => (isset($user_id)) ? $user_id : "",
"user_name" => (isset($user_name)) ? $user_name : "",
"user_url" => (isset($user_id)) ? $site_sess->url(ROOT_PATH . "member.php?action=showprofile&" . URL_USER_ID . "=" . $user_id) : "",
"view_date" => (isset($view_date)) ? $view_date : "",
"view_count" => (isset($view_count)) ? $view_count : ""
));
if (isset($additional_user_fields) && is_array($additional_user_fields) && !empty($additional_user_fields)) {
$additional_field_array = array();
foreach ($additional_user_fields as $key => $val) {
$additional_field_array[$key] = (!empty($view_row[$key])) ? format_text($view_row[$key], 1) : REPLACE_EMPTY;
$additional_field_array['lang_'.$key] = $val[0];
}
if (!empty($additional_field_array)) {
$site_template->register_vars($additional_field_array);
}
}
$viewprofile_content .= $site_template->parse_template("member_viewprofile_content");
}
}
}
$clickstream = "<a href=\"" . $site_sess->url(ROOT_PATH . "index.php") . "\">" . $lang['home'] . "</a>" . $config['category_separator'] . $lang['member_viewprofile_title'];
$site_template->register_vars(array(
"clickstream" => trim($clickstream),
"msg" => trim($msg),
"lang_member_viewprofile_title" => $lang['member_viewprofile_title'],
"lang_member_viewprofile_user_name" => $lang['member_viewprofile_user_name'],
"lang_member_viewprofile_view_date" => $lang['member_viewprofile_view_date'],
"lang_member_viewprofile_view_count" => $lang['member_viewprofile_view_count'],
"lang_member_viewprofile_total_visits" => $lang['member_viewprofile_total_visits_title'],
"lang_member_viewprofile_paging_stats_title" => $lang['member_viewprofile_paging_stats_title'],
"viewprofile_content" => (isset($viewprofile_content)) ? trim($viewprofile_content) : "",
"total_visits" => (isset($total_visits)) ? preg_replace("/" . $site_template->start . "total_visits" . $site_template->end . "/siU", $total_visits, $lang['member_viewprofile_total_visits']) : ""
));
$site_template->print_template($site_template->parse_template($main_template));
@include_once(ROOT_PATH . 'includes/page_footer.php');
?>
// Step 2
In member.php file,
find:
if ($user_row = get_user_info($user_id)) {
add after:
if (function_exists('member_viewprofile_check_user')) {
member_viewprofile_check_user($user_info['user_id'], $user_row[$user_table_fields['user_id']], $user_info['user_level']);
}
find:
else {
$user_email = REPLACE_EMPTY;
$user_email_save = REPLACE_EMPTY;
$user_mailform_link = REPLACE_EMPTY;
$user_email_button = REPLACE_EMPTY;
}
add after:
$sql = "
SELECT COUNT(uvp.view_count) AS total_rows
FROM " . USERS_VIEWPROFILE_TABLE . " uvp
LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = uvp.user_id)
WHERE uvp.other_user_id = " . $user_id;
$row = $site_db->query_firstrow($sql);
$total_views = (isset($row['total_rows'])) ? (int)$row['total_rows'] : 0;
find:
"user_comments" => (isset($user_row['user_comments'])) ? $user_row['user_comments'] : REPLACE_EMPTY,
add after:
"lang_member_viewprofile_from_profile" => $lang['member_viewprofile_from_profile'],
"member_viewprofile_from_profile_total_views" => (isset($total_views)) ? (int)$total_views : "",
// Step 3
In includes/constants.php file,
add in top ?>:
define('MEMBER_VIEWPROFILE_PERPAGE_ACTIVATION', 1); // Active: 1 - Inactive: 0.
define('MEMBER_VIEWPROFILE_SET_PERPAGE', 10); // Rows value per page.
find:
define('USERS_TABLE', $table_prefix.'users');
add after:
define('USERS_VIEWPROFILE_TABLE', $table_prefix . 'users_viewprofile');
// Step 4
In global.php file,
find:
$site_db = new Db($db_host, $db_user, $db_password, $db_name);
add after:
//-----------------------------------------------------
//--- Creates ignore users table ----------------------
//-----------------------------------------------------
if (function_exists('member_viewprofile_check_table')) {
member_viewprofile_check_table();
}
// Step 5
In lang/english/main.php file,
add in top ?>:
$lang['member_viewprofile_title'] = "Who viewed my profile";
$lang['member_viewprofile_no_content'] = "Sorry <b>{user_name}</b>, no users viewed your profile yet.";
$lang['member_viewprofile_user_name'] = "<b>Username</b>";
$lang['member_viewprofile_view_date'] = "<b>Date</b>";
$lang['member_viewprofile_view_count'] = "<b>Count</b>";
$lang['member_viewprofile_total_visits'] = "Total visits on your profile: {total_visits}";
$lang['member_viewprofile_total_visits_title'] = "Total visits";
$lang['member_viewprofile_paging_stats_title'] = "Statistics for this profile";
$lang['member_viewprofile_total_paging_result'] = "Found: {total_member_viewprofile_posts} visits on {total_pages} page(s).";
$lang['member_viewprofile_from_profile'] = "Total users who viewed my profile:";
// Step 6
In includes/functions.php file,
add in top ?>:
if (!function_exists('member_viewprofile_check_table')) {
function member_viewprofile_check_table() {
global $site_db, $table_prefix;
if (!defined('USERS_VIEWPROFILE_TABLE')) {
define('USERS_VIEWPROFILE_TABLE', $table_prefix . 'users_viewprofile');
}
$sql = "
CREATE TABLE IF NOT EXISTS " . USERS_VIEWPROFILE_TABLE . " (
field_id int(11) unsigned NOT NULL AUTO_INCREMENT,
user_id int(11) NOT NULL DEFAULT '0',
other_user_id int(11) NOT NULL DEFAULT '0',
view_date int(11) NOT NULL DEFAULT '0',
view_count int(11) NOT NULL DEFAULT '0',
PRIMARY KEY(field_id)
) TYPE=MyISAM;
";
$result = $site_db->query($sql);
}
}
if (!function_exists('member_viewprofile_check_user')) {
function member_viewprofile_check_user($user_id = 0, $other_user_id = 0, $user_level = GUEST) {
global $site_db;
$user_id = preg_replace("/[^0-9]+/i", "", $user_id);
$other_user_id = preg_replace("/[^0-9]+/i", "", $other_user_id);
$user_level = preg_replace("/[^0-9]+/i", "", $user_level);
if (empty($user_id) || empty($other_user_id) || $user_level == GUEST || $user_level == USER_AWAITING) {
return;
}
if ($user_id == $other_user_id) {
return;
}
$sql = "
SELECT uvp.user_id, uvp.other_user_id
FROM " . USERS_VIEWPROFILE_TABLE . " uvp
LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = uvp.user_id)
WHERE uvp.user_id = " . $user_id . " AND uvp.other_user_id = " . $other_user_id . " AND " . get_user_table_field("u.", "user_level") . " >= '" . USER . "'
";
$get_info = $site_db->query_firstrow($sql);
if (isset($get_info['user_id']) && $user_id == $get_info['user_id'] && isset($get_info['other_user_id']) && $other_user_id == $get_info['other_user_id']) {
$site_db->query("UPDATE " . USERS_VIEWPROFILE_TABLE . " SET view_count = view_count + 1, view_date = '" . time() . "' WHERE user_id = " . $user_id . " AND other_user_id = " . $other_user_id);
return $user_id;
return $other_user_id;
return $user_level;
} elseif (isset($get_info['user_id']) && $user_id != $get_info['user_id'] && isset($get_info['other_user_id']) && $other_user_id != $get_info['other_user_id']) {
$sql = "
INSERT INTO " . USERS_VIEWPROFILE_TABLE . "
(field_id, user_id, other_user_id, view_date, view_count)
VALUES(NULL, '" . $user_id . "', '" . $other_user_id . "', '" . time() . "', '1')
";
$result = $site_db->query($sql);
return $user_id;
return $other_user_id;
return $user_level;
} elseif (!$site_db->not_empty($sql)) {
$sql = "
INSERT INTO " . USERS_VIEWPROFILE_TABLE . "
(field_id, user_id, other_user_id, view_date, view_count)
VALUES(NULL, '" . $user_id . "', '" . $other_user_id . "', '" . time() . "', '1')
";
$result = $site_db->query($sql);
return $user_id;
return $other_user_id;
return $user_level;
}
}
}
// Step 7
In templates/your_template - create file: member_viewprofile.html .
(Note: I use ULM)
Add:
{header}
{ste_layout_top}
{ste_layout_left}
{if is_admin}<! -- Who viewed my profile -- >{endif is_admin}
{if msg}{ifno viewprofile_content}
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="head1">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="head1" valign="top">{lang_member_viewprofile_title}</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="row2" align="center" /><br /><b>{msg}</b><br /><br /></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="head2"> </td>
</tr>
</table>
<br />
{endifno viewprofile_content}{endif msg}
{if is_admin}<! -- End - Who viewed my profile -- >{endif is_admin}
{if is_admin}<! -- Who viewed my profile -- >{endif is_admin}
{ifno msg}{if viewprofile_content}
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="head1">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" class="head1" valign="top">{lang_member_viewprofile_title}</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" class="row2"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" class="head1" valign="top">{lang_member_viewprofile_total_visits}</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" class="row2" valign="top" align="center" />{if total_visits}<br />{total_visits}{endif total_visits}</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" class="row2"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" class="head1" valign="top">{lang_member_viewprofile_paging_stats_title}</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" class="row2" align="center" /><br />{member_viewprofile_paging_stats}<br /></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" class="row2"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="head2"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" class="row2"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" class="row2" align="right" />{member_viewprofile_paging}</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="33%" class="head1" align="center" valign="top">{lang_member_viewprofile_user_name}</td>
<td width="33%" class="head1" align="center" valign="top">{lang_member_viewprofile_view_date}</td>
<td width="33%" class="head1" align="center" valign="top">{lang_member_viewprofile_view_count}</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" border="1" cellspacing="0" cellpadding="0" class="tablebottom">
{viewprofile_content}
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="row2"> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="head2"> </td>
</tr>
</table>
<br />
{endif viewprofile_content}{endifno msg}
{if is_admin}<! -- End - Who viewed my profile -- >{endif is_admin}
{ste_layout_below}
{footer}
// Step 8
In templates/your_template - create file: member_viewprofile_content.html .
(Note: I use ULM)
Add:
<tr>
<td width="33%" class="row2" align="center"><a href="{user_url}" class="link" />{user_name}</a></td>
<td width="33%" class="row2" align="center">{view_date}</td>
<td width="33%" class="row2" align="center">{view_count}</td>
</tr>
// Step 9
In templates/your_template/member_profile.html file,
find:
<tr>
<td class="row2"><b>{lang_icq}</b></td>
<td class="row2">{if user_icq}<a href="http://www.icq.com/people/about_me.php?uin={user_icq}" target="_blank">{user_icq}</a> (<b>{user_icq_status}</b>){endif user_icq}</td>
</tr>
add after:
{if member_viewprofile_from_profile_total_views}
<tr>
<td class="row1"><b>{lang_member_viewprofile_from_profile}</b></td>
<td class="row1">{member_viewprofile_from_profile_total_views}</td>
</tr>
{endif member_viewprofile_from_profile_total_views}
// Step 10
In includes/page_header.php file,
find:
"url_captcha_image" => $site_sess->url(ROOT_PATH."captcha.php"),
add after:
"url_member_viewprofile" => $site_sess->url(ROOT_PATH . "member_viewprofile.php"),
find:
"lang_images_per_page" => $lang['images_per_page'],
add after:
"lang_member_viewprofile_title" => $lang['member_viewprofile_title'],
// Step 11
In templates/your_template/user_logininfo.html file,
find:
» <a href="{url_control_panel}">{lang_control_panel}</a><br />
add after:
» <a href="{url_member_viewprofile}">{lang_member_viewprofile_title}</a><br />
Finish.
-
yeah... i moved to the wrong forum :mrgreen:
sticked
thank you
-
Ok - I edit topic - I add step 10 and step 11.
yeah... i moved to the wrong forum :mrgreen:
sticked
thank you
Oh ! so is you ? Ok, I get. :mrgreen:
-
I edit step 1 of first post.
-
Hi Thunderstrike,
i tried this long script..
when i click in my profil "who visit my profile" i get the following error:
DB Error: Bad SQL Query: SELECT SUM(uvp.view_count) AS total_visits FROM 4images_users_viewprofile uvp LEFT JOIN 4images_users u ON (u.user_id = uvp.user_id) WHERE uvp.other_user_id = 3 AND u.user_level >= '2' ORDER BY uvp.view_date DESC
Table 'ekarten.4images_users_viewprofile' doesn't exist
DB Error: Bad SQL Query: SELECT SUM(uvp.user_id) AS total_rows FROM 4images_users_viewprofile uvp LEFT JOIN 4images_users u ON (u.user_id = uvp.user_id) WHERE uvp.other_user_id = 3 AND u.user_level >= '2' ORDER BY uvp.view_date DESC
Table 'ekarten.4images_users_viewprofile' doesn't exist
DB Error: Bad SQL Query: SELECT uvp.user_id, uvp.view_date, uvp.view_count, u.user_name, u.user_avatar, u.user_birth_day, u.user_birth_month, u.user_birth_year, u.user_posts, u.profile_hits, u.user_hobby, u.user_country, u.user_gender, u.user_leitsatz, u.user_pm_inbox, u.user_pm_sentbox, u.user_pm_email, u.user_pm_popup FROM 4images_users_viewprofile uvp LEFT JOIN 4images_users u ON (u.user_id = uvp.user_id) WHERE uvp.other_user_id = 3 AND u.user_level >= '2' ORDER BY uvp.view_date DESC
Table 'ekarten.4images_users_viewprofile' doesn't exist
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /www/htdocs/ekarten/pics/includes/db_mysql.php on line 116
But i use the Version 1.7.1
i hope i can the script also use...#
very great idea!!
the second thing is..
that i have the line in member.php
3 times:
if ($user_row = get_user_info($user_id)) {
in which part i have to put it in?
and i don´t have the part
"url_captcha_image" => $site_sess->url(ROOT_PATH."captcha.php"),
in my page header...
-
DB Error: Bad SQL Query: SELECT SUM(uvp.view_count) AS total_visits FROM 4images_users_viewprofile uvp LEFT JOIN 4images_users u ON (u.user_id = uvp.user_id) WHERE uvp.other_user_id = 3 AND u.user_level >= '2' ORDER BY uvp.view_date DESC
Table 'ekarten.4images_users_viewprofile' doesn't exist
DB Error: Bad SQL Query: SELECT SUM(uvp.user_id) AS total_rows FROM 4images_users_viewprofile uvp LEFT JOIN 4images_users u ON (u.user_id = uvp.user_id) WHERE uvp.other_user_id = 3 AND u.user_level >= '2' ORDER BY uvp.view_date DESC
Table 'ekarten.4images_users_viewprofile' doesn't exist
DB Error: Bad SQL Query: SELECT uvp.user_id, uvp.view_date, uvp.view_count, u.user_name, u.user_avatar, u.user_birth_day, u.user_birth_month, u.user_birth_year, u.user_posts, u.profile_hits, u.user_hobby, u.user_country, u.user_gender, u.user_leitsatz, u.user_pm_inbox, u.user_pm_sentbox, u.user_pm_email, u.user_pm_popup FROM 4images_users_viewprofile uvp LEFT JOIN 4images_users u ON (u.user_id = uvp.user_id) WHERE uvp.other_user_id = 3 AND u.user_level >= '2' ORDER BY uvp.view_date DESC
Table 'ekarten.4images_users_viewprofile' doesn't exist
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /www/htdocs/ekarten/pics/includes/db_mysql.php on line 116
You miss Step 4 in first post. If no add in global, function is no check for create SQL table.
if ($user_row = get_user_info($user_id)) {
I say in first post ... add after line.
"url_captcha_image" => $site_sess->url(ROOT_PATH."captcha.php"),
This is right - so for you - find:
"url_lost_password" => (!empty($url_lost_password)) ? $site_sess->url($url_lost_password) : $site_sess->url(ROOT_PATH."member.php?action=lostpassword"),
add after:
"url_member_viewprofile" => $site_sess->url(ROOT_PATH . "member_viewprofile.php"),
(for lang in page_header step - is same in v1.71 and v1.74).
-
HI Thunderstrike
i tried it once again, but i get the same error
Do i have to create anywhere the table user_viewpriofile?
It did not create itself with "global.php"
"DB Error: Bad SQL Query: SELECT SUM(uvp.view_count) AS total_visits FROM 4images_users_viewprofile uvp LEFT JOIN 4images_users u ON (u.user_id = uvp.user_id) WHERE uvp.other_user_id = 3 AND u.user_level >= '2' ORDER BY uvp.view_date DESC
Table 'ekarten.4images_users_viewprofile' doesn't exist
DB Error: Bad SQL Query: SELECT SUM(uvp.user_id) AS total_rows FROM 4images_users_viewprofile uvp LEFT JOIN 4images_users u ON (u.user_id = uvp.user_id) WHERE uvp.other_user_id = 3 AND u.user_level >= '2' ORDER BY uvp.view_date DESC
Table 'ekarten.4images_users_viewprofile' doesn't exist
DB Error: Bad SQL Query: SELECT uvp.user_id, uvp.view_date, uvp.view_count, u.user_name, u.user_avatar, u.user_birth_day, u.user_birth_month, u.user_birth_year, u.user_posts, u.profile_hits, u.user_hobby, u.user_country, u.user_gender, u.user_leitsatz, u.user_pm_inbox, u.user_pm_sentbox, u.user_pm_email, u.user_pm_popup FROM 4images_users_viewprofile uvp LEFT JOIN 4images_users u ON (u.user_id = uvp.user_id) WHERE uvp.other_user_id = 3 AND u.user_level >= '2' ORDER BY uvp.view_date DESC LIMIT 0, 10
Table 'ekarten.4images_users_viewprofile' doesn't exist
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /www/htdocs/ekarten/pics/includes/db_mysql.php on line 116
"
I have also uploadet the recent Upload.php.
And i wrote that i have the Code if ($user_row = get_user_info($user_id)) { is 3 Times in my Members.php !! After which one i have to put in the code if (function_exists('member_viewprofile_check_user')) {
member_viewprofile_check_user($user_info['user_id'], $user_row[$user_table_fields['user_id']], $user_info['user_level']);
}
please help!! i want to use the new cool script
Thank you :(
glitzer
-
please help!! i want to use the new cool script
Please post step 1-2-3 of my signature. I no can see problem if I use.
-
Hi thunderstrike
4Images Verison 1.7.1
My SQLs admin 3.23
Php 4.4.1
Thanks,
glitzer
-
My SQLs admin 3.23
1 - Easy problem. mySQL v3.23 is no work right with PHP 4.4+ . Ask host for upgrade mySQL version.
2 - If use 4images v1.71, please read first post for MOD test for 4images version.
-
:( thanks
-
Did anybody added this mod sucesful?
-
Did anybody added this mod sucesful?
This MOD is work purfect.
-
Did anybody added this mod sucesful?
This MOD is work purfect.
@ thunderstike: Any demo of thos mod available?
-
god mod :lol: :lol:
-
:flag-en:Update code to 1.7.6?
:flag-de:wird der Code auf 1.7.6 geupdated?
:flag-en:This is not shown if a user my profile gone. Nothing is displayed also in the member profile. Is it due to me or due to the modification?
:flag-de:Wenn ein User mein Profilbesucht, wird dies nicht angezeigt. Auch im memberprofil wird nichts angezeigt. Liegt es an mir oder an der Modifikation?
-
@ Phisker B
Ich hab den Mod eben auf einer Base mit V1.7.6, mit ca. 10 weiteren darin laufenden Mods, integriert so wie hier in Post 1 beschrieben und läuft soweit ich bis jetzt gecheckt habe problemlos mi der V1.7.6 ;)
Muss nur noch die Langs von Englisch nach deutsch übersetzen.
Zu sehen z.B. hier in der blauen Table-Zelle: http://www.modkon-germany.de/modelgalerie/member.php?action=showprofile&user_id=4
LG euer Jasi
-
Hallo,
habe es gerade auf der 4images 1.7.7 getestet, aber auch da, sehe ich leider keine Aufrufe im Profil oder in der Übersicht. Kann da niemand weiterhelfen?
Würde das gerne nutzen, kann das nicht jemand umschreiben?
--------------
Hello,
does it have on the 4images 1.7.7 tested, but also because I see no calls in the profile or in the overview. Because nobody can help?
Would like to use, can not describe someone?
-
Kann da niemand weiterhelfen? :(
Edit://
Hat das niemand eingebaut?
Also der Einbau klappte wunderbar, die Tabellen sind auch da, aber warum wird nichts gespeichert?
Bei mir steht immer, dass niemand mein Profil angesehen hat!
Edit//
Help me , Help Me
Bitte um Hilfe. Alles klappt soweit, aber angezeigt wird mir nichts!
-
Kann da niemand weiterhelfen? :(
Edit://
Hat das niemand eingebaut?
Also der Einbau klappte wunderbar, die Tabellen sind auch da, aber warum wird nichts gespeichert?
Bei mir steht immer, dass niemand mein Profil angesehen hat!
Edit//
Help me , Help Me
Bitte um Hilfe. Alles klappt soweit, aber angezeigt wird mir nichts!
Hat sich Dein Problem inzwischen gelöst? Ich würde die MOD auch gerne verwenden.
Wenn sie unter 1.7.7 nicht funktioniert macht das natürlich keinen Sinn. :?
-
im Moment ist mir nicht klar, wo das gespeichert werden soll, oder steht hier wie man die Tabelle 'users_viewprofile' anlegen soll :wink:
wenn man wüsste was diese enthalten soll, könnte man diese ja anlegen, dann würde es auch gespeichert
-
im Moment ist mir nicht klar, wo das gespeichert werden soll, oder steht hier wie man die Tabelle 'users_viewprofile' anlegen soll :wink:
wenn man wüsste was diese enthalten soll, könnte man diese ja anlegen, dann würde es auch gespeichert
Steht das nicht in Step6?
if (!function_exists('member_viewprofile_check_table')) {
function member_viewprofile_check_table() {
global $site_db, $table_prefix;
if (!defined('USERS_VIEWPROFILE_TABLE')) {
define('USERS_VIEWPROFILE_TABLE', $table_prefix . 'users_viewprofile');
}
$sql = "
CREATE TABLE IF NOT EXISTS " . USERS_VIEWPROFILE_TABLE . " (
field_id int(11) unsigned NOT NULL AUTO_INCREMENT,
user_id int(11) NOT NULL DEFAULT '0',
other_user_id int(11) NOT NULL DEFAULT '0',
view_date int(11) NOT NULL DEFAULT '0',
view_count int(11) NOT NULL DEFAULT '0',
PRIMARY KEY(field_id)
) TYPE=MyISAM;
";
$result = $site_db->query($sql);
}
}
if (!function_exists('member_viewprofile_check_user')) {
function member_viewprofile_check_user($user_id = 0, $other_user_id = 0, $user_level = GUEST) {
global $site_db;
$user_id = preg_replace("/[^0-9]+/i", "", $user_id);
$other_user_id = preg_replace("/[^0-9]+/i", "", $other_user_id);
$user_level = preg_replace("/[^0-9]+/i", "", $user_level);
if (empty($user_id) || empty($other_user_id) || $user_level == GUEST || $user_level == USER_AWAITING) {
return;
}
if ($user_id == $other_user_id) {
return;
}
$sql = "
SELECT uvp.user_id, uvp.other_user_id
FROM " . USERS_VIEWPROFILE_TABLE . " uvp
LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = uvp.user_id)
WHERE uvp.user_id = " . $user_id . " AND uvp.other_user_id = " . $other_user_id . " AND " . get_user_table_field("u.", "user_level") . " >= '" . USER . "'
";
$get_info = $site_db->query_firstrow($sql);
if (isset($get_info['user_id']) && $user_id == $get_info['user_id'] && isset($get_info['other_user_id']) && $other_user_id == $get_info['other_user_id']) {
$site_db->query("UPDATE " . USERS_VIEWPROFILE_TABLE . " SET view_count = view_count + 1, view_date = '" . time() . "' WHERE user_id = " . $user_id . " AND other_user_id = " . $other_user_id);
return $user_id;
return $other_user_id;
return $user_level;
} elseif (isset($get_info['user_id']) && $user_id != $get_info['user_id'] && isset($get_info['other_user_id']) && $other_user_id != $get_info['other_user_id']) {
$sql = "
INSERT INTO " . USERS_VIEWPROFILE_TABLE . "
(field_id, user_id, other_user_id, view_date, view_count)
VALUES(NULL, '" . $user_id . "', '" . $other_user_id . "', '" . time() . "', '1')
";
$result = $site_db->query($sql);
return $user_id;
return $other_user_id;
return $user_level;
} elseif (!$site_db->not_empty($sql)) {
$sql = "
INSERT INTO " . USERS_VIEWPROFILE_TABLE . "
(field_id, user_id, other_user_id, view_date, view_count)
VALUES(NULL, '" . $user_id . "', '" . $other_user_id . "', '" . time() . "', '1')
";
$result = $site_db->query($sql);
return $user_id;
return $other_user_id;
return $user_level;
}
}
}
-
jetzt wo du es sagst, aber was macht es da, oder wird jetzt schon über die funktions.php eine Tabelle erstellt :o
schaue in deine Datenbank, ist sie da OK, wenn nicht erslle diese
-
jetzt wo du es sagst, aber was macht es da, oder wird jetzt schon über die funktions.php eine Tabelle erstellt :o
schaue in deine Datenbank, ist sie da OK, wenn nicht erslle diese
Wie gesagt, ICH hab ja nicht das Problem (denn ich habe die MOD noch nicht), meine Frage war ja nur, ob das Problem geklärt ist, weil ich die MOD installieren möchte. 8O
-
ich habs ja auch nicht drauf :wink:
edit:
also, die Datenbanktabelle wird definitiv nicht angelegt
-
Also selber einfügen.. funzt es denn dann?
-
im Moment ist mir nicht klar, wo das gespeichert werden soll, oder steht hier wie man die Tabelle 'users_viewprofile' anlegen soll :wink:
wenn man wüsste was diese enthalten soll, könnte man diese ja anlegen, dann würde es auch gespeichert
Hier das SQL für die MySQL-Datenbank:
DROP TABLE IF EXISTS 4images_users_viewprofile ;
CREATE TABLE 4images_users_viewprofile (
field_id int(11) unsigned NOT NULL AUTO_INCREMENT,
user_id int(11) NOT NULL DEFAULT '0',
other_user_id int(11) NOT NULL DEFAULT '0',
view_date int(11) NOT NULL DEFAULT '0',
view_count int(11) NOT NULL DEFAULT '0',
PRIMARY KEY(field_id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;