I don’t think something like this works ProfileController::create()->render($params); but I imagine there is a way to render the content for /profile/<username and then display it

What I was originally doing in the handleRequest() method was

  1. original code checked if there was a page in the SiteTree
  2. I then added a check to see what controllers urls were set up using $directorRules = Config::inst()->get('Director', 'rules');
  3. I made this into an array and checked if the <username> parameter was in this list…
  4. If it was in the list then I would let SS render as it usually would
  5. If it wasn’t in this list then I would check if the username existed
  6. If it doesn’t exist then I would let SS take control and it would return a 404 error
  7. If the user name did exist then I wanted to try and render the ProfileController page (passing in the $username and any other values I needed) and then render it

I was stuck on point 7. Which I think would be the same situation if I user handleAction() although as I say I could be just not understanding properly. (edited)

This is my current routing for that 'profile/$username/$Action/$ID/$OtherID': 'ProfileController'

I guess what I am not understanding is how I get the content from the ProfileController to display at this location…

Ok just having a quick play with that code, I maybe back in a few mins to ask more questions 😉

@nightjarnz so handleAction not handleRequest - let me take a look at that…

Hi Guys - I know I am probably going about this the wrong way, so if anyone has any suggestions I am more than happy to hear them 🙂

At the moment I am displaying user profiles at http://www.domain.com/profile/<username> but I want to change this to be http://www.domain.com/<username>

So in my Page.php file I am overriding the handleRequest() method.

All seems to be working okay. I don’t want to just redirect the user to /profile/<username> so I am trying to instantiate the ProfileController object which extends Page_Controller. I’m just not actually sure how to do this - and any suggestions would be really great. (edited)

@andante commented on @andante’s file https://silverstripe-users.slack.com/files/U2WP9BGS0/FBK97FJ6Q/screen_shot_2018-07-05_at_16.40.37.png: if you turn on semantic highlighting, your variables get different colours so you can track them more easily through the functions