We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Having a problem with LG Member List 1.2.1

Development and Programming

ramonekalsaw's avatar
ramonekalsaw
377 posts
16 years ago
ramonekalsaw's avatar ramonekalsaw

I installed LG Member List 1.2.1 on ExpressionEngine 1.6.7 then did the following

  1. Populated extension settings with member group ids.

  2. 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.

  3. Published a weblog entry and selected a member from the drop down list.

  4. Logged in as that member, and was able to see the weblog entry (as expected).

  5. 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.

       
John Henry Donovan's avatar
John Henry Donovan
12,339 posts
16 years ago
John Henry Donovan's avatar John Henry Donovan

Moving this to Extensions Technical Assistance forum as it is 3rd party.

What I do know is that it just assigns an array of member ids to that particular entry. There is no automation in it.

You will still have to use conditions I believe

       
BridgingUnit's avatar
BridgingUnit
214 posts
16 years ago
BridgingUnit's avatar BridgingUnit

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.

       
ramonekalsaw's avatar
ramonekalsaw
377 posts
16 years ago
ramonekalsaw's avatar ramonekalsaw
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?

       
BridgingUnit's avatar
BridgingUnit
214 posts
16 years ago
BridgingUnit's avatar BridgingUnit

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.

       
ramonekalsaw's avatar
ramonekalsaw
377 posts
16 years ago
ramonekalsaw's avatar ramonekalsaw
… you could do all sorts of things with it.

Now I’m curious again, because I thought its only functionality was to save you the grunt work of having to find individual member id numbers …

       
BridgingUnit's avatar
BridgingUnit
214 posts
16 years ago
BridgingUnit's avatar BridgingUnit
… its only functionality was to save you the grunt work of having to find individual member id numbers

It is, but how you apply that and use it is wide open. Sorry if I misled.

       
ramonekalsaw's avatar
ramonekalsaw
377 posts
16 years ago
ramonekalsaw's avatar ramonekalsaw
… its only functionality was to save you the grunt work of having to find individual member id numbers
It 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.

       
BridgingUnit's avatar
BridgingUnit
214 posts
16 years ago
BridgingUnit's avatar BridgingUnit

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.

       
ramonekalsaw's avatar
ramonekalsaw
377 posts
16 years ago
ramonekalsaw's avatar ramonekalsaw

Thanks BU. This helps alot!

       
ramonekalsaw's avatar
ramonekalsaw
377 posts
16 years ago
ramonekalsaw's avatar ramonekalsaw

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 >
<?
  }

?>
       
BridgingUnit's avatar
BridgingUnit
214 posts
16 years ago
BridgingUnit's avatar BridgingUnit

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.

       
BridgingUnit's avatar
BridgingUnit
214 posts
16 years ago
BridgingUnit's avatar BridgingUnit

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.

       
ramonekalsaw's avatar
ramonekalsaw
377 posts
16 years ago
ramonekalsaw's avatar ramonekalsaw
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.

       
ramonekalsaw's avatar
ramonekalsaw
377 posts
16 years ago
ramonekalsaw's avatar ramonekalsaw
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.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.