associate special data with each user

Re: [moh3] associate special data with each user

By Chris - August 27, 2010

Hi moh3,

You can do this using a List Field. Let's say you have a Multi Record section called "Phone Bills", add a List Field to it called "user":

Field Label: User
Field Name: user
Field Type: list
Display As: pulldown
List Options: Get options from database (advanced)
Section Tablename: accounts
Use this field for option values: num
Use this field for option labels: username


Now you can associate Phone Bills with Accounts.

Finally, to show a user their Phone Bills, you'll want to use a 'where' clause to get only the records associated with the CURRENT_USER's num:

list($phone_billsRecords, $phone_billsMetaData) = getRecords(array(
'tableName' => 'phone_bills',
'where' => mysql_escapef('user = ?', $CURRENT_USER['num']),
));


Does that help? Please let me know if you have any questions.
All the best,
Chris

Re: [chris] associate special data with each user

By moh3 - August 27, 2010

hello chris ,thanks for your reply i have one more question
can i use external data that i pull from a different database say i have a already built database that already has phone bills how can i integrate that data with the membership addon,i have one idea in my head is by using a normal mysql query but how can i join the two together to pull out data

Re: [moh3] associate special data with each user

By Chris - August 27, 2010

Hi moh3,

You'll likely want to use custom SQL to do this. How you join depends on what data is available. Take a look at the cms_accounts table to see what fields are there. I'm imagining that you'll probably want to use email, username, or first_name+middle_initial+last_name. Alternately, you could add a new field to your CMS Builder accounts table.
All the best,
Chris