4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started 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:
if (isset($HTTP_POST_VARS['search_new_images']) || isset($HTTP_GET_VARS['search_new_images'])) {
$search_new_images = 1;
comment out or remove:
$search_new_images = 1;
add after:
$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:
if ($search_new_images && $show_result == 1) {
$search_id['search_new_images'] = 1;
}
add after:
if ($search_new_images == 2) {
$search_id['search_new_images'] = 2;
}
find:
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:
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:
"url_new_images" => $site_sess->url(ROOT_PATH."search.php?search_new_images=1"),
add after:
"url_new_images_last" => $site_sess->url(ROOT_PATH."search.php?search_new_images=2"),
find:
"lang_new_images" => $lang['new_images'],
add after:
"lang_new_images_last" => $lang['new_images_last'],
lang/xxx/main.php
find:
$lang['new_images'] = "New images";
add after:
$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:
<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>
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
-
You musst add this line here: ( include/page_header.php )
"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]
-
You are correct. I had done that but forgot to include it above. I have correct my original post to include this. Thanks!
-
I want to say only one thing:
It's a great mod!
-
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
-
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
-
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.
-
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)
-
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.
-
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?
-
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.
-
Very nice MOD, thanks. Since this link is useless for guests, I would hide it completely from them like this:
"lang_new_images_last" => ($user_info['user_level'] != GUEST) ? $lang['new_images_last'] : "",
-
Excellent addition! I didn't even think to do that.
-
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?
-
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 ;)
-
is it possible to use this script but not for new pictures,-> for comments
new comments since last visit
thx
-
Is it possible to do this with a cookie? So guests see only the new images since last visit?
-
.
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:
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:
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:
$lang['new_images'] = "New images";
Add after:
$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
"lang_new_images" => $lang['new_images'],
Add after:
"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:
<a href="{url_new_images}"><b>{lang_new_images}</b></a>
With:
<a href="{url_new_images}" alt="{lang_new_images_alt}"><b>{lang_new_images}</b></a>
Thanks jengwen for this mod !
-
WOW, it works!
Thanks!
-
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.
-
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...
-
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.
-
Отличный мод! Все работает! Спасибо! :lol:
-
this mod doesn't work with version 1.7.2, does it? these lines are not in seach.php:
if (isset($HTTP_POST_VARS['search_new_images']) || isset($HTTP_GET_VARS['search_new_images'])) {
$search_new_images = 1;
-
then search for include(ROOT_PATH.'global.php');
and insert it below.
-
include(ROOT_PATH.'global.php');
is not there also V@no
-
include(ROOT_PATH.'global.php');
is not there also V@no
Are you serious? hope it was a joke :P
-
wait .. something wrong
-
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 :
» <a href="{url_new_images_last}">{lang_new_images_last}</a><br />
I put it in the userlogininfo template
-
i see this error:
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
-
I have the same error when I click on all member images from his profile ..
-
Let me guess: first step, you commented out BOTH lines instead of just the ONE instructed?
-
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'])) {
-
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:
-
and did you have
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 ;)
-
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 :
» <a href="{url_new_images_last}">{lang_new_images_last}</a><br />
I put it in the userlogininfo template
-
and did you have 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
-
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.
-
the page_header.php wasn't changed carefully
thank you V@no
-
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.
-
Any idea?
-
Nice mod, I've installed it and it works pefectly!
-
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...
search.php (if you are using 4images v1.7.2 or newer, the following two changes must be done in global.php instead)
-
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
-
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
-
Nice MOD, thank you! :D
Chris.
-
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 ?
-
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!