
Jason
Staff
/ Moderator

Jun 10, 2011, 10:11 AM
Post #8 of 8
(999 views)
Shortcut
|
|
Re: [kcmedia] Membership Plugin Help
[In reply to]
|
Can't Post
|
|
Hi Craig, I took a look and there are a couple of issues here. - The field in the Accounts table is called "kids_portfolio", so this is the field you need to reference using $CURRENT_USER. - In your where clause you need to specify which field you are searching against. For example:
'where' => "title = '".mysql_escape($CURRENT_USER['kids_portfolio'])."'", - I noticed that you are using the "title" of field of the kids_name section as the value field in your list boxes. Although this is okay for a very small scale, it can cause certain problems. First, if you ever need to change the name of a child, it will break all of your associations. Also, if you have more than 1 child with the same name (ie, John Smith), then the parent of 1 child will be able to see records associated with the other. I would recommend using the "num" field as the value for the list options (you can still use title for the label without a problem). For information on how to set this up, see here: (http://www.interactivetools.com/kb/article.php?Populate-a-list-field-from-another-section-15) That being said, you can structure your queries like this:
// load records list($kids_diaryRecords, $kids_diaryMetaData) = getRecords(array( 'tableName' => 'kids_diary', 'where' => "kids_name = '".mysql_escape($CURRENT_USER['kids_portfolio'])."'", 'perPage' => '5', )); // load records list($kids_galleryRecords, $kids_galleryMetaData) = getRecords(array( 'tableName' => 'kids_gallery', 'where' => "kids_name ='".mysql_escape($CURRENT_USER['kids_portfolio'])."'", 'perPage' => '10', )); // load records list($kids_nameRecords, $kids_nameMetaData) = getRecords(array( 'tableName' => 'kids_name', 'where' => "title = '".mysql_escape($CURRENT_USER['kids_portfolio'])."'", 'limit' => '1', )); $kids_nameRecord = @$kids_nameRecords[0]; // get first record Hope this helps --------------------------------------------------- Jason Sauchuk - Programmer interactivetools.com Hire me! Save time by getting our experts to help with your project. http://www.interactivetools.com/consulting/
|