Different User Content via Membership Plugin

6 posts by 3 authors in: Forums > CMS Builder
Last Post: March 13, 2012   (RSS)

By benedict - March 6, 2012

Hi guys,

I've used the Website Membership plugin a few times and it's worked great, but a new client has thrown me a curve ball.

At the moment, I have a section called Login Content, so when the user logs in, they see the 4 or 5 records in this section as a side navigation.

Problem is, the content here is relevant (and confidentail to) Customer X who logs in. If Customer Y logs in, they should see a different set of records.

I'm thinking I just create a "Customer" section linked to the login content section, and then users can select which content is visible to which customers. But how does the plugin know which content to show which customer?

And is this the best solution as it could get very messy.

I'm stumped. Any ideas?

Re: [benedict] Different User Content via Membership Plugin

By gkornbluth - March 6, 2012

Hi Benedict,

The website membership plugin is an extremely powerful tool. There are over 30 recipes in my CMSB Cookbook http://www.thecmsbcookbook.com] that describe how to implement the plugin to accomplish various tasks.

If you look through the Table of Contents, I think you'll find some interesting topics.

Good luck with this,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [Jason] Different User Content via Membership Plugin

By benedict - March 13, 2012

Hi Jason,

Can't quite get this to work. When I put in this line of code of yours:

'where' => "members LIKE '%\t".intval($CURRENT_USER['num'])."\t%'",

The records disappear.

When I run debugSql, I get the following:

SELECT SQL_CALC_FOUND_ROWS `login_content`.*
FROM `cms_login_content` as `login_content`
WHERE (members LIKE '% 1 %')
ORDER BY dragSortOrder DESC


That looks right to me except the big gaps around the '1' - is that how it should look?

To confirm, I have a section called Login Content, and the section I am using to store member Accounts is the User Accounts section. Isn't that the default for when using this plugin?

Re: [benedict] Different User Content via Membership Plugin

By Jason - March 13, 2012

Hi,

Yes, the spaces are okay. What those are are the tab characters (\t) that were put into the string. If the page isn't producing any errors, then it would seem to be an issue with how the members field is set up.

Is the members field a single value or a multi value drop down? The set up in the example was for a multi-value drop down. If you want to use a single value drop down instead, you can use this:

'where' => "members = '".intval($CURRENT_USER['num'])."'",

Also, you need to make sure that the num field is being used as the option value in your members field.

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] Different User Content via Membership Plugin

By benedict - March 13, 2012

Success! You rule!