Placeholders no resolving in Fabrik list menu item pre-filter

haydonwebdesign

New Member
I'm attempting to set up a pre-filter within a 'Fabrik > List' menu item. The pre-filter should operate based on the name (not username) of the current logged in user. According to the Fabrik documentation the following should work:
screenshot- 2016-10-01 12.29.45.png

Elements: Unternehmen
Condition: Equals
Value: {$my->name}
Type: Text
Access: Guest

These settings lead to an empty list, and checking the debug panel I can see that the {$my->name} placeholder isn't being resolved but rather directly passed into the SQL query.

What I've tried:
  • Without the pre-filter everything works fine
  • I've tried with {$my->id} => same problem
  • Replacing {$my->name} with a valid value (e.g.00000004) works fine
As a workaround I created an article with a Fabrik content plugin in the text and the name of the user inserted dynamically using Sourcerer. This works fine, but as a consequence the URL alias and menu item classes are lost.
 
I can't replicate, it's replaced correctly.
Make sure that you don't have a space inside {}.

But what do you want to achieve?
Assuming "Guest" is Joomla's guest group: all $my->xy are only defined for logged in users, for guests it's always 0 resp. ''
 
The goal is to provide one user account each for of ten companies. Since the name of the user account (in contrast to the actual username) isn't used or displayed anywhere, I have set this to match the value of the field 'company' that corresponds to that company. Hence each company only sees rows which relate to them. In addition there's a single admin use that sees an unfiltered list.

Would it be possible that I PM you a link to the frontend list view (with debug information) and the Joomla backend, so that you can take a look at the menu item in question?
 
You can put the access information in http://fabrikar.com/you/my-sites

1. If you set access=Guest the prefilter is not applied to logged-in users, they will see all records
2. Setting a menu prefilter is no means of security, everybody who knows how to can bypass it by editing the URL. You have to set the prefilter directly in the list settings, something like
WHERE element EQUALS {$my->name}, Apply to = public (everybody can only see his own records)
OR
id GREATER THAN 0, Apply to "your single admin"

But in any case it must replace the placeholder to work.
 
I added the site details just now.

I hadn't fully understand the concept of applying filters to user access levels. Your suggestion provides me with a far more elegant way to filter the date, by adding the pre-filter within the list settings directly and setting it to only apply to these users.

That said, I now removed the pre-filter from within the menu item and applied it to the list directly. The placeholder is still being inserted into the SQL query. Below the WHERE clause of the final SQL query, taken from the debug panel:

[...]
WHERE ( stellen.SAP_stelle <> '1' AND ((stellen.CompanyCode LIKE '%\"{$my->name}\"%' OR stellen.CompanyCode = '{$my->name}') ) ) AND ( ((stellen.CompanyCode LIKE '%\"{$my->name}\"%' OR stellen.CompanyCode = '{$my->name}') ) )


Notes: I'm using Chameleon and ReReplacer on this site, but have tried disabling both to be sure they're not interfering. I can't think of any other reason for the problem.
 
Really no idea why it doesn't replace placeholders on your site (it doesn't in backend, too).
I would try to disable all these additional system plugins (you have a lot), see if this helps and then enable one by one.

Which exact Fabrik version are you running, the official 3.5.1 or a GitHub update?
 
It's the official 3.5.1 but with one small modification from a recent commit by Hugh, as detailed here. I'll work my way through the plugins tomorrow and report back if I discover anything useful or interesting. Thanks for the suggestion!
 
I tried the following with no success:
- deactivating all plugins except Fabrik-related
- deactivating additional components (ReReplacer, Chameleon, SP Page Builder, ...)
- changing Template to Protostar
- Placeholder is entered precisely as: {$my->name}

Changing the filter type to 'Eval' and then using standard PHP to get the user name did work however:

$user = JFactory::getUser();
return $user->name;


I'd be greatful for any other thoughts of why the placeholder isn't resolving. The obve gives me a usable interim solution, but it wou ldbe good to find the issue.
 
Well, you should start with a full github update, so you are running the latest code. From a previous post, you said you are running 3.5.1 with a single commit from github. You should really "cherry pick" github changes, only ever run the complete thing, as sometimes changes in one commit rely on changes made in others.

Once you are running the latest code, I can tell you where to put some debug code in to see what's going on with the prefilters.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top