Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Click Save and get redirected to a different tab
When ur in Post.php and u click save. If a blog category was selected, it should redirect u to the blog tab and not the discussions tab.
how do i do that?
thanks
how do i do that?
thanks
0
This discussion has been closed.
Comments
I think you will want to attach to the PostSaveComment and PostSaveDiscussion delegates. Right after those delegates are some example PHP commands that direct the user to the last page of the comments or resulting discussion.
Only suggestion would be to call $Context->Unload(); right before the die(); command, to close a little more cleanly out of the script.
So doing $Context->Unload() will prevent this code from executing
if ($ResultDiscussion) { // Saved successfully, so send back to the discussion $Suffix = CleanupString($this->Discussion->Name).'/'; header('location:'.GetUrl($this->Context->Configuration, 'comments.php', '', 'DiscussionID', $ResultDiscussion->DiscussionID, '', '', $Suffix)); die(); }
if ('post.php' == $Context->SelfUrl) { function Redirect(&$DiscussionForm) { if ($DiscussionForm->Discussion->CategoryID == $DiscussionForm->Context->Configuration['BLOG_CATEGORY']) { header('location:'.GetUrl($DiscussionForm->Context->Configuration, 'extension.php', '', '', '', '', 'PostBackAction='.$DiscussionForm->Context->GetDefinition('Blog'))); die(); $Context->Unload(); } } $Context->AddToDelegate('DiscussionForm', 'PostSaveDiscussion', 'Redirect'); }
Two last tips: there should be a space between the colon and the URL, and you are going to have to wrap a str_replace() (I had to do it in CommentLinks) around the GetUrl to replace any &'s (XHMTL valid) in the URL with standard & (HTTP redirection valid).
Switch unload and die--unload will never get called because die stops execution first.