This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

williamson.t.p23282
williamson.t.p23282

Hi, Im completely new to twig and october so please excuse how basic this question might be. Im wondering if there is a way to use the username to populate the user extended profile pages? I can do this by setting the slug to the id, but I cant see how to use the username to achieve it.

Parsec
Parsec

Ok, just from the top of my head, but it should point you in the right direction.

To retrieve the logged-in User in the php code of the page:

$user = Auth::getUser();

$this->page['username'] = $user->username; #if this doesn't work, try: $this['username'] = $user->username;

Then on the page template you should be able to access {{ username }}.

You can use:

{{ dump() }} to see all the data available in the template. If 'username' is not available, something went wrong.

williamson.t.p23282
williamson.t.p23282

I think there might be some confusion. Im using this plugin: https://octobercms.com/plugin/clake-userextended Trying to create a url like: http://example.com/user/bob

The plugin currently allows for: http://example.com/user/12 (user id)

I can grab the username from the url but how can I use that with ueuser to pull data for the correct user?

Parsec
Parsec

The documentation from the plugin suggests there is a getter method in the component 'user()' that should return the logged in user.

williamson.t.p23282
williamson.t.p23282

Yes but what about looking at a random user who is not logged in?

1-5 of 5

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.