4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: martrix on May 14, 2005, 01:20:52 AM

Title: [MOD]Go automaticaly back to image, after editing image/comment
Post by: martrix on May 14, 2005, 01:20:52 AM
if a user (if allowed, not admin :wink:) edits the image-details or a comment and posts the changes, he'll get stuck on a page just saying "Image edited successfully" or "Comment editet successfully"...
This tiny mod brings the user automaticaly back to the image-detail after posting the data...

Part 1) Go back, after editing image details
open member.php and look for:

Code: [Select]
       add_searchwords($image_id, $search_words);
       $msg = $lang['image_edit_success'];

add below

Code: [Select]
      header("Refresh: 2; url=".$site_sess->url(ROOT_PATH."details.php?image_id=".$image_id, "&")); // refresh after edit MOD
save, but leave open, if want to implement part 2 also ;)

If 2 seconds is not enough for you, than just change that... you'd know where  :wink:


Part 2) Go back after editing comment

open ./member.php
and find
Code: [Select]
$msg = ($result) ? $lang['comment_edit_success'] : $lang['comment_edit_error'];
replace with:
Code: [Select]
// start - go automaticaly back to image after "editcomment"
    $sql = "SELECT image_id
            FROM ".COMMENTS_TABLE."
            WHERE comment_id = $comment_id";
    $id_result = $site_db->query($sql);
$row = $site_db->fetch_array($id_result);
$image_id = $row['image_id'];
// end - go automaticaly back to image after "editcomment"
    $msg = ($result) ? $lang['comment_edit_success'] : $lang['comment_edit_error'];
// start - go automaticaly back to image after "editcomment"
header("Refresh: 2; url=".$site_sess->url(ROOT_PATH."details.php?image_id=".$image_id, "&"));
// end - go automaticaly back to image after "editcomment"

Also here it is set to 2 seconds. I won't tell you where to change that, 'cause it's obvious ;)

I thought I could manage the second part without a new SQL query, but i could not... maybe someone out there could teach me a better way :D

Part 3 would be a User-editation system :) Maybe someone has this already - I mean: the user may edit his comments (if allowed from the ACP)

Have fun
Title: Re: [MOD] Go automaticaly back to image, after editing it
Post by: Vincent on May 14, 2005, 09:37:35 AM
sounds good, it is working if you are looged in as adim?
in my case i have tested it but it is not working
---
i looged in - take a picture (detail) and below the picture you have a (Bearbeiten) text/button - on click i get in and have added a Keyword - the i saved but nothing happen - maybe the problem also was because when i push the button it opens a new window!

sincerly
vincent
Title: Re: [MOD] Go automaticaly back to image, after editing it
Post by: V@no on May 14, 2005, 07:23:47 PM
u are talking about different things here. when u edit an image being logged in as admin, it opens ACP page in new window.
When u logged in as regular member, it opens member page for editing images in the same window - and thats where these changes applyed to.
Title: Re: [MOD] Go automaticaly back to image, after editing it
Post by: Vincent on May 14, 2005, 08:24:04 PM
sounds good, it is working if you are looged in as adim?
so this question could be answered with no!  :?

thanks v@no for your tip

vincent
Title: Re: [MOD] Go automaticaly back to image, after editing it
Post by: V@no on May 14, 2005, 09:39:01 PM
ops, sorry, I didnt even noticed it was a question...my bad...:?
Title: Re: [MOD] Go automaticaly back to image, after editing it
Post by: Vincent on May 14, 2005, 11:02:40 PM
no problem - i am always happy to find out the system is not working not i am to stupid to add the code!  :wink:
vincent
Title: Re: [MOD] Go automaticaly back to image, after editing it
Post by: martrix on May 15, 2005, 01:17:42 AM
@ V@no:
thank you for clearing that up :D

@ Vincent:

I could not answer yesterday - sorry for that. I just updated the first post.
As V@no wrote - this is only for the user.
Admins edit the details in the ACP in a new window, so a redirect back to the image-page would make no sense... ;)
I just got annoyed about that "static" page and that I have to "click" once more to come back to the picture-detail I was before...

