Membership Plugin Guidance
13 posts by 4 authors in: Forums > CMS Builder
Last Post: August 31, 2010 (RSS)
By zip222 - August 16, 2010
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
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
Re: [zip222] Membership Plugin Guidance
By Maurice - August 17, 2010
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: [zip222] Membership Plugin Guidance
By Jason - August 17, 2010
Yes, this can be done. Try this:
Edit the User Accounts section and add a checkbox field called display_record. Go through the user accounts and check the box for users you want to display as an option in the other sections.
Next, edit the section where you would like to select users to view certain records. Add a list field called display_record. For "Display As" you can select either pulldown (multi value) or checkboxes (multi value). For "List Options" select "Get options from MYSQL Query (advanced)". In the box below, add this code:
SELECT num, username
FROM `<?php echo $TABLE_PREFIX ?>accounts` WHERE display_record=1
Then save. When you go into records in that section now, you can select which users will be able to see those records.
Finally, when using the getRecords function on your viewer page, you can use code that looks like this:
list($listingsRecords,$listingsMetaData)=getRecords(array(
'tableName' => 'listings',
'allowSearch' => false,
'where' => "display_record LIKE '%\t".intval($CURRENT_USER['num'])."\t%'",
));
This code will only select records from the listing table where the current user has been selected from the list field we created.
Give that a try.
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
thanks!
Re: [zip222] Membership Plugin Guidance
By zip222 - August 17, 2010 - edited: August 17, 2010
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
$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 31, 2010
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!