I installed LG Member List 1.2.1 on ExpressionEngine 1.6.7 then did the following
Populated extension settings with member group ids.
Set up the custom field, which is showing in my Publish window, and is populated with members from the groups specified in the extension settings.
Published a weblog entry and selected a member from the drop down list.
Logged in as that member, and was able to see the weblog entry (as expected).
Logged in on another browser, as a different member: one who is not authorized to be able to see this entry: PROBLEM: This unauthorized member can also see the entry.
Bottomline: It’s my understanding that LG Member List will limit access to an entry to the member names selected in the dropdown list on the Publish page. Is that correct? If so, any suggestions for troubleshooting?
Thanks.
Hi, LG Member List just collects the selected member ids for the particular weblog entry so that you can use those ids in your regular weblog template code. It doesn’t limit access to those members.
If you want to do that, how you do it will depend on what you’re trying to restrict and where.
As John indicates, you can use the LG Member List id data in your template code to limit access using conditionals. This will allow you to limit viewing of parts of your frontend based on the selected Member ID.
If you’re looking to limit access to the backend EE control panel and its entries then you should look at editing member groups and also perhaps at third party addons like this or this.
Hope that helps.
Hi, LG Member List just collects the selected member ids for the particular weblog entry so that you can use those ids in your regular weblog template code.
Thanks BU, very helpful.
And, to better understand LG Member List: are you saying that its functionality is primarily to gather the member ID numbers for those members in the drop down list, to avoid having to go into Admin > Members & Groups and finding the member id number at the end of the url?
No propblem.
Yup, it’s just that - get the Member ID and save you the job. What you do with the ID thereafter is up to you.
I’ve used it to allocate per post to particular members for use in a frontend system, using conditionals as described above, but you could do all sorts of things with it.
… its only functionality was to save you the grunt work of having to find individual member id numbersIt is, but how you apply that and use it is wide open. Sorry if I misled.
Thanks again, BU … and if you have a few minutes would you consider posting a short example of how you use LG Member List?
Thanks.
Hi again. Sorry for the delayed response. Here’s some code to illustrate. In these I have a weblog called projects and it has a custom field called project-mine that I’m using LG Member List as the field type. This allows me to select a member per post in the projects. Here’s code for a listing page to only show to a logged in member those projects that have been allocated to him.
<h1>Projects</h1>
{exp:weblog:entries weblog="projects"}
{if project-mine == logged_in_member_id}
<h2>{title}</h2>
{body}
etc....
{/if}
{/exp:weblog:entries}
or, perhaps better:
<h1>Projects</h1>
{exp:weblog:entries weblog="projects" search:project-mine="{logged_in_member_id}"}
<h2>{title}</h2>
{body}
etc....
{if no_results}
There are no projects assigned to you currently.
{/if}
{/exp:weblog:entries}
Hope that helps.
Hello BU,
I adapted your (above) code example (as shown below) and it didn’t work. In another thread discussing this issue John Donavan said:
“I don’t think it is gonna be as easy as that as those member ids are stored within an array…”
and gave me an example that includes a php script; (also shown below).
My question is: Why does your use of the LG Members field work and mine doesn’t?
Thanks for helping me understand this …. Ramone
My LG Member List Code
{exp:weblog:entries weblog="students" orderby="date" sort="desc" limit="100" disable="trackbacks" }
{if sandbox == logged_in_member_id}
<h2 class="underline">{title}</h2>
{page_body}
{page_body_extended}
{/if}
{/exp:weblog:entries}
John’s PHP Version
{exp:weblog:entries weblog="students" orderby="date" sort="desc" limit="100" disable="trackbacks" }
<?php
global $SESS;
$loggedinmember = $SESS->userdata['member_id'];
$memberarray = '{sandbox}';
$people = explode(",", $memberarray);
if(in_array($loggedinmember, $people))
{
?>
<h2 class="underline">{title}</h2>
{page_body}
{page_body_extended}
<hr >
<?
}
?>
Hi there Ramone,
John’s not quite right - they are stored in a comma delimited string, not an array, but he is right in that things aren’t quite so straight forward when you’re using this for multiple members that have been selected in the extension.
And his code does work fine too, unlike mine. The code I provided was just example code, not something from a live site, so I hadn’t tested it when I posted it - sorry, I should have said (and tested).
Having done that now I see that the 2nd version of my code doesn’t work. I suspect that’s a parse order issue.
The first version of my code does work though, but only when you’re dealing with a single selection in the extension, not when you select more than one. And the reason for that is that ‘1’ == ‘1’, but ‘1’ != ‘1,2’ (for example). Edit: actually it looks like even this may be problematic.
You can use John’s code to get around this. Sorry if I led you astray.
I’ve now written a basic plugin to provide a conditional that can be used for checking whether the logged_in_member_id is available in the LG Member List field (it also does some other things). Let me know if you want to play with it. I’ll release it publicly when I get a moment.
You can use John’s code to get around this. Sorry if I led you astray.
You’ve been very helpful, BU. Even though I didn’t get the code you provided to work, I learned plenty trying out what you provided … and as a bonus, I got a nice php workaround from John. A net plus for productivity.
Thanks.
I’ve now written a basic plugin to provide a conditional that can be used for checking whether the logged_in_member_id is available in the LG Member List field (it also does some other things). Let me know if you want to play with it. I’ll release it publicly when I get a moment.
I’d be interested in exploring your plug-in, BU. And if you don’t mind, it would be helpful if you gave an example or two explaining what it does and what motivated you to create it. (I’m trying to develop a developer’s perspective.)
Thanks.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.