Retrieving / displaying records based on user login

Status
Not open for further replies.

GaryM

Member
I am new to Joomla and Fabrik. My problem is how to retrieve and display a single record for a specific person logging into the front end website? Here's my situation: I have a Fabrik table / list that has a record for every person authorized to login to the front end. I will set up a User for each person who has a record and a User Group and ACL that allows access to the menu option to view a record. Currently I have a test user set up and I can login in and the user has access to the menu option to view the list, however I see all user's records. Logically it seems like I will need to know who has logged in and then be able to tie their login id to their record in the table. Where / how do I restrict the list to only show this users record?

Any help would be appreciated.

Thanks,

Gary
 
At the bottom has the userid examples, but if you search the forums with the {$my->id} tag you'll find a fair few examples as well.

Post back if you get stuck
 
Hi felixkat,

I'm stuck!!! I've read the Pre-filter doc and have tried several different scenarios with no success. Can you help me understand what is suppose to be in {$my->id}? I'm not sure what field to be comparing it against in the WHERE FIELD CONDITION VALUE of the pre-filter. I tired comparing {$my->id} against the users login id which I stored in a field in the table but that didn't work.

Any additional help would be appreciated.

Thanks,

Gary
 
I re-read your original post and I think you are creating extra work for yourself. :)

There is a user element within Fabrik, if you don't see it you may need to discover it or update from Github. I can't remember if it's installed by default.

The user element assigns itself to Joomla's user table so you don't need to create a seperate one.

Then when you do your prefilter you use

field = {your user element}
condition: equals
value: {$my->id}
type=text



{your user element} is the name of you user element that you create.


To add new users or groups you can simply use Joomlas facility.
 
I found the user element that you described and was able to set it up. I can see the correct value in the user element when I run the report without using the Pre-filter, but when I set up the Pre-filter and run the report I get no records. Without the Pre-filter I get all the records. There must something wrong with the way I am using the Pre-filter, but what I can't see. Here's what I set up:

Field Condition Value
WHERE User Name Equals {$my->Id}

Type=text

As I mentioned the field User Name has the correct value, but I do not know what is in {$my->Id}. Is there a way I can check what is in {$my->}?

Thanks,

Gary
 
Hi felixkat,

Thanks very much for your help!!!

I finally figured out what I was doing wrong. I re-read some of the posts from others on this same issue and realized they were talking about restricting viewing of records to ones created by a person. It finally clicked that I was working with records that were already created before I added the user element and thus that user field was not populated in the table (stupid operator error). After I updated the records with the correct data the pre-filter worked great.

Thanks again,

Gary
 
Ahh yes, partially my fault as well, my mind should have triggered that you would have had to update the records.

Glad you got it sorted though. :)
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top