ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Incorrect value for {member_id} when used in exp:channel:entries, causes problem with SCM

October 07, 2011 10:12am

Subscribe [3]
  • #1 / Oct 07, 2011 10:12am

    DanL

    56 posts

    I’ve hit a bit of a problem with the above.  I’m running EE2.2.2.

    Basically, I have a page wrapped in:

    {exp:channel:entries channel="courses" limit="1" require_entry="yes"}
    {exp:simple_commerce:purchase entry_id="{entry_id}" success="site/success" cancel="site/index" country_code="GB" currency="GBP"}
    
    ... PAGE CONTENT ...
    
    {/exp:simple_commerce:purchase}
    {/exp:channel:entries}

    The main content pulls in the info from the channel entry, which is also assigned as an entry inside the SCM.  The user is basically able to book a course via SCM based on the information presented to them.  There is a custom PayPal form within the content to handle the cost, course name and stuff like that - nothing fancy.

    It’s all working perfectly, except that any logged-in user who makes a purchase gets logged in the SCM purchases list as being the super-admin.  It seems that SCM records the purchaser ID from the {member_id} value.  I have found that {member_id} within the channel:entries loop always returns “1” (super-admin), I guess it’s pulling it from the author_id of the entry.

    What’s particularly annoying is that {member_id} is not even listed as a valid variable for channel:entries (we have {author_id} for that), so I’m not too sure why this is should getting returned incorrectly in the first place.

    Can anyone suggest a way around this?  It’s so frustratingly close yet cripples the whole system just because of this one mis-reported variable.  The documentation reports the “{member_id}” Global as “The Member ID for the currently logged-in user”, well, that’s obviously not quite the case.

     

  • #2 / Oct 07, 2011 1:29pm

    DanL

    56 posts

    As usual, I found the answer shortly after posting 😊

    I figured that the “custom” POST variable must contain the member’s ID and mine was hard-coded.  I just needed to replace the number with {logged_in_member_id} which got things working correctly!

    Nothing to see here…move along…

  • #3 / Oct 07, 2011 8:48pm

    Dan Decker

    7338 posts

    DanL,

    Excellent! I’m glad you were able to sort it out on your own. If you need assistance in the future, let us know by starting a new thread.

    Cheers!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases