This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hi everyone
I've managed to create a list of users from the user-plugin on the frontend, but I'm trying to create a details-page to redirect to, when one user is clicked. I've created the user detail page, but i can't connect the list-page to the details-page. That is... transfering the ID of the clicked user to the details-page, so the system knows what user to display.
I really hope that this makes sense and a kind soul will help me out.
Best Regards - /Dennis
To be a little more specific (sorry... I wrote the above in a very late and frustrated hour):
The list-page is created like this:
use RainLab\User\Models\User;
use System\Models\File;
function onInit() {
$this['activatedUsers'] = User::whereIsActivated(true)->get();
}
- with a {% for %} I can loop through all activated users.
On the details-page i do this:
use RainLab\User\Models\User;
use System\Models\File;
function onInit() {
$this['profile'] = Db::table('users')->where('id', '3')->first();
}
I can call a specific user with the ID of '3'. My question is: How can I transfer the ID {{ profile.id }} (my twig-tag) to the '3' in PHP? I believe there MUST be some easy way that I am missing.
Aaaaand... I managed to make it work. It was indeed easy:
use RainLab\User\Models\User;
use System\Models\File;
function onInit() {
$id = $this->param('id');
$this['profile'] = Db::table('users')->where('id', $id)->first();
}
1-3 of 3