Author Topic: [MOD]Go automaticaly back to image, after editing image/comment  (Read 26454 times)

0 Members and 1 Guest are viewing this topic.

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
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
MAяTRIX


Offline Vincent

  • 4images Moderator
  • Addicted member
  • *****
  • Posts: 1.195
    • View Profile
    • www.foto-kocher.com
Re: [MOD] Go automaticaly back to image, after editing it
« Reply #1 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
Beati pauperi spiritus

4images 1.7 // My Installed Mods


Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Go automaticaly back to image, after editing it
« Reply #2 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.
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 Vincent

  • 4images Moderator
  • Addicted member
  • *****
  • Posts: 1.195
    • View Profile
    • www.foto-kocher.com
Re: [MOD] Go automaticaly back to image, after editing it
« Reply #3 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
Beati pauperi spiritus

4images 1.7 // My Installed Mods


Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Go automaticaly back to image, after editing it
« Reply #4 on: May 14, 2005, 09:39:01 PM »
ops, sorry, I didnt even noticed it was a question...my bad...:?
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 Vincent

  • 4images Moderator
  • Addicted member
  • *****
  • Posts: 1.195
    • View Profile
    • www.foto-kocher.com
Re: [MOD] Go automaticaly back to image, after editing it
« Reply #5 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
Beati pauperi spiritus

4images 1.7 // My Installed Mods


Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD] Go automaticaly back to image, after editing it
« Reply #6 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 :(
« Last Edit: June 16, 2006, 11:05:11 AM by martrix »
MAяTRIX


Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD] Go automaticaly back to image, after editing it
« Reply #7 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
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD] Go automaticaly back to image, after editing it
« Reply #8 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:
MAяTRIX


Offline martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD]Go automaticaly back to image, after editing image/comment
« Reply #9 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 ;)
MAяTRIX


Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD]Go automaticaly back to image, after editing image/comment
« Reply #10 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 ;)
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 martrix

  • Hero Member
  • *****
  • Posts: 755
    • View Profile
    • overlord.cz
Re: [MOD]Go automaticaly back to image, after editing image/comment
« Reply #11 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? :|
MAяTRIX


Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD]Go automaticaly back to image, after editing image/comment
« Reply #12 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
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD]Go automaticaly back to image, after editing image/comment
« Reply #13 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...
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 Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: [MOD]Go automaticaly back to image, after editing image/comment
« Reply #14 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  :?: