• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Details view shows no user date with row id -1, but does when user id entered explicitedly

fabrik_83

New Member
First post on forum so apologies if this has been covered previously: Rather simple task of showing logged in user info in Details view, but many hours later I've still not figured out why it won't work. Registered users DO show in Fabrik list view, and user detail shows when link from list view is clicked.

However when making a menu item with Fabrik Details type selected and options set to Row id: -1 and Key name: id, I get no Details data, just field labels:
View attachment 17369


If I insert an existing user ID number then the Details page displays user data as it should. Only thing changed is Row id field in Menu item option:

View attachment 17370

I'm running
- Joomla 3.8.10 with System Cache disabled
- PHP 5.6.3 on shared hosted Apache server
- Fabrik 3.8.1

I did try making a Fabrik field of user type, but that returned the Joomla user id, 639, instead of the internal Fabrik id, 8.

PS: Just tested with print_r($_REQUEST) to Details layout to see if there the was any difference between no data (row id: -1) and forced user (row id: 8) then did compare files with BBedit - exactly the same array values.

Thanks.
 
For "Row id"=-1 you must set "Key name" to the element storing the Joomla user id (usually an element type userid), not the internalid (holding the primary key).

Maybe you have to add such an element to your form.
 
Hello Troester,
If I use the Fabrik element type of user, see grab, it returns the Joomla user ID, not Fabrik user ID:

View attachment 17372


When I made a calc element to returned the Fabrik user ID it would display the correct (Fabrik) ID in a list view column, but in the Details form it would only output the variable name, such as {rowid}. Is there another Fabrik element with userid type that I need to download? On Fabrik Download page(s) I don't find it.

Thanks.
 
