Route Params Correction

Jeremy P

XenForo developer
Staff member
I have a modification where the username and id are parameters in the route, ie:

Using resolveActionWithIntegerParam(), I am able to get the user_id in the controller fine. However, in the event the username does not match the id, I'd like to redirect to the matching username, much like user profiles do by default. I'm not sure how to go about it.. any ideas?


Edit - Another question:
I have an action that accepts post data from a form in another action. It ends with a redirect response:
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::RESOURCE_CREATED,
			XenForo_Link::buildPublicLink('hello-world', $visitor), new XenForo_Phrase('helloWorld_the_data_has_been_added_successfully'));
When the form is posted, the success message is flashed at the top of the screen, but no redirect occurs. How would I invoke the redirect after the success message, like how it is done if you go to the advanced post page?
For your first question, check out XenForo_Controller::canonicalizeRequestUrl(). Should do what you're looking for.
That did the trick, thanks. :)

Anyone have an idea for the 2nd question?
Top Bottom