0

I’m building a system where entries should have specific member access.

I have a parent template that checks member group which then embeds a template specific to this and then lists entries which should only display if the current member ID matches the specified entry ID. Problem is using the ‘member_id’ or ‘logged_in_member_id’ won’t work.

I’ve tried a number of ways to do this but none work.

Firstly I’ve tried directly:

{if '{pref_member_access}' == '{member_id}/{logged_in_member_id'}
do a thing
{/if} 

Next I tried embedding the id:

{if '{pref_member_access}' == '{embed:mem_id}'}
do a thing
{/if} 

with parent:

{embed="_page/.pref_list" mem_id="{member_id}/{logged_in_member_id}"} 

and also I’ve tried with stash:

{exp:stash:set name="mem_id"}{member_id}/{logged_in_member_id}{/exp:stash:set} 

These will all work and give me the correct output inside the embeded template but NOT if I try to use the output inside the conditional.

Just to clarify I am not using ‘{member_id}/{logged_in_member_id}’ as I have put it in the code above, I have used either/or

If I specify a member ID the conditional will work:

{embed="_page/.pref_list" mem_id="8"}
or
{exp:stash:set name="mem_id"}8{/exp:stash:set}
for example 

even if I try to ‘stash’ the member ID at my master template it won’t work as a dynamic value either.

(you can probably ignore the stash code if you are unfamiliar with it, this isn’t really regarding that, I’m just trying to use the current logged in members ID as a dynamic value)

Any ideas?

Thanks

2 Answers 2

1

Just to update my issue turned out to be, I had 'member_data' disabled in my channel entries tag

disable="member_data|pagination|trackbacks"

after removing that I was able to use {logged_in_member_id}.

...now I have another issue but I'll post that if it comes to it.

...I also somehow have 2 accounts

0

Try using {logged_in_member_id} instead of {member_id}. If I remember correctly it's parsed early and so should be available to your conditional.

1
  • Thanks for the reply unfortunately I have already tried both (mentioned above)
    – Keith
    Commented Oct 22, 2015 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.