Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Odin Daniel Jensen 6 posts 27 karma points
    Mar 07, 2011 @ 22:35
    Odin Daniel Jensen
    0

    GetCurrentMember problem (Again)

    Hi Everybody

    Working on my second Umbraco site an so far all have been smooth sailing.
    I got the build in membership provider working, however now I want to pass the ID of the currently logged in member to as flash application through a flashvar and absolutely none of the XSLT examples I found on the net + this forum worked. Returning the member with copy-of yields nothing.

    One post suggested Umbraco still used the old API for these data and that you should write your own but I haven't been able to find any working examples of this.

    I'm using Umbraco 4.5.2 out of the box installation.

    Judging by the many posts here it seems to be a general issue :)

    Thanks in advance

    Odin

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 07, 2011 @ 22:38
    Jan Skovgaard
    0

    Hi Odin

    Could you provide us with a sample of the code, which you're trying to fetch details from the current logged in member?

    /Jan

  • Odin Daniel Jensen 6 posts 27 karma points
    Mar 07, 2011 @ 22:40
    Odin Daniel Jensen
    0

    Uh yes. I was a bit fast there :)

    <xsl:variable name="member" select="umbraco.library:GetCurrentMember()" />
    <xsl:value-of select="$member/@id"/>

    I also tried

    <xsl:value-of select="$member/node/@id"/> 

    which somebody wrote as an issue in later version.

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Mar 07, 2011 @ 23:01
    Tom Fulton
    1

    Hi,

    First of all, you should try outputting the results of GetCurrentMember to see what you are getting back.  You can do this like so:

    <textarea><xsl:copy-of select="$member"/></textarea>

    I assume you might get something like "No current member exists (best practice is to validate with 'isloggedon()' prior to this call)".  If that's the case, you might try some of the solutions in this thread

    If those solutions don't help, it might be a bug.  There's a bug in 4.7 RC where GetCurrentMember always returns that error, but it's slated to be fixed for the final.    I'm not sure though if this bug was present in 4.5.2 or not. 

    Hopefully one of the fixes in the above thread works for you.  Also, if you're familiar with .NET, the following code works for me to get the current member's ID without using GetCurrentMember.  You could create an XSLT extension to access if needed from XSLT

    int currentMemberId = umbraco.cms.businesslogic.member.Member.CurrentMemberId();

    Hope this helps,
    Tom

  • Odin Daniel Jensen 6 posts 27 karma points
    Mar 08, 2011 @ 21:06
    Odin Daniel Jensen
    0

    Thanks. I've tried anything with xslt. It just doesn't render anything.

    But I'll go with the backend solution. I need to do some webservices anyway :)

    Thanks for your help :)

    Odin

Please Sign in or register to post replies

Write your reply to:

Draft