member_id shows different values on same page
Posted: 02 December 2008 02:23 PM   [ Ignore ]  
Research Assistant
RankRankRank
Total Posts:  357
Joined  09-18-2007

ive got {member_id} in my sidebar and main center column on the same page. in the sidebar it prints out as “0” and in the main column as “1”. it seems the sidebar is right - when im logged in it says 1 and when logged out 0. but in the main column it always says 1 even after logging out.

id like to use the member_id value to show content to user only if they are logged in, so:

{if {member_id} ==  0}
show content
for logged out users
{if
:else}
show content
for logged in users
{
/if}

possible?

 Signature 

Attended EECI2009

Profile
 
 
Posted: 02 December 2008 02:55 PM   [ Ignore ]   [ # 1 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  257
Joined  10-17-2007

I had something similar to this with IP address, it turned out that it was inside and outside a weblog tag (as in the same variable name is used inside EE for different uses).  I’d guess that it could be that member_id in the main_column is pulling back the id of who wrote the content, not who is logged in.

Just a guess…?

 Signature 

twobelowzero
EE add-ons support and comments
EE Shopping Cart and ecommerce solution (coming soon)

Profile
 
 
Posted: 02 December 2008 03:05 PM   [ Ignore ]   [ # 2 ]  
Research Assistant
RankRankRank
Total Posts:  357
Joined  09-18-2007

you guessed right, thanks! problem solved

 Signature 

Attended EECI2009

Profile
 
 
Posted: 04 March 2009 06:23 AM   [ Ignore ]   [ # 3 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  197
Joined  08-14-2007

Hey guys

If you want to show the member_id of a logged in user whilst in a weblog entries loop, you need to use:

{logged_in_member_id}

Hoping this helped.


Cheers

Jim

 Signature 

Jim Pannell | Six Media Web Development | Copenhagen, Denmark
Twitter: @jimpannell

Profile
 
 
Posted: 23 September 2009 01:52 PM   [ Ignore ]   [ # 4 ]  
Summer Student
Total Posts:  6
Joined  01-16-2009

Jim,

That {logged_in_member_id} tip is huge. I couldn’t work out why the member_id was not working correctly.

Thanks a lot,

Seamus

Profile
 
 
Posted: 23 September 2009 01:57 PM   [ Ignore ]   [ # 5 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  29096
Joined  05-15-2004

Nesting, probably. Using it inside of {exp:weblog:entries} or some other tag?

 Signature 

ExpressionEngine 2.0 Downloads | Docs | Bugtracker

“If the English language made any sense, lackadaisical would have something to do with a shortage of flowers.” (Doug Larson)

Profile
MSG
 
 
Posted: 23 September 2009 02:03 PM   [ Ignore ]   [ # 6 ]  
Summer Student
Total Posts:  6
Joined  01-16-2009

Hi Ingmar,

It is inside an embedded template, so I suppose it is nested.
Thanks,

Seamus

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1743, on December 02, 2009 03:47 PM
Total Registered Members: 120044 Total Logged-in Users: 57
Total Topics: 126169 Total Anonymous Users: 34
Total Replies: 663631 Total Guests: 371
Total Posts: 789800    
Members ( View Memberlist )