Yes, the Joomla user id (there's no "Fabrik user id").

This is what is Fabrik looking for if you use a form/details view with rowid = -1:
The Joomla user id of the logged-in user must match the user element in the row you want to display.

In php code and other places (like prefilters or Data-where of databasejoin elements) you can get the Joomla user id of the logged-in user with the placeholder
{$my->id}
 
I'm truly confused: I got the current fabrik user id of 8 when I viewed the data in list form. When I write 8 in Row id in menu item option then Details page display user info. When I use -1, or Joomla user id, in this case 639, I get no data returned.

So I just tried this again:
1. Created new Fabrik element, type user, Options>User Data: ID:
View attachment 17374
2. Copy and paste elements Name, userid_elem, into menu item "Key name" field:

View attachment 17375

Still returns empty Details form. What else can I try? Should this be easier?
 
These settings should do.
But the Joomla user id is only inserted into the record if the user is creating a new record.
So if you have already existing records (created before you added the userid_elem) there's no user id stored.
Display your userid_elem in the list to see what is stored.

You don't need to set "User Data" = ID. It's always storing the J! user id, this setting is defining what should be displayed (name, username, email...).

Again:
There's no "Fabrik user id", the id element (type internalid, primary key, autoincrement) is the row id, not related to the Joomla user.
 
Troester,
OK, just created new registerd user, activated and logged in– no details data. Can I email you login credentials so you can see the settings?

Many thanks
 
So if you have already existing records (created before you added the userid_elem) there's no user id stored.
In your register list there are only two entries, both with empty userid_element.
For the user you added in your-site there's no "register" record at all.

So go and edit these records as an admin (e.g. in the backend), select the correct Joomla user (it may be easier if you set the user element to show the Joomla username or name) and save.
The userid_elem should only be editable for admins.

You must set your list access. At the moment everybody can edit any record.
Set Add = public, view list =registered (if registered users should only be able to see their own record add a prefilter) etc.

If a guest does register do you want to create a Joomla user automatically? (add a jUser form plugin, but in this case set the userid_elem to be a field element, integer)
 
Thanks for all this. I created the two users using Fabrik juser plugin on Register form, and need to find a way to not have to manually set each register user with Joomla ID.

Is there user manual covering these points? Or can you direct me to instructions on proper set up of getting Joomla user id into userid_element via registration form. Will I find this topic in the wiki help site? I find the info there about controls and features are too general and rarely explained beyond basic functionality.
 
There's a setting in the juser plugin, "User ID Field", in the "Fields" tab, where you specify the element on your form that holds the user ID. The juser plugin will then update that field, after creating the new J! user, with the newly created user ID. This would typically be a hidden field element.

For non-juser forms (ie. ones people fill in on your site after they have registered), add a 'user' element, which will automatically save the user ID of the logged on user creating the form.

-- hugh
 
The jUser plugin is not set up correctly:
the User ID field must not be the record id (id element, primary key), it must be the element storing the Joomla user id (the userid_element which you created afterwards, but this element must be a field or database join (not user)).
Note if you want to update the Joomla user associated with the form's record when you edit the form's data you must supply a field (type field or dbjoin) in the "User ID field" (and in Fabrik3: a "usergroups" element in the "User group field") option in the 'Fields' section.
http://fabrikar.com/forums/index.php?wiki/joomla-user-form-plugin/
 
It works now! Thanks guys.

Just to be clear in case other Fabrik users are having this same issue: I created a Fabrik element of plugin type "user", and then selected this field for the Key name in my Menu item for Details page on the Fabrik Form Options tab:

View attachment 17428

Two things that originally stumped me was

1. The name in the juser wiki instructions show the field as "userid" which looks similar to the name of Fabrik internal id field, "id", which it is not. I added suffix of _elem to new user field to make it easier for me to distinguish it from the internal id field.

2. The other required fields for the juser plugin– name, username, password, and email– SEND their data to Joomla User record upon creating new user, but the juser "User ID field" (all these fields on "Binds data to Joomla user account" tab of juser plugin) RETRIEVES the Joomla user id and stores it in Fabrik db so it knows which user is currently logged in, yes? I intially assumed (incorrectly) this field would send its data, the Fabrik id number, into Joomla user ID field like the other fields do.

I notice that if I edit data in Fabrik page it will updates the user info in Joomla User record, but not the reverse. Editing the user name in Joomla User record did not change username in users Fabrik record. Not a requirement for my current project, but wondering how would I bind the fields in both directions, if possible?
 
Editing the user name in Joomla User record did not change username in users Fabrik record.
If you have set up the userid_element correctly and set "Sync on edit" = yes it's updating in both ways:
On form editing it's loading the current Joomla user settings into the form (so if you've made changes via Joomla's user handling they will show up),
on form save it will update the Joomla user settings.

But:
This is only if you are editing the record and you won't get new users created via Joomla automatically.
So you should modify or create users in a Fabrik list with a jUser form only via this form.
 
OK, now that I've got the current user Detail page working, thanks to you and Hugh, I'm wondering how the sync option will work when I import users from clients existing db. Should I open a new post for this?
 
Are you importing into the Fabrik list, with CSV?

If so, in order to create J! users, you'll have to use the listcsv plugin, which lets you run custom code for each row being imported.

There's an example of creating users, with instructions on how to customize:

https://github.com/Fabrik/fabrik/bl...k_list/listcsv/scripts/create_client_user.php

I haven't run that for a while, so there's a chance it might need some fettling, but it looks like it might still work.

-- hugh
 
Hi All,
I'm not having any luck with listcsv plugin. I've modified then selected create_client_user.php script in the plugin after I added tit o Registration list. I've replaced 'changethis' to my full elements name, including table name. Running import from list I get error message of "Sorry the following fields in the CSV File are not found in this table:..." then list of all the csv values.

View attachment 17440


Perhaps my csv file isn't set up correctly? Here are the first two rows: the first the header and the second row the first record (of ten, not shown):

userid_element,name_element,username_element,email_element
101,JesseConner,jesconner,gene@me.com

I know Hugh is on vacation this week but hoping for any help from other users or support members. Thanks in advance.
 
Looks like you don't have the right line ending in your file.

If you find me on Skype (hugh dot messenger at gmail dot com) and send me the file, I'll try importing it here.

-- hugh
 
Hugh,
I've emailed you my csv file and customized import_script.php for listcvs plugin. (Sorry I don't understand what you mean by finding you on Skype.)
This is a minimum field import–only four fields– I wanted to establish as a test and baseline, but I hope to import another 16-20 fields used in my Fabrik Registration form, so any instructions for this as well would be great. Thanks.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top