Re: [nmsinc] Adding list of records to “User” section
Hi,
So to make sure I understand, your "Table 1" is the user accounts table. It has a field that takes a value from Table 2 (company table). And Table 3 also has a field that takes its value from the company table. You want to then get all the records in table 3 where the table 3 field has the same value as the field in the accounts table. Does that sound right?
If so, once the website membership plugin is installed and the user is logged in we can use the $CURRENT_USER array to find the value of the field in accounts table. Here is an example of what we can do.
Because I don't know the names of all your fields/tables, I'll have to make some assumptions. Let's assume that table 3 is called "listings". Let's also assume that the field that is in both the accounts and listings tables that comes from the company table (table 2) is called "company".
Assuming this, we can get a list of all listings where the company field matches the company field in the accounts table like this:
list($listingsRecords, $listingsMetaData) = getRecords(array(
'tableName' => 'listings',
'allowSearch' => false,
'where' => "company = '".intval($CURRENT_USER['company'])."'",
));
Hope this helps get you started.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/