Inserting the username into a form content plugin

peterk900

Member
This code works in an article..
{fabrik view=form id=4 usekey=ref rowid=XAMC}
.. to fill in the form with details for user with username XAMC.

I'm trying to modify the article plug-in code to pick up the user name as I do with list pre-filters using {$my->username}. Simply substituting this for the literal user name doesn't work i.e. {fabrik view=form id=4 usekey=ref rowid={$my->username}}.

How can I modify the article plugin code to load the data for the logged in user ? Thanks.

PS I tried with a new view just retrieving the data for the logged in user - this works fine. I thought that if I created a page with the form relating to this single record view then it might be filled with the user data. However it is displayed with all fields blank.
 
I don't know if you can use $my->xx here, but if then the syntax would be
{fabrik view=form id=4 usekey=ref rowid=[$my->username]}

To open a user's record you can do
{fabrik view=form id=4 usekey=element-containing-the-userID rowid=-1}
 
Yes, $my->xx does work when I follow your format !
{fabrik view=form id=4 usekey=ref rowid=[$my->username]} fills the form with the data for the logged on user. You swop the curly brace, as is used in list Pre-Filter, for squared braces - makes sense as the placeholder uses {} . Thanks very much for this,

My problem is solved perfectly by the above but I tried your alternative {fabrik view=form id=4 usekey=ref rowid=-1} and this failed to retrieve any data. The user name is a 4 character alpha string stored in the ref field - different to the record id, field name id, which is numeric. Did I understand your code correctly or when you said userID did you mean the J! numeric id for the user - a field that is not in the list at present and would need to be included by a database join ?
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top