Create list view using logged in users extended profile

shaughan

New Member
Hi guys, I'm using the latest versions on Joomla! 3.X. What a wonderful product, it's been excellent fun so far! I have a working site where various users fill out forms, these users are created in Joomla and in Fabrik with an extended profile list, all of which works great. I'm stumped on the following - I can use a menu item to filter all form entries made by the logged in user, but I would like to create another menu item showing all their entries PLUS any entries made by their company (which is an extended field company_name on my users list). What's the best methodology here? Something similar to {$my->id} is what I'm looking for, like {$my->company_name(raw)} - is this supposed to be embedded in the form as a hidden field first? Some sort of prefilter? Any suggestions gratefully received.
 
Is company_name a join to your company table?

I'm not sure of your setup, but typically when trying to show "my company" type stuff, you'd be showing one list (like, say, invoices), and you want to show any by users in "your" company, so you'd use a pre-query in conjunction with a pre-filter. So a pre-query to establish "your" company ...

Code:
SELECT company_id FROM my_users WHERE user_id = '{$my->id}'

That gets you "your" company ID, which you can use as {$q->company_id} in your pre-filter ...

WHERE
Field: user_id (raw)
Condition: IN
VALUE: SELECT user_id FROM my_users WHERE company_id = '{$q->company_id}'
Type: query

Or you could do it all in one in the pre-filter using nested subqueries and an inner join, but it's easier (for me anyway) to use the pre-query.

-- hugh
 
Hugh, thank you for replying - I'll apply my limited skill set to this issue and see where it gets me. I may have to subscribe anyways, as a new project has come up that will definitely require some expert knowledge. Thanks for your time.
 
Hi Hugh, I have not had success with your code, although I suspect it's WHERE I'm putting it that's the problem. I have been placing this code in list > data > pre-filter (see attached), only changing company_id to company_name and the table name in your script above. Having entered this and saved, I should be able to use {$q->company_name} in various places, yes? - - where? In a menu prefilter? Can I use it to populate a hidden input field? I've tried everywhere, read a bunch of forum posts, and still have no clue. If you have time to help further, that'd be great. Or should I subscribe, and have someone take a quick look at what Im doing (wrong) :)
Thanks,Shaughan
 

Attachments

  • prefilter.jpg
    prefilter.jpg
    55 KB · Views: 38
Yeah, I can't really help much more without seeing your setup, but I can't really do that in Community. If you do get a sub, ask again in the appropriate forum.

To answer your question ... the pre-filter pre-query result can only be used in the pre-filters for that list, ie. directly in the same tab you entered that query in.

-- hugh
 
That's completely fair, I just upgraded to a standard account. If I need help past a month, I'll upgrade again, I think. Once I have access I'll repost this request in the standard users forum, and go from there. Ideally, if you or someone could look at what I have going so far and suggest/perform some fixes, I can hopefully learn from that and move forward. I'm presuming there's a secure way to send a site login and password, yes? Cheers.
 
Last edited:
Hi Hugh, I went to post this info to the standard support forum, but I don't have rights to post after subbing - what to do now?
 
We are in need of some funding.
More details.

Thank you.

Staff online

Members online

Back
Top