
RedirectAfterUpdate
RedirectAfterUpdate
i use $x->RedirectAfterInsert = "some page.php"; to change redirect but is there RedirectAfterUpdate or RedirectAfterDelete 

Re: RedirectAfterUpdate
No, though I plan to add these in future releases.

- DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
- Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.
- Need personalized consulting on your specific app and customizations? Book an online call with me here.
Re: RedirectAfterUpdate
is there any improvements on this feature ?
-
- Posts: 10
- Joined: 2014-03-31 22:28
Re: RedirectAfterUpdate
This does cause issues. The redirect to addnew after an update takes it to an update page where you save changes. If the user doesn't notice and enters new records, the records disappear. This can cause integrity issues for the program because people make these kind of mistakes all the time. Any plan on updating this soon to allow redirectafterupdate or redirectafterdelete?
-
- AppGini Super Hero
- Posts: 85
- Joined: 2014-06-14 03:08
- Location: India
- Contact:
Re: RedirectAfterUpdate
Hi,
Are you sure that redirecting after update will cause some issues related to permissions.
The issue might be some thing like, not updating user records table after update. But I think it may not be an issue, as record will be already inserted into user records table when inserted, redirecting after update may not cause a issue i think.
This may be bit confusing.
I think only Ahmad can tell what will be the issue if we put redirect statement after update..
Are you sure that redirecting after update will cause some issues related to permissions.
The issue might be some thing like, not updating user records table after update. But I think it may not be an issue, as record will be already inserted into user records table when inserted, redirecting after update may not cause a issue i think.
This may be bit confusing.
I think only Ahmad can tell what will be the issue if we put redirect statement after update..
Re: Redirect After Update
Has anybody managed to work out a simple/safe method to redirect after update, preferably with a hook of course?
Looking to implement a redirect after update myself and I'm not too proud to borrow somebody else's work if already achieved. Thanks.
Looking to implement a redirect after update myself and I'm not too proud to borrow somebody else's work if already achieved. Thanks.

Re: RedirectAfterUpdate
Code: Select all
header("Location: index.php");
/Giuseppe
Professional Outsourcing Services
Professional Outsourcing Services
Re: RedirectAfterUpdate
That was the first thing I tried but can't get it to work? Not sure why?
This snippet in datalist.php seems to take over and end result is always the same: update and end up on same record in detail view
Have you succeeded in redirect after update? How exactly?
This snippet in datalist.php seems to take over and end result is always the same: update and end up on same record in detail view
Code: Select all
elseif($update_x != ''){
$updated = call_user_func($this->TableName.'_update', $SelectedID);
$update_status = 'record-updated-ok=' . rand();
if($updated === false) $update_status = 'record-updated-error=' . rand();
Re: RedirectAfterUpdate
I figured out a workaround. I needed the user to access the detail view to update their record and after saving be redirected to another page. The URL to edit the record is tablename_view.php?SelectedID=userid (where userid is the record ID). Therefore, add this to header.php on line 1.
After submitting, SelectedID no longer exists in the URL so it redirects back to the page where I want them.
This allows you to set many different options regarding where you want users redirected and the conditions to do so.
Code: Select all
<?php
$mi = getMemberInfo();
if($_GET['SelectedID']){
// show the page
}elseif($mi['groupID'] == '5'){
$return_url = 'mypage.php';
header("Location: $return_url");
}
?>
This allows you to set many different options regarding where you want users redirected and the conditions to do so.
Re: RedirectAfterUpdate
This seems to work
- but you forfeit the record update audit (return = true does not get executed)
- you dont have to put in the condition, it is the exit that forces the redirect to be heeded (I think)
- but you forfeit the record update audit (return = true does not get executed)
- you dont have to put in the condition, it is the exit that forces the redirect to be heeded (I think)
Code: Select all
function cmembers_after_update($data, $memberInfo, &$args){
if($_POST['update_x'] == '1'){
header("Location: index.php");
exit();
}
return TRUE;
}
Re: RedirectAfterUpdate
Mmh, you probably could do a manual record update audit edit
Re: RedirectAfterUpdate
The user does not get the usual success message after saving either!
Is there a way to get this message before exit? that would be nice
Is there a way to get this message before exit? that would be nice
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper
Re: RedirectAfterUpdate
I changed the code to this:
at least the user will stay on the same page, and clicking refresh will not resubmit the record.
I just miss the return true message.
Code: Select all
header("Location: tableName_view.php?SelectedID={$data['selectedID']}");
exit();
I just miss the return true message.
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper
-
- Posts: 26
- Joined: 2013-09-23 14:14
Re: RedirectAfterUpdate
AhmedBR where did you put that code?
Re: RedirectAfterUpdate
function after update
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper
Re: RedirectAfterUpdate
after some effort I found the solution
1. go to hooks > tablename.php
2. go to function tablename_after_update and code like this
IMPORTANT : normally function will end with but must change it to
or else this code will not work !!!!
1. go to hooks > tablename.php
2. go to function tablename_after_update and code like this
Code: Select all
function tablename_after_update ($data, $memberInfo, &$args) {
header("Location : http://www.google.com ");
exit;
}
Code: Select all
return TRUE;
Code: Select all
exit;