Author Topic: last visite member  (Read 13066 times)

0 Members and 1 Guest are viewing this topic.

Offline masterred

  • Sr. Member
  • ****
  • Posts: 494
    • View Profile
last visite member
« on: February 14, 2008, 10:06:39 AM »

hi

It is possible to add the day or date of the last visit of the user in the user profile or the day that update your profile

thanks
Apache/2.2.21 (Win32)
PHP/5.3.5
Mysql Version: 5.5.19
4images Version: 1.7.?



Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: last visite member
« Reply #1 on: February 14, 2008, 01:08:52 PM »
// Step 1

In includes/functions.php file,

add in top ?>:

Code: [Select]
if (!function_exists('update_last_profile_visited')) {
function update_last_profile_visited($user_id, $profile_visited) {
global $site_db, $config;

$result = $site_db->query("UPDATE " . USERS_TABLE . " SET " . $profile_visited . " = '" . time() . "' WHERE " . get_user_table_field("", "user_id") . " = " . $user_id);
if ($result) {

$sql = "

SELECT " . $profile_visited . "
FROM " . USERS_TABLE . "
WHERE " . get_user_table_field("", "user_id") . " = " . $user_id;

$date_row = $site_db->query_firstrow($sql);
if (isset($date_row[$profile_visited]) && !empty($date_row[$profile_visited])) {
if (function_exists('get_universal_field_date')) {
return get_universal_field_date($profile_visited);
} else {
return format_date($config['date_format'] . " " . $config['time_format'], $profile_visited);
}
}
}
}
}

// Step 2

In includes/db_field_definitions.php file,

add in top ?>:

Code: [Select]
$additional_user_fields['last_time_profile_visited'] = array($lang['last_time_profile_visited'], "text", 0);

// Step 3

In member.php file,

find:

Code: [Select]
"user_last_action" => (isset($user_row['user_lastaction'])) ? format_date($config['date_format']." ".$config['time_format'], $user_row['user_lastaction']) : REPLACE_EMPTY,

add after:

Code: [Select]
"last_time_profile_visited" => (isset($user_row['last_time_profile_visited']) && !empty($user_row['last_time_profile_visited']) && function_exists('update_last_profile_visited')) ? update_last_profile_visited($user_row['user_id'], $user_row['last_time_profile_visited']) : "",
"lang_last_time_profile_visited => $lang['last_time_profile_visited'],

// Step 3

In lang/main.php file,

add in top ?>:

Code: [Select]
$lang['last_time_profile_visited'] = "Last time profile visited";

// Step 4

In templates/your_template/member_profile.html file, use: {if last_time_profile_visited}{lang_last_time_profile_visited}{last_time_profile_visited}{endif last_time_profile_visited} where you like. ;)

// Step 5

In SQL patches (expert mode) - add:

Code: [Select]
ALTER TABLE `4images_users` ADD last_time_profile_visited INT(11) NOT NULL DEFAULT '0';

Finish.
« Last Edit: February 15, 2008, 01:41:16 AM by thunderstrike »
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline masterred

  • Sr. Member
  • ****
  • Posts: 494
    • View Profile
Re: last visite member
« Reply #2 on: February 14, 2008, 08:32:00 PM »
Code: [Select]
[code][quote author=thunderstrike link=topic=20516.msg111620#msg111620 date=1202990932]
// Step 1

In includes/functions.php file,

add in top ?>:

[code]
if (!function_exists('update_last_profile_visited')) {
function update_last_profile_visited($user_id, $profile_visited) {
global $site_db, $config;

$result = $site_db->query("UPDATE " . USERS_TABLE . " SET " . $profile_visited . " = '" . time() . "' WHERE " . get_user_table_field("", "user_id") . " = " . $user_id);
if ($result) {

$sql = "

SELECT " . $profile_visited . "
FROM " . USERS_TABLE . "
WHERE " . get_user_table_field("", "user_id") . " = " . $user_id;

$date_row = $site_db->query_firstrow($sql);
if (isset($date_row[$profile_visited]) && !empty($date_row[$profile_visited])) {
if (function_exists('get_universal_field_date')) {
return get_universal_field_date($profile_visited);
} else {
return format_date($config['date_format'] . " " . $config['time_format'], $profile_visited);
}
}
}
}
}

// Step 2

In includes/db_field_definitions.php file,

add in top ?>:

Code: [Select]
$additional_user_fields['last_time_profile_visited'] = array($lang['last_time_profile_visited'], "text", 0);

// Step 3

In member.php file,

find:

Code: [Select]
"user_last_action" => (isset($user_row['user_lastaction'])) ? format_date($config['date_format']." ".$config['time_format'], $user_row['user_lastaction']) : REPLACE_EMPTY,

add after:

Code: [Select]
"last_time_profile_visited" => (isset($user_row['last_time_profile_visited']) && !empty($user_row['last_time_profile_visited']) && function_exists('update_last_profile_visited')) ? update_last_profile_visited($user_row['user_id'], $user_row['last_time_profile_visited']) : "",
"lang_last_time_profile_visited => $lang['last_time_profile_visited'],

// Step 3

In lang/main.php file,

add in top ?>:

Code: [Select]
$lang['last_time_profile_visited'] = "Last time profile visited";

// Step 4

In templates/your_template/member_profile.html file, use: {if last_time_profile_visited}{lang_last_time_profile_visited}{last_time_profile_visited}{endif last_time_profile_visited} where you like. ;)

