Hi everyone,
I would like to force a redirect to another page after the successful saving of pages in a certain namespace. I was able to do that in the most ugly way possible via a "ArticleUpdateBeforeRedirect" hook:
public static function onArticleUpdateBeforeRedirect( $article, &$sectionanchor, &$extraq) { if ($article->getTitle()->getNamespace() == NS_DESCRIPTION) { $extraq = "title=" . $article->getTitle()->getDBKey(); } }
What I would really like is to overwrite the "Location" header but that seems to be set after this hook is called.
Any ideas?
Cheers, Sebastian
I think I found a solution myself by doing a redirect on the page itself:
public static function onInitializeArticleMaybeRedirect( $title, $request, &$ignoreRedirect, &$target, $article ) { global $wgArticlePath;
if ($title->getNamespace() == NS_DESCRIPTION) { $target = str_replace('$1', $title->getDBKey(), $wgArticlePath); } }
Is this ok or also too hacky?
On 11.11.20 10:54, Sebastian Trueg wrote:
Hi everyone,
I would like to force a redirect to another page after the successful saving of pages in a certain namespace. I was able to do that in the most ugly way possible via a "ArticleUpdateBeforeRedirect" hook:
public static function onArticleUpdateBeforeRedirect( $article, &$sectionanchor, &$extraq) { if ($article->getTitle()->getNamespace() == NS_DESCRIPTION) { $extraq = "title=" . $article->getTitle()->getDBKey(); } }
What I would really like is to overwrite the "Location" header but that seems to be set after this hook is called.
Any ideas?
Cheers, Sebastian
MediaWiki-l mailing list To unsubscribe, go to: https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
mediawiki-l@lists.wikimedia.org