Back to Profile Support

imunisasi
imunisasi

Kurt, is that possible to add :slug (same with rainlab user) ?
to read another user data
thanks

Last updated

KurtJensen
KurtJensen

I added this functionality to the "UserList Component" today.

Add "UserList Component" to the page and configure a slug in the URL to use it to show a single users information.

OR

Add "UserList Component" to the page and DO NOT put a slug in URL. This will show a user directory where users can be selected and their information will shown via AJAX request at the top of page.

As always, be sure to protect your pages from those whom you do not want to view your users information.

Last updated

imunisasi
imunisasi

@KurtJensen : thanks a lot but i get some error, i cant put slug on there, it keep search for filename, then leave it blank

KurtJensen
KurtJensen

Did you upgrade to Version: 1.0.9?

Example "Person" page that will display one users info based on the URL ending in ID of user:

title = "Person"
url = "/person/:slug"
layout = "default"
hidden = "0"

[UserList]
SLSlug = "{{ :slug }}"
==
{% component 'UserList' %}

Example "People" page which acts as a directory of all users:

title = "People"
url = "/people"
layout = "default"
hidden = "0"

[UserList]
SLSlug = "{{ :slug }}"
==
{% component 'UserList' %}

Last updated

imunisasi
imunisasi

it's worked, by find id thanks a lot kurt

i change it a bit so it can run same as forum

//add
use RainLab\Forum\Models\Member as MemberModel;
public $member = 0;
//in onrun function add
$member = MemberModel::whereSlug($this->property('SLSlug'))->first();
// in onrun function change $this->property('SLSlug') into $member->user_id
$this->UserSelected = intval( $member->user_id );

Last updated

KurtJensen
KurtJensen

Please post a screen shot of your error and post the URL that you are using. I noticed it does not fail gracefully if a valid user ID is not indicated in URL. I will try remedy this soon but would like to diagnose any other issue you are having also,

imunisasi
imunisasi

KurtJensen said:

Please post a screen shot of your error and post the URL that you are using. I noticed it does not fail gracefully if a valid user ID is not indicated in URL. I will try remedy this soon but would like to diagnose any other issue you are having also,

nope kurt, this issue already done, i just did some mod to your code, to get forum username. thanks buddy u did great :)

drtzack
drtzack

It didn't work for me too.

Here is my solution:

use RainLab\User\Models\User;
use KurtJensen\Profile\Components\ExtendedInfo;
function onStart(){
    $slug = $this->param('user');
    $this['person'] = User::where('username', '=', $slug)
                            ->where('is_activated', 1)
                            ->first();
    if( !$this['person'] )
        return Redirect::to('/404');
    $this['person_extended'] = ExtendedInfo::loadSettings($this['person']);
}
KurtJensen
KurtJensen

Please post the source of the page you created for the "person" display that did not work for you. This way I can recreate the issue on my end and fix or advise on the problem.

When I tried it moments ago on my site, I did notice an error about the avatar being missing IF I USED INVALID USER ID in the URL. Otherwise it did display the user information when a valid user ID was in URL. I can not reproduced your issue without more detail of the problem.

Thanks.

Last updated

KurtJensen
KurtJensen

I have created a little video on Vimeo to show how I created a "Person" page and how it works.

Creating Person Page to display one users' information

Notice that the component uses an database id in the URL, not a username as drtzack3136 was attempting to use.

Last updated

1-10 of 10