Finish.
[/quote]

Quote
hi on this line

Code: [Select]
"last_time_profile_visited" => (isset($user_row['last_time_profile_visited']) && !empty($user_row['last_time_profile_visited']) && function_exists('update_last_profile_visited')) ? update_last_profile_visited($user_row['user_id'], $user_row['last_time_profile_visited']) : "",
"lang_last_time_profile_visited => $lang['last_time_profile_visited'],

modify to  this

[/code]"last_time_profile_visited" => (isset($user_row['last_time_profile_visited']) && !empty($user_row['last_time_profile_visited']) && function_exists('update_last_profile_visited')) ? update_last_profile_visited($user_row['user_id'], $user_row['last_time_profile_visited']) : "",
"lang_last_time_profile_visited" => $lang['last_time_profile_visited'],
[/code]

only add this " here

"lang_last_time_profile_visited" => $lang['last_time_profile_visited'],

i see
Apache/2.2.21 (Win32)
PHP/5.3.5
Mysql Version: 5.5.19
4images Version: 1.7.?



Offline masterred

  • Sr. Member
  • ****
  • Posts: 494
    • View Profile
Re: last visite member
« Reply #3 on: February 14, 2008, 09:04:38 PM »
hi

i have this problem in top.php because for ?

Quote
DB Error: Bad SQL Query: SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_rating, i.image_votes, c.cat_name, u.user_name , u.user_hobbies, u.last_time_profile_visited FROM (4images_images i, 4images_categories c) LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND i.cat_id NOT IN (0) AND i.cat_id = c.cat_id ORDER BY i.image_votes DESC, i.image_name ASC LIMIT 10
Unknown column 'u.last_time_profile_visited' in 'field list'
 

i need create table on DB?
Apache/2.2.21 (Win32)
PHP/5.3.5
Mysql Version: 5.5.19
4images Version: 1.7.?



Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: last visite member
« Reply #4 on: February 15, 2008, 12:46:03 AM »
Code: [Select]
[code][quote author=thunderstrike link=topic=20516.msg111620#msg111620 date=1202990932]
// Step 1

In includes/functions.php file,

add in top ?>:

[code]
if (!function_exists('update_last_profile_visited')) {
function update_last_profile_visited($user_id, $profile_visited) {
global $site_db, $config;

$result = $site_db->query("UPDATE " . USERS_TABLE . " SET " . $profile_visited . " = '" . time() . "' WHERE " . get_user_table_field("", "user_id") . " = " . $user_id);
if ($result) {

$sql = "

SELECT " . $profile_visited . "
FROM " . USERS_TABLE . "
WHERE " . get_user_table_field("", "user_id") . " = " . $user_id;

$date_row = $site_db->query_firstrow($sql);
if (isset($date_row[$profile_visited]) && !empty($date_row[$profile_visited])) {
if (function_exists('get_universal_field_date')) {
return get_universal_field_date($profile_visited);
} else {
return format_date($config['date_format'] . " " . $config['time_format'], $profile_visited);
}
}
}
}
}

// Step 2

In includes/db_field_definitions.php file,

add in top ?>:

Code: [Select]
$additional_user_fields['last_time_profile_visited'] = array($lang['last_time_profile_visited'], "text", 0);

// Step 3

In member.php file,

find:

Code: [Select]
"user_last_action" => (isset($user_row['user_lastaction'])) ? format_date($config['date_format']." ".$config['time_format'], $user_row['user_lastaction']) : REPLACE_EMPTY,

add after:

Code: [Select]
"last_time_profile_visited" => (isset($user_row['last_time_profile_visited']) && !empty($user_row['last_time_profile_visited']) && function_exists('update_last_profile_visited')) ? update_last_profile_visited($user_row['user_id'], $user_row['last_time_profile_visited']) : "",
"lang_last_time_profile_visited => $lang['last_time_profile_visited'],

// Step 3

In lang/main.php file,

add in top ?>:

Code: [Select]
$lang['last_time_profile_visited'] = "Last time profile visited";

// Step 4

In templates/your_template/member_profile.html file, use: {if last_time_profile_visited}{lang_last_time_profile_visited}{last_time_profile_visited}{endif last_time_profile_visited} where you like. ;)

Finish.

Quote
hi on this line

Code: [Select]
"last_time_profile_visited" => (isset($user_row['last_time_profile_visited']) && !empty($user_row['last_time_profile_visited']) && function_exists('update_last_profile_visited')) ? update_last_profile_visited($user_row['user_id'], $user_row['last_time_profile_visited']) : "",
"lang_last_time_profile_visited => $lang['last_time_profile_visited'],

modify to  this

[/code]"last_time_profile_visited" => (isset($user_row['last_time_profile_visited']) && !empty($user_row['last_time_profile_visited']) && function_exists('update_last_profile_visited')) ? update_last_profile_visited($user_row['user_id'], $user_row['last_time_profile_visited']) : "",
"lang_last_time_profile_visited" => $lang['last_time_profile_visited'],
[/code]

Quote
only add this " here

"lang_last_time_profile_visited" => $lang['last_time_profile_visited'],

i see


and ... problem for this post ?

Quote
i have this problem in top.php because for

[edit] - I find problem. I add step 5. ;)
« Last Edit: February 15, 2008, 01:39:41 AM by thunderstrike »
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline masterred

  • Sr. Member
  • ****
  • Posts: 494
    • View Profile
Re: last visite member
« Reply #5 on: February 15, 2008, 04:42:32 AM »
hi

Because already modify and create the entire table in the database and nothing, I did not see anything, nor visitandolo offline or online, I created a user test to check and nothing without results.

thank
Apache/2.2.21 (Win32)
PHP/5.3.5
Mysql Version: 5.5.19
4images Version: 1.7.?



Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: last visite member
« Reply #6 on: February 15, 2008, 05:59:40 AM »
You add step 5 ? If so, is no possible for empty result ...
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline masterred

  • Sr. Member
  • ****
  • Posts: 494
    • View Profile
Re: last visite member
« Reply #7 on: February 15, 2008, 06:43:03 AM »
hi

yes add step 5 and nothing

data base



member_profile.html




i see

the install is clean no more MOD

Apache/2.2.21 (Win32)
PHP/5.3.5
Mysql Version: 5.5.19
4images Version: 1.7.?



Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: last visite member
« Reply #8 on: February 15, 2008, 03:45:30 PM »
I no see in my step for where add change in SQL line. Please read step 5.

For top.php file, please post SQL query for this problem:

Quote
DB Error: Bad SQL Query: SELECT i.image_id, i.user_id, i.cat_id, i.image_name, i.image_rating, i.image_votes, c.cat_name, u.user_name , u.user_hobbies, u.last_time_profile_visited FROM (4images_images i, 4images_categories c) LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND i.cat_id NOT IN (0) AND i.cat_id = c.cat_id ORDER BY i.image_votes DESC, i.image_name ASC LIMIT 10
Unknown column 'u.last_time_profile_visited' in 'field list'
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline masterred

  • Sr. Member
  • ****
  • Posts: 494
    • View Profile
Re: last visite member
« Reply #9 on: February 16, 2008, 04:16:17 AM »
hi

Look, the error of the DB or sql, salio to make changes in the files that I indicastes In includes / functions.php file, In includes / db_field_definitions.php file, In member.php file, In lang / main.php file , and that mistake member_profile.html me salio in top.php because it is not, when I put you indicated to me the error in top.php of SQL, we indicated that if it was missing create the table on the basis of data. After modificastes and agregastes step five, once we have the table disappeared in the judgement error sql. But even so it does not show results in the file member_profile.html, modification was made in a new gallery, without further modification.

this is you step 5

http://www.imagehosting.com/out.php/i1580919_dbcreate.jpg , add this in Db

NOTE error appeared before the added step 5

i see
Apache/2.2.21 (Win32)
PHP/5.3.5
Mysql Version: 5.5.19
4images Version: 1.7.?



Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: last visite member
« Reply #10 on: February 16, 2008, 04:46:21 AM »
Again - what is source code for SQL in top.php file ? Please post query - I check.

Quote
this is you step 5

http://www.imagehosting.com/out.php/i1580919_dbcreate.jpg , add this in Db

Again - I no see change in step 5. Is no my instruction. I say for ALTER table and add - no use of change nowhere.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline masterred

  • Sr. Member
  • ****
  • Posts: 494
    • View Profile
Re: last visite member
« Reply #11 on: February 16, 2008, 07:50:01 AM »
hi

you post date (« Reply #1 on: 14-02-2008, 05:08:52 ») The modification was performed perfectly with all five steps. Only that it has no results, entered as a user entered as evidence after admin revisit the user profile trial and has no notification of when was the last time you edit or visit your profile does not date
Apache/2.2.21 (Win32)
PHP/5.3.5
Mysql Version: 5.5.19
4images Version: 1.7.?



Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: last visite member
« Reply #12 on: February 16, 2008, 02:09:55 PM »
Quote
the user profile trial and has no notification of when was the last time you edit or visit your profile does not date

No, this is right ... user is no get email for notify ... is load of send email for server ... host is no like this but if say you no see date update for each visit, please post URL to member profile and I check.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline masterred

  • Sr. Member
  • ****
  • Posts: 494
    • View Profile
Re: last visite member
« Reply #13 on: February 17, 2008, 07:03:30 AM »
hi

work in localhost
Apache/2.2.21 (Win32)
PHP/5.3.5
Mysql Version: 5.5.19
4images Version: 1.7.?



Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: last visite member
« Reply #14 on: February 17, 2008, 02:39:49 PM »
Quote
work in localhost

Ok ... ?
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?