Hook submit_new_entry_redirect bug
Posted: 20 August 2008 10:28 PM   [ Ignore ]  
Summer Student
Total Posts:  2
Joined  08-20-2008

When using the submit_new_entry_redirect hook you are unable to properly use this hook.

The hook calling code is:

$loc = $EXT->call_extension('submit_new_entry_redirect', $entry_id, $data, $cp_call);

$cp_call is nice to know if you are in the CP or not but without access to $return_url, which is the return url set by custom forms, you are unable to only affect the CP calls and you are unable to do any logic on $return_url.

To properly use this hook developers need the same data that EE core uses to decide where to redirect.

For example, if you only want to redirect CP posts to a certain CP page and just let all custom forms redirect as normal, you can not do this because $loc is auto set with the return value and we do not have access to $return_url.

Another example would be if you wanted to do logic on the $return_url value to change the redirect according to certain conditions in the url.

We can not get return_url from POST either because it is unset before the hook call on line 3282 of cp.publish.php.

Having the $loc variable passed to the hook would be nice as well. This way you wouldn’t have to reproduce the same logic EE just did to get the location so you can easily pass it back as a default value or perform logic on it.

Profile
 
 
Posted: 20 August 2008 11:02 PM   [ Ignore ]   [ # 1 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15831
Joined  06-03-2002

Thanks for the feedback, dragonwize, though this is not a bug as the hook and code are functioning as intended.  Moved to the feature request forum, and we will definitely keep your suggestions in mind.

 Signature 
Profile
MSG
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64935 Total Logged-in Users: 53
Total Topics: 81904 Total Anonymous Users: 24
Total Replies: 440280 Total Guests: 255
Total Posts: 522184    
Members ( View Memberlist )