Membership Plugin Help

8 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: June 10, 2011   (RSS)

By KCMedia - June 7, 2011

Hi

I have started the process of designing the membership pages and have it so that the users can login to the site that works great but now i am stuck on how to only show each user the information on the page that they are allowed to see as each user is only allowed to see their childs information and no others.

Also with this site the members are added to the cms by the staff only there is no signup page or anything like that.

Can someone help me here is the url for the membership login

http://www.waggachildcare.com.au/kids-portfolio.php

the login is test and the password is test

i have also included the page that will show all the information that is required.

some help would be great thanks
Thanks



Craig

KC Media Solutions

www.kcmedia.biz
Attachments:

kids-homepage.php 12K

Re: [Jason] Membership Plugin Help

By KCMedia - June 7, 2011 - edited: June 7, 2011

Hi Jason

well i have 3 sections setup the best way would be for you to take a look at the CMS admin and see how i have set it up would that be alright.

but what i have is 3 multi sections

1 will store the kids name
1 will store a gallery
1 will store a diary

the gallery and diary both have a drop down list that gets the kids name from it to relate the records together based on the kids information.
Thanks



Craig

KC Media Solutions

www.kcmedia.biz

Re: [kcmedia] Membership Plugin Help

By Jason - June 8, 2011

Hi Craig,

How does a parent's user account related to the kid's records?

Let me know and we'll see what we can come up with.

Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Membership Plugin Help

By KCMedia - June 8, 2011

Hi Jason

in the user account i created a drop down list that relates to the kids name so it shows a list of all kids added to the system.
Thanks



Craig

KC Media Solutions

www.kcmedia.biz

Re: [kcmedia] Membership Plugin Help

By Jason - June 9, 2011

Hi Craig,

What you can do then is get the value of that drop down for the user that is currently logged in like this:

NOTE, I'm assuming the name of the field is "kid"

$CURRENT_USER['kid']

You can then use this value in the where clause of your other queries to get records that only pertain to that kid. Exactly how you would use this value will depend on what the actual value of the list options is (ie, num, name, etc) and how you've set this up to relate to the other tables.

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/

Re: [Jason] Membership Plugin Help

By KCMedia - June 9, 2011

Hi Jason

i did that but i keep getting errors on the page and still didnt work.

here is the code for the page.
Thanks



Craig

KC Media Solutions

www.kcmedia.biz
Attachments:

kids-homepage_001.php 12K

Re: [kcmedia] Membership Plugin Help

By Jason - June 10, 2011

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 - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/