Filter Content Builder View by current user id

  • daduts
  • daduts's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 19
  • Thank you received: 1

daduts created the topic: Filter Content Builder View by current user id

Greetings,

In Content Builder list view, I'd like to filter a list to only display records where the current user id matches an id stored in a Content Builder field.

Can you suggest a way to do this ?

My customer is a trainer who assigns workouts to his clients. I've built a simple form and CB view for him to do this which includes a client field(user id) and a workout field. I'm trying to display the same view to the clients where they only see the workouts assigned to them.

Thanks

Dave

Cheers,

Dave
#229861
  • Posts: 2154
  • Karma: 67
  • Thank you received: 262

DarkoCujic replied the topic: Filter Content Builder View by current user id

Hey,

I really don't see a way of doing this in a conventional way. I've tried setting up filters and stuff like that, but they don't allow PHP input and that is the only way to dynamically do this.

I think it would be easier to create an article and code that stuff out by yourself. Actually, that's how I would do it. Use Sourcerer or a similar plugin to enable you to add code to the article. Then, query the database with a join on both facileforms_records and facileforms_subrecords to get all the values. Then you can style that page any way you see fit.

Regards,
Darko

Satisfied with our support? PayPal tips
===========
Need to renew Pro Support? Buy Here!
===========
Satisfied? Consider a membership!
===========
Like us on Facebook
===========
Support Crosstec and get ALL EXTENSIONS and professional support for just $5. Here!
#229885
  • Posts: 8
  • Thank you received: 0

dfloresc replied the topic: Filter Content Builder View by current user id

Now, if someone wants to do this, just add the following line to the filter option on the menu.

$value = JFactory::getUser()->get('username');
#230463
  • Posts: 2154
  • Karma: 67
  • Thank you received: 262

DarkoCujic replied the topic: Filter Content Builder View by current user id

Hey,

indeed it works. Must've overlooked this.

Thank you for your contribution.

Regards,
Darko

Satisfied with our support? PayPal tips
===========
Need to renew Pro Support? Buy Here!
===========
Satisfied? Consider a membership!
===========
Like us on Facebook
===========
Support Crosstec and get ALL EXTENSIONS and professional support for just $5. Here!
#230470
  • Posts: 8
  • Thank you received: 0

dfloresc replied the topic: Filter Content Builder View by current user id

I have another issue here now. I can filter by user id as I mention above, but I have a problem. I have a field that the user can select multiple users id, and I want to show the records to all users where the user id was selected, but I can't use % to set up the filter as if I use just text. Do you have any idea to solve this?
#233039
  • Posts: 2154
  • Karma: 67
  • Thank you received: 262

DarkoCujic replied the topic: Filter Content Builder View by current user id

Hey,

unfortunately, nothing comes to my mind. Maybe concatenating the values so it forms a string?

What I mean is, the description of the filter says "For each filter you can seperate alternative filter criteria, seperating each value by |. For instance peter|paul|mary would only return records that contain one of these names.". So, if we take that into account, all you'd have to do is get an array of the values you need to filter by (don't know where they're stored or how so can't be of much help there), and then implode the array using the pipe symbol (|, right alt + w on my keyboard layout). Something like this:
$arr = array(); $arr[] = //add values to $arr; $value = implode("|", $arr);

If the solution you posted works (and it does), then I'm pretty sure this should work also.

Let me know how it goes.

Regards,
Darko

Satisfied with our support? PayPal tips
===========
Need to renew Pro Support? Buy Here!
===========
Satisfied? Consider a membership!
===========
Like us on Facebook
===========
Support Crosstec and get ALL EXTENSIONS and professional support for just $5. Here!
#233068
Moderators: ForumSupporttomeperica
Time to create page: 0.077 seconds

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99€

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here