How can I ensure users only see records created by themselves?

BTW, if you are reading this thread and are using Fabrik 2.0, any references to evela'ed element defaults of ...

PHP:
global $my;
return $my->id;

... in this thread should use ...

PHP:
$user =& JFactory::getUser();
return $user->get('id');

... in J!1.5 / Fabrik 2.0.

-- hugh
 
How to have drop down lists to only show my own entries from a different database?

I'm currently creating a community site with a comprofiler database, where users can enter details about their car(s), when filling out their profiles.

Now, on a different place on that site, I want them to be able to make entries using a FABRIK form, where they could select a car from their profile. The entries in that respective dropdown list should be restricted to only show their own car(s) and none of other users.

What I did is:
I created a "database join" element, which connects to the comprofiler entry holding the list of cars.
I'm now trying to find the correct syntax for the "where statement (sql)" option, so that only his/her own cars will be shown to a user of that form.

Could you give me a hint, please?

Many thanks in advance!
You guys are awesome btw!

Cheers!
Johannes
(using Fabrik 2.0b3 rev 799)
 
Assuming the J! userid is stored in the same table you are joining to:

WHERE comprofiler_table.userid = {$my->id}

-- hugh
 
I've been trying to get people to enter golfscores. The scores and the par of the courze appear in the database in a table i created but the userid of the one who enters the data is not stored.
Therefore i keep getting NO data found after entering.
Pffft
Hope someone has a simple solution for this
 
Can you start another thread in the Community Support forum, and describe how you have your table / elements set up?

-- hugh
 
Did everything according to instructions.
Only when I show the username field in a dropdown box the Id of the user is stored in the table. When I make it hidden and put access to superadmin the id is not stored.
Did the whole scenario twice now.
 
Don't set access to superadmin. Just leave it at whatever level of user has normal (submit) access to the form.

-- hugh
 
Quotes, quotes, quotes

J 1.0.12 / Fabrik 1.0.3 / MySql 5.0.75 / Community Builder 1.0.2

After following Rob's clear and straightforward instructions, my page responds with a nice
MySQL error: Unknown column \'ben\' in \'where clause\'
which refers to
where ( fsb_fabrik_formdata_1.username = ben )
That's right, I'm not a column. This where-statement needs quotes!

So I surround the {$my->username} in single quotes, but they seem to get escaped (probably an addslashes() thing)
MySQL says:
Error blabla....right syntax to use near \''ben' )
There is an extra escaped quote there, but the statement shown says
....where ( fsb_fabrik_formdata_1.username = 'ben' )
which is perfectly OK (I fed it directly into phpMyAdmin and there's no problem).

As a possible solution I tried to get the "Id" field out, which is numeric and would solve the need for quotes, but I can't get it stored, nor does the {$my->id} seem to work. Double quotes won't do the trick either.

I don't have access to any Fabrik documentation. (I'm doing this for a cheap sportsclub).
A big compliment to the product that I still managed to get a form and table (including picture upload and different authorizations for viewing, editing etc) up and running on a server with way outdated software versions.

Thanks!
Ben
 
try upgrading to 1.0.6? I can't guarentee that will fix your issue but theres a good chance

Cheers
Rob
 
Thanks, that solved it! (and it threw up a lot of other issues that I'm going to bother you with next ;)

BTW, I had to use {$my->username} for the filter
 
Just some fair warning ... we are unlikely to be able to help with 1.0.3 issues. We're getting close to release 2.0, and 1.0.6 has been the stable, official release of 1.0.x for at least a year. We don't have 1.0.3 installed anywhere, and I don't even think we have a tagged 1.0.3 branch in SVN, as we moved to a new SVN host between 1.0.3 and 1.0.4.

We only guarantee support for 1.0.6. Anything prior to 1.0.6 is done on a "best effort" basis, with the most likely answer being "upgrade to the latest version".

I suggest you clone your J! site to a sandbox, and try a 1.0.6 update.

-- hugh
 
Can't use the "Apply filter beneath" option

I am using this instructions to filter the users information when showing their records, so they can only see their own records, but I need one "super user" that has access to all records and I can't get the filter exception to work, I think it has to do with the type of user, all users are shown as "Registered" and the "super user" I set it as "super administrator" and tried all different combinations and I can't make it work, can you assist me with this please?

In your form add a "username" element, called "username" This element automatically inserts the current user's userid into your form as a hidden field.

Now each time you users adds a record, via the form, to the database table, their user id is also recorded.

The second thing to do is to edit your table, and add a prefilter so that each user sees only the records that they have created:

  • Edit your form's table.
  • Select the "data" tab
  • Under the "prefilter" section press "add filter"
  • Select "username" from the field dropdown (the "username" element we previously created)
  • Select "EQUALS" from the condition drop down list
  • Enter "{$my->id}" (without the quotes) into the "value" field
  • Select "super administrator" from the filter drop down. NOTE ! - this means that the filter is applied to everyone EXCEPT the super administrator. So in our case normal users will see only their records, where as the super administrator will see all the records
  • Save your table
 
Sorry I have "super administrator" under Apply filter beneath. I think I am a little confused with the users levels, cause I created the "super user" from the front end.
 
Not sure what you mean by "I created the super user from the front end".

The "apply filter beneath" setting is related to the Joomla group access level of users. If you set that to "Super Administrators" on your filter, then the filter will be applied to anyone beneath that level (i.e. from guest level, through Registered, up to Administrator level).

On a default J! install there is only one "super administrator", which is the admin account you create when you installed J!. You can optionally assign Super Administrator level to other users as required (although you should keep super admin accounts to a minimum, as they have certain very dangerous abilities!)

So, if you login to the front end with your super admin account, are you seeing all the records?

If not, double check (in the J! User Manager) that the account you are using really is set to Super Administrator level.

-- hugh
 
Userid and email

Thanks for this great product. I'll be giving it a glowing review shortly.

My application is a little different than the others listed here. Hopefully you can steer me in the right direction. I have a database containing business listing information. Fields like Business Name, Address, Phone, Email etc. This data was collected during a survey by a third party and supplied to me in csv. I have it in a table now in Fabrik with some database join elements for some fields. It's all looking great so far.

I would like the individual business owners to be able to update their own records. Unfortunately, none of them currently have a userid on the Joomla site. Is there a way that I can ask the business owner to register and then use the email address which was collected in the survey to grant edit priveleges if it matches the email address used during site registration?

Thanks

Bob
 
Hmmmmmmmmm.

No, you can't do access control based on email.

But, it would be possible to write a script which would match registered account emails with emails in your table, and fill in a userid element on the table accordingly.

This could be written as a Fabrik 'scheduled task', which could run (say) once an hour, and match up Joomla accounts with the survey data table. Not ideal, as they wouldn't instantly have access to their data after signing up (it could take up to an hour before that happens), but would work.

Alternatively, it may be possible (although I'm far from sure) to write a Joomla system plugin to do this, such that it would happen immediately when they sign up, but I'm a lot less familiar with the Joomla signup API than I am with Fabrik's scheduled tasks.

At a guess it would take 45 mins to an hour to write and test a scheduled task plugin to do this. If you'd like to post a request in the Commercial Services forum, I can quote you for doing the work.

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

Thank you.

Members online

Back
Top