Author Topic: [Mod] New images since last visit  (Read 56093 times)

0 Members and 1 Guest are viewing this topic.

Offline jengwen

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
    • http://www.jenrichardsphotography.com
[Mod] New images since last visit
« on: March 15, 2003, 07:40:18 AM »
This mod will show logged in users all images added since their last visit.  If not logged on, it will work the same as the 'New Images' link.

search.php (if you are using 4images v1.7.2 or newer, the following two changes must be done in global.php instead)
find:
Code: [Select]
if (isset($HTTP_POST_VARS['search_new_images']) || isset($HTTP_GET_VARS['search_new_images'])) {
  $search_new_images = 1;
comment out or remove:  
Code: [Select]
$search_new_images = 1;add after:
Code: [Select]
 $search_new_images = (isset($HTTP_POST_VARS['search_new_images'])) ? trim($HTTP_POST_VARS['search_new_images']) : urldecode(trim($HTTP_GET_VARS['search_new_images']));Note:  Need this change because otherwise whatever was passed in got overidden with 1

search.php
find:
Code: [Select]
if ($search_new_images && $show_result == 1) {
  $search_id['search_new_images'] = 1;
}
add after:
Code: [Select]
if ($search_new_images == 2) {
  $search_id['search_new_images'] = 2;
}
find:
Code: [Select]
if (!empty($search_id['search_new_images']) && $search_id['search_new_images'] == 1) {
    $new_cutoff = time() - 60 * 60 * 24 * $config['new_cutoff'];
    $sql_where_query .= "AND i.image_date >= $new_cutoff ";
  }
add after:
Code: [Select]
if (!empty($search_id['search_new_images']) && $search_id['search_new_images'] == 2) {
     if ($user_info['user_level'] != GUEST) {        
         $new_cutoff = $user_info['user_lastvisit'];
     }
     else {  
         $new_cutoff = time() - 60 * 60 * 24 * $config['new_cutoff'];  
     }
    $sql_where_query .= "AND i.image_date >= $new_cutoff ";
  }

page_header.php
find:
Code: [Select]
"url_new_images" => $site_sess->url(ROOT_PATH."search.php?search_new_images=1"),add after:
Code: [Select]
"url_new_images_last" => $site_sess->url(ROOT_PATH."search.php?search_new_images=2"),find:
Code: [Select]
"lang_new_images" => $lang['new_images'],add after:
Code: [Select]
"lang_new_images_last" => $lang['new_images_last'],
lang/xxx/main.php
find:
Code: [Select]
$lang['new_images'] = "New images";add after:
Code: [Select]
$lang['new_images_last'] = "New images since last visit";
templates/xxx/home.html
Wherever you prefer near the new_images and top_images logic add:
Code: [Select]
<a href="{url_new_images_last}" title="If logged in, click to see all images added since your last visit"><b>{lang_new_images_last}</b></a>&nbsp;                  
Also change any other template html screen that has the new images and top images links in them.  I only put the 'title=' code on my home page template, but you could put it in all or none.

To see it in action, visit http://www.jenrichardsphotography.com, although you would have to register and hope I add images before you visit the next time to see it work fully, so that may not be very practical. :D
« Last Edit: April 26, 2006, 10:11:23 AM by V@no »

Offline ThReCa

  • Newbie
  • *
  • Posts: 24
    • View Profile
    • http://DMike.de
[Mod] New images since last visit
« Reply #1 on: March 16, 2003, 02:54:55 AM »
You musst add this line here: ( include/page_header.php )
Code: [Select]

  "lang_new_images" => $lang['new_images'],
[b]  /* [MOD] New Images since last visit -- Begin */
  "lang_new_images_last" => $lang['new_images_last'],
  /* [MOD] New Images since last visit -- End */[b]
  "lang_top_images" => $lang['top_images'],
[/b]

Offline jengwen

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
    • http://www.jenrichardsphotography.com
[Mod] New images since last visit
« Reply #2 on: March 16, 2003, 04:45:04 AM »
You are correct.  I had done that but forgot to include it above.  I have correct my original post to include this.  Thanks!

Offline ThReCa

  • Newbie
  • *
  • Posts: 24
    • View Profile
    • http://DMike.de
[Mod] New images since last visit
« Reply #3 on: March 17, 2003, 11:01:40 PM »
I want to say only one thing:

It's a great mod!

Offline Shap

  • Full Member
  • ***
  • Posts: 114
    • View Profile
Re: [Mod] New images since last visit
« Reply #4 on: March 18, 2003, 12:03:08 AM »
Quote
To see it in action, visit http://www.jenrichardsphotography.com, although you would have to register and hope I add images before you visit the next time to see it work fully, so that may not be very practical. :D

 
You could always set up a demo user, with a login and pass, for us to use to see!

make is something like:

User: newimages
Password: newimages

 :D

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Administrator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] New images since last visit
« Reply #5 on: March 18, 2003, 01:24:32 AM »
Quote from: Shap

You could always set up a demo user, with a login and pass, for us to use to see!

make is something like:

User: newimages
Password: newimages

 :D

Didnt know that to register is too much offer... 8O
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Re: [Mod] New images since last visit
« Reply #6 on: March 18, 2003, 01:53:19 AM »
Quote from: Shap
Quote
To see it in action, visit http://www.jenrichardsphotography.com, although you would have to register and hope I add images before you visit the next time to see it work fully, so that may not be very practical. :D

 
You could always set up a demo user, with a login and pass, for us to use to see!

make is something like:

User: newimages
Password: newimages

 :D

There's a problem with this idea.  After the first visitor from the 4images forums logs in using 'newimages', the last activity date will be updated.  So the 50 other people who try the same day after the first visitor will get nothing returned for new images. I don't think that's going to work.

Offline Shap

  • Full Member
  • ***
  • Posts: 114
    • View Profile
Re: [Mod] New images since last visit
« Reply #7 on: March 18, 2003, 02:06:57 AM »
Quote from: V@no
Quote from: Shap

You could always set up a demo user, with a login and pass, for us to use to see!

make is something like:

User: newimages
Password: newimages

 :D

Didnt know that to register is too much offer... 8O


Its not to much to offer, it would just make things easier, since you gotta register, then wait for an update like she said, and keep checking back. 8)

Offline jengwen

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
    • http://www.jenrichardsphotography.com
[Mod] New images since last visit
« Reply #8 on: March 18, 2003, 02:49:06 AM »
Like they said, I would have to constantly post images, because any time someone logs on the last visit time would be updated.  

I plan to post some images within the next couple days, so hopefully that will help.

Offline nanhart

  • Pre-Newbie
  • Posts: 3
    • View Profile
Great Mod
« Reply #9 on: March 18, 2003, 04:08:41 AM »
This is GREAT,  however I have one question.  I have some folders that that only specific users have access to.   Will this mod let everyone see the newest images from all folders or only the folders that they normally have access to?

Offline jengwen

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
    • http://www.jenrichardsphotography.com
[Mod] New images since last visit
« Reply #10 on: March 18, 2003, 05:02:24 PM »
All I did was copy the 'New Images' link date logic, but changed it from using 14 days to the last visit time.  I didn't make any changes to security/permissions, so that should work the same as it does for the 'New Images' link.

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Mod] New images since last visit
« Reply #11 on: March 19, 2003, 10:41:18 PM »
Very nice MOD, thanks. Since this link is useless for guests, I would hide it completely from them like this:
Code: [Select]
 "lang_new_images_last" => ($user_info['user_level'] != GUEST) ? $lang['new_images_last'] : "",

Offline jengwen

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
    • http://www.jenrichardsphotography.com
[Mod] New images since last visit
« Reply #12 on: March 20, 2003, 01:29:56 AM »
Excellent addition!  I didn't even think to do that.

Offline XPfrik

  • Pre-Newbie
  • Posts: 1
    • View Profile
[Mod] New images since last visit
« Reply #13 on: March 25, 2003, 06:55:49 PM »
Everything is great and super, but I can not understand why I am getting messege
Parse error: parse error, unexpected T_VARIABLE in d:\appserv\www\4images\search.php

I have checked, double and tripple checked everything, but error remain. Any sugestion?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Administrator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[Mod] New images since last visit
« Reply #14 on: March 25, 2003, 10:55:26 PM »
Quote from: XPfrik
Parse error: parse error, unexpected T_VARIABLE in d:\appserv\www\4images\search.php

this error usualy happens, when closing bracket ( } ) or clising quotation mark ( " ) is missing.
check 4th time, u probably missed something very little that hard to find ;)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)