Until now I am trying to find out, how to do "the same" task for "user"-editing a comment = meaning that the user comes back to the picture, where the editet comment belongs to.
Was not successful until now - because the "image_id" variable gets somehow "lost", when posting the editation :(
Title: Re: [MOD] Go automaticaly back to image, after editing it
Post by: mawenzi on May 15, 2005, 02:23:42 PM
Hi martrix,
thanks for your PM and your MOD here ...  :D
After weekend I will insert the modification at my PC at home in my page. 
I still wait then for MOD part 2 [MOD] Go automaticaly back to image, after editing a comment !
My users need this modification ...  :wink:

nice weekend mawenzi
Title: Re: [MOD] Go automaticaly back to image, after editing it
Post by: martrix on May 16, 2005, 09:32:38 PM
well, I'd like to post "part 2", but I can't get it to run somehow :(

It's just, because I do not understand, why $image_id gets lost when clicking the Edit button  :cry:

I know it's working on some pages already... maybe I'm trying that from the wrong side  :mrgreen:
Title: Re: [MOD]Go automaticaly back to image, after editing image/comment
Post by: martrix on May 16, 2005, 10:15:47 PM
YES! I was trying that from the "wrong side" :oops:

Can't tell you, why I thought, that 4images will hold the image_id forever  :lol:

I did just refresh the first post with part 2, part 1 remains the same...

@ Chris: I tried to use my brains now and it worked surprisingly well :D

@ Mawenzi: I guess now your users will be very happy ;)
Title: Re: [MOD]Go automaticaly back to image, after editing image/comment
Post by: V@no on May 17, 2005, 01:14:26 AM
well, I'd like to post "part 2", but I can't get it to run somehow :(

It's just, because I do not understand, why $image_id gets lost when clicking the Edit button :cry:
let me guess...u were not testing it on a fresh 4images?
$image_id does not being altered in the code (I've double checked it in v1.7.1). IMO it should not be altered in your code eather ;)
Title: Re: [MOD]Go automaticaly back to image, after editing image/comment
Post by: martrix on May 17, 2005, 09:36:09 AM
let me guess...u were not testing it on a fresh 4images?
hm no, but I finally got it to work somehow :D

What do you mean, with the variable,,that it is not being altered in the code? :|
Title: Re: [MOD]Go automaticaly back to image, after editing image/comment
Post by: mawenzi on May 17, 2005, 10:19:55 AM
hi martrix,

thanks for your work ...  :D
your tiny modification (part 1 and 2) works now in the best way on my page
and my users will be certainly content ...  :wink:

mawenzi
Title: Re: [MOD]Go automaticaly back to image, after editing image/comment
Post by: V@no on May 17, 2005, 02:11:51 PM
What do you mean, with the variable,,that it is not being altered in the code? :|
sorry, never mind, I didnt realize u were talking about member.php and not details.php...
Title: Re: [MOD]Go automaticaly back to image, after editing image/comment
Post by: Stoleti on June 16, 2006, 04:53:21 AM
would be nice if this also work for when we upload pictures, redirec to details.php too  :?:
Title: Re: [MOD]Go automaticaly back to image, after editing image/comment
Post by: martrix on June 16, 2006, 11:09:27 AM
That would make sense if you allow a direct upload of images to your page without administrator-approval...
and
if you want the User to upload just one image and not more - because if I'd be redirected to details.php after an upload
I'd have to click twice to upload another image... - first back to the category and the second to the upload form...
The better redirect is (my opinion) back to the upload form, so the User might upload the next image...
Title: Re: [MOD]Go automaticaly back to image, after editing image/comment
Post by: Stoleti on June 16, 2006, 11:20:23 AM
That would make sense if you allow a direct upload of images to your page without administrator-approval...
and
if you want the User to upload just one image and not more - because if I'd be redirected to details.php after an upload
I'd have to click twice to upload another image... - first back to the category and the second to the upload form...
The better redirect is (my opinion) back to the upload form, so the User might upload the next image...

But if user wants upload more then one, user can choose "multiupload" , in my case i use it :) , but this ideia of redirect ill be just for normal upload " just 1" and redirect :)