Membership Plugin Guidance

13 posts by 4 authors in: Forums > CMS Builder
Last Post: August 31, 2010   (RSS)

By zip222 - August 16, 2010

I have the successfully completed the basic setup for the membership plugin, but I was wondering if you could give me some general guidance on how to get it to show/hide content for each user.

Small group of users (10)
A separate multi-record listing that a user will see once logged in, but specific records need to be hidden for each user

Re: [zip222] Membership Plugin Guidance

By Jason - August 16, 2010

Hi,

How are you deciding which records are displayed for an individual user?

Can you provide me with the code you have so far?

Let me know and I can take a closer look at this.

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 Guidance

By zip222 - August 17, 2010

That's actually what I am looking for guidance on. How should I approach setting which records are displayed for each user? In theory I would like there to be a list of checkboxes in the record editor that the administrator can select. And the checkbox list should only include certain users - it shouldn't show every user. this list could be determined by adding a checkbox to the user record.

Re: [zip222] Membership Plugin Guidance

By Maurice - August 17, 2010

Hi zip222,

that's what I do 2 right now its pretty cool and easy I even make portlets that way.

<?php if ($CURRENT_USER['show_career_planning']): ?>
<?php include('portlets/planning.php'); ?>
<?php else: ?>
<?php include('portlets/control_panel.php'); ?>
<?php endif ?>


I can even the Section Access how ever its all very basic but powerful and easy it could be done beter in a different way i think but its a start.

Greetz M
-------------------------------------------

Dropmonkey.nl

Re: [Jason] Membership Plugin Guidance

By zip222 - August 17, 2010

I think this is exactly what I am looking for. let me give this a try and I will let you know how it goes.

thanks!

Re: [zip222] Membership Plugin Guidance

By zip222 - August 17, 2010 - edited: August 17, 2010

Perfect, but I have a followup question:

How do I modify the page where statement to check for a second condition...

'where' => "display_record LIKE '%\t".intval($CURRENT_USER['num'])."\t%'",
OR
'where' => "$CURRENT_USER['staff']=1",


so basically if the user account is "staff" they get to see all listings.

Re: [zip222] Membership Plugin Guidance

By Jason - August 17, 2010

No problem. What you can do is set up a $where variable like this:

$where="";

if(!$CURRENT_USER['staff']){
$where = display_record LIKE '%\t".intval($CURRENT_USER['num'])."\t%'";
}


list($listingsRecords,$listingsMetaData)=getRecords(array(
'tableName' => 'listings',
'allowSearch' => false,
'where' => "$where",
));


So if the current user is set as staff, the where clause will be empty and therefore return all records.

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/

Re: [Jason] Membership Plugin Guidance

By zip222 - August 17, 2010

Awesome! Works perfect.

Re: [Jason] Membership Plugin Guidance

By zip222 - August 31, 2010

bringing back a previous post to ask a follow-up question:

How do i modify this statement:
if(!$CURRENT_USER['staff']){
$where = reviewer_conflicts LIKE '%\t".intval($CURRENT_USER['num'])."\t%'";
}

to do basically the opposite, meaning:
if(!$CURRENT_USER['staff']){
$where = reviewer_conflicts IS NOT LIKE '%\t".intval($CURRENT_USER['num'])."\t%'";
}


"reviewer_conflicts" is a checkbox list and if they check a box I don't want the CURRENT_USER to see it on the page.

thanks!