4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: jengwen on March 15, 2003, 07:40:18 AM

Title: [Mod] New images since last visit
Post by: jengwen 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
Title: [Mod] New images since last visit
Post by: ThReCa 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]
Title: [Mod] New images since last visit
Post by: jengwen 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!
Title: [Mod] New images since last visit
Post by: ThReCa on March 17, 2003, 11:01:40 PM
I want to say only one thing:

It's a great mod!
Title: Re: [Mod] New images since last visit
Post by: Shap 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
Title: Re: [Mod] New images since last visit
Post by: V@no 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
Title: Re: [Mod] New images since last visit
Post by: Chris 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.
Title: Re: [Mod] New images since last visit
Post by: Shap 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)
Title: [Mod] New images since last visit
Post by: jengwen 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.
Title: Great Mod
Post by: nanhart 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?
Title: [Mod] New images since last visit
Post by: jengwen 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.
Title: [Mod] New images since last visit
Post by: SLL 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'] : "",
Title: [Mod] New images since last visit
Post by: jengwen on March 20, 2003, 01:29:56 AM
Excellent addition!  I didn't even think to do that.
Title: [Mod] New images since last visit
Post by: XPfrik 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?
Title: [Mod] New images since last visit
Post by: V@no 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 ;)
Title: [Mod] New images since last visit
Post by: LoOpP on March 26, 2003, 05:59:01 PM
is it possible to use this script but not for new pictures,-> for comments

new comments since last visit

thx
Title: [Mod] New images since last visit
Post by: PuCK on March 26, 2003, 10:34:21 PM
Is it possible to do this with a cookie? So guests see only the new images since last visit?
Title: Here's an alternative.
Post by: Chris on April 03, 2003, 01:13:58 AM
.
If you would like the existing "new images" link to work for both logged in users and guests, you could simplify the mod to this single step.

Open search.php

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 ";
  }

replace with:
Code: [Select]
 if (!empty($search_id['search_new_images']) && $search_id['search_new_images'] == 1) {
    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 ";
  }


This returns the new images since the user last visited if they're logged in and the new images that fall within the admin control panel date range if they are not logged in.

If you want to go the extra mile, you can tell the user what's the link will do.

Open lang/english/main.php

Find:
Code: [Select]
$lang['new_images'] = "New images";
Add after:
Code: [Select]

$lang['new_images_config_cutoff'] = "New Images From Last ".$config['new_cutoff']." Days";
$lang['new_images_user_lastvisit'] = "New Images Since Your Last Visit";


Open includes/page_header.php

Find
Code: [Select]
 "lang_new_images" => $lang['new_images'],
Add after:
Code: [Select]
 "lang_new_images_alt" => ($user_info['user_level'] == GUEST) ? $lang['new_images_config_cutoff'] : $lang['new_images_user_lastvisit'],

Then anywhere in your templates

Replace:
Code: [Select]
<a href="{url_new_images}"><b>{lang_new_images}</b></a>
With:
Code: [Select]
<a href="{url_new_images}" alt="{lang_new_images_alt}"><b>{lang_new_images}</b></a>

Thanks jengwen for this mod !
Title: Re: [Mod] New images since last visit
Post by: Josef Florian on May 16, 2005, 02:30:01 AM
WOW, it works!

Thanks!
Title: Re: [Mod] New images since last visit
Post by: karimun on July 18, 2005, 08:49:41 PM
I installed the solution of Chris and it works great.

I would like to use following modification:
For logged in users both ways, the setting from the control panel AND this mod, should co-exist.
I will add the ´new_images_since_your_last_visit´ into user_logininfo.html so guests will never see it.

Thank you very much in advance.
Title: Re: [Mod] New images since last visit
Post by: pkitty on July 19, 2005, 12:50:46 AM
I installed this, and got a huge sessions.php error, I couldnt log out, couldnt go to my control panel.... and for some reason, my backups are not working.


Chris, If I use your code, is what you have an add on to the first code?  Or do I simply follow your instructions...
Title: New sign on images should reflect new behaviour
Post by: nyiguinyogui on September 01, 2005, 09:27:37 AM
This is my 1st post so hi to everybody.

I have been using 4images for about a month and I think it is a nice application.
I specially appreciate the contributions of community with mods and plug-ins.

And about this "New images since last visit" mod, in my opinion there is something which is missing:
The "new images" function has been changed so that -for a logged user-, it shows new images since user's last visit, then it is not coherent that the "new" sign still appears on images which are new according to "old new criteria" (new images for the last X days). Actually, "new" sign should appear only in images new since user's last visit.

Regards.
Title: Re: [Mod] New images since last visit
Post by: MEXX on March 24, 2006, 12:52:03 AM
Отличный мод! Все работает! Спасибо! :lol:
Title: Re: [Mod] New images since last visit
Post by: jerseygirl on March 28, 2006, 03:17:26 PM
this mod doesn't work with version 1.7.2, does it? these lines are not in seach.php:

Code: [Select]
if (isset($HTTP_POST_VARS['search_new_images']) || isset($HTTP_GET_VARS['search_new_images'])) {
 $search_new_images = 1;
Title: Re: [Mod] New images since last visit
Post by: V@no on March 28, 2006, 03:45:04 PM
then search for include(ROOT_PATH.'global.php');
and insert it below.
Title: Re: [Mod] New images since last visit
Post by: Nasser on April 25, 2006, 02:26:12 PM
 include(ROOT_PATH.'global.php');
is not there also V@no
Title: Re: [Mod] New images since last visit
Post by: V@no on April 25, 2006, 02:40:55 PM
include(ROOT_PATH.'global.php');
is not there also V@no

Are you serious? hope it was a joke :P
Title: Re: [Mod] New images since last visit
Post by: Nasser on April 25, 2006, 02:46:12 PM
wait .. something wrong
Title: Re: [Mod] New images since last visit
Post by: Nasser on April 25, 2006, 03:35:26 PM
I found it .. I was searching with a space before the line ..

ok I did every thing .. but the link doesn't appear

this is the link :
&raquo; <a href="{url_new_images_last}">{lang_new_images_last}</a><br />
I put it in the userlogininfo template
Title: Re: [Mod] New images since last visit
Post by: wallpapers on April 25, 2006, 07:18:29 PM
i see this error:
Code: [Select]
Parse error: parse error, unexpected $ in /home/tunedcar/public_html/search.php on line 428
but line 428 is the ?> (end of file) the are no spaces or what else.
i am using 4images 1.7.2
Title: Re: [Mod] New images since last visit
Post by: Nasser on April 25, 2006, 10:07:47 PM
I have the same error when I click on all member images from his profile ..
Title: Re: [Mod] New images since last visit
Post by: V@no on April 26, 2006, 12:10:38 AM
Let me guess: first step, you commented out BOTH lines instead of just the ONE instructed?
Title: Re: [Mod] New images since last visit
Post by: Nasser on April 26, 2006, 02:55:36 AM
this is the error
Parse error: parse error, unexpected $ in /home/emarati/public_html/gallery/search.php on line 337

and this is the change in the file :

$main_template = 'search';

define('GET_CACHES', 1);
define('ROOT_PATH', './');
include(ROOT_PATH.'global.php');
if (isset($HTTP_POST_VARS['search_new_images']) || isset($HTTP_GET_VARS['search_new_images'])) {
//$search_new_images = 1;
$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']));
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();
include(ROOT_PATH.'includes/search_utils.php');

$org_search_keywords = $search_keywords;
$org_search_user = $search_user;

if (isset($HTTP_GET_VARS['search_terms']) || isset($HTTP_POST_VARS['search_terms'])) {
Title: Re: [Mod] New images since last visit
Post by: wallpapers on April 26, 2006, 05:46:40 AM
i have the same as above
i think the lines under include(ROOT_PATH.'global.php'); mus be somwhere else but i don't know where  :roll:
Title: Re: [Mod] New images since last visit
Post by: V@no on April 26, 2006, 10:12:29 AM
and did you have
Code: [Select]
if (isset($HTTP_POST_VARS['search_new_images']) || isset($HTTP_GET_VARS['search_new_images'])) {in search.php at all?
in v1.7.2 this line was moved into global.php. If that is the case, I dont know why would you add it, because there is nothing sais about adding it, correct?

P.S. I've added a little note in the original post, for these who is using v1.7.2 or newer ;)
Title: Re: [Mod] New images since last visit
Post by: Nasser on April 26, 2006, 05:17:33 PM
ok .. done .. and that was OK

but still the first problem

I found it .. I was searching with a space before the line ..

ok I did every thing .. but the link doesn't appear

this is the link :
&raquo; <a href="{url_new_images_last}">{lang_new_images_last}</a><br />
I put it in the userlogininfo template
Title: Re: [Mod] New images since last visit
Post by: wallpapers on April 26, 2006, 08:26:40 PM
and did you have
Code: [Select]
if (isset($HTTP_POST_VARS['search_new_images']) || isset($HTTP_GET_VARS['search_new_images'])) {in search.php at all?
in v1.7.2 this line was moved into global.php. If that is the case, I dont know why would you add it, because there is nothing sais about adding it, correct?

P.S. I've added a little note in the original post, for these who is using v1.7.2 or newer ;)

It is working perfect thanks V@no  :lol: :D
Title: Re: [Mod] New images since last visit
Post by: V@no on April 27, 2006, 01:06:42 AM
ok I did every thing .. but the link doesn't appear

this is the link :
» <a href="{url_new_images_last}">{lang_new_images_last}</a><br />
I put it in the userlogininfo template
check changes in page_header.php and main.php language file.
Title: Re: [Mod] New images since last visit
Post by: Nasser on April 27, 2006, 03:15:09 AM
the  page_header.php wasn't changed carefully

thank you V@no
Title: Re: [Mod] New images since last visit
Post by: tansamalaja on May 22, 2006, 10:56:37 AM
I get all the new pics, not only the new pics since last visit.
I logged out and  in and the result is the same. (v.1.7.1)

In which file could be the mistake located?

In my new Galerie (vv.1.7.2) everything is alright.
Title: Re: [Mod] New images since last visit
Post by: tansamalaja on June 01, 2006, 07:37:00 PM
Any idea?
Title: Re: [Mod] New images since last visit
Post by: Ch*yeuk on July 14, 2006, 10:47:15 PM
Nice mod, I've installed it and it works pefectly!
Title: Re: [Mod] New images since last visit
Post by: tansamalaja on July 31, 2006, 04:54:13 PM
I found it by myself:

If you've updated to 1.7.2 you should change the global.php as demanded in the instruction... :oops:
I started with 1.7.1 an did the changes in the search.php...

Quote
search.php (if you are using 4images v1.7.2 or newer, the following two changes must be done in global.php instead)
Title: Re: [Mod] New images since last visit
Post by: rinaldos on February 18, 2007, 03:06:12 PM
Hello at all.
This mods works, but now (I do not know why) i see no new pictures :-(

When i click new pictures, or new pictures since last visit, is see that there are 115 new pictures. But the thumbnails are not displayed :-(

Where I have to look for the error.

---german
Seit kurzer Zeit sehe ich nicht mehr die Thumbnails in der suche. Er zeigt mir zwar an, das so und so viele Bilder neu sind, aber die Bilder werden nicht mehr angezeigt. Wo müsste ich denn schauen, damit ich das wieder hinbekomme?

http://rinaldos.homeip.net/Galerie/search.php?search_new_images=1


Gruß
Ingo

Title: Re: [Mod] New images since last visit
Post by: rinaldos on February 18, 2007, 07:41:39 PM
Habe das Problem fast gelöst. Die original search.php genommen und den MOD neu eingebaut. Nun zeigt er zwar nicht mehr die neuen Bilder an, aber immerhin bringt er schon wieder Ergebnisse und zeigt mir die letzten Bilder seit dem Besuch an :-)

Gruß
Ingo
Title: Re: [Mod] New images since last visit
Post by: skiemor on December 29, 2007, 11:25:00 PM
Nice MOD, thank you!  :D

Chris.
Title: Re: [Mod] New images since last visit
Post by: olgaart on March 20, 2008, 11:33:15 AM
Nice mod, many thanks!
I put it into member-login menu, "new pictures" is displayd whenn the member logged in. Is it possible to make changes, that this message appears only if there are new pictures since last visit? Otherwise the member after clicking on new pictures gets a  dispay, that his search was unsuccessful  and all the extenden search menu ?
Title: Re: [Mod] New images since last visit
Post by: MrAndrew on October 03, 2010, 12:07:25 PM
It`s possible to show a number of images, which have been added since user last visit? Ie: 21 photos, have been added since you last visit. To see images, press this link (http://.../search.htm?search_new_images=2)?

Many thanks!