Hello all!
I have search box that searches for specific data type. I want it to display results based on what type of user is searching.
It would easy if i was able to add a condition that when the user is ‘x’ search for ‘x’ type of users.
But when i go to add a condition under the conditions tab is doesn’t allow me create a different search query.
For data types you can create a condition but when doing a search with a search field you cant.
The only option i can think of which is messy and more work is to create to search fields with different queries and display each one based on a conditon.
Any help will be great!
Can you give an example of what you’re trying to do?
So for my users I have 4 different types which are separated by booleans. Admin: yes/no - staff: yes/no partner: yes/no
They can all create a contact which is a data type.
I have a search box on a page where it lists all the contact. I have a workflow that filters the list of contacts based on the search bars input.
Each user has its own account of course.
I need the the current user “is partner” to only display search results for the contacts that the current user had created
Currently it works find for admin and staff because they can search ALL users.
But the partner should only see search results they have created.
It would be ideal if I could just change the search data in a condition for when the partner is yes but it doesn’t have that option for the search box.
There is no way in the search data to say “if the current user is x, displays search results that the current user has created”.
Hope that makes sense!
I want
If you can give an example of what you are trying to do, might be able to suggest better ways to do it.
Yeah, the SearchBox element has always been a bit different from almost everything else in Bubble…
You can do this using a variable to define a User (i.e. current User) when the Current user Is Partner yes, and leaving it empty otherwise, then use that variable value in your search (with ignore empty constraints).
However, that’s not a secure method. (It’s a great method to eliminate the need for conditional datasources generally - but probably not advisable in this case, at least not on it’s own).
Better to do this directly with privacy rules (which you should be using anyway).