Copied to clipboard

Flag this post as spam?

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


  • Robzor 8 posts 72 karma points
    May 11, 2015 @ 13:18
    Robzor
    0

    Problems with XSLT SendMail and GetCurrentMember

    Hiya, if anyone could offer some advice on this I'd be most grateful.

    New to Umbraco and XSLT.

    Trying to come up with a simple macro that sends an email with the currently logged-in member's name as the body text (just that for now). SendMail works fine with a test string for the body, but it won't work with any kind of variable instead, the email is always empty.

    <xsl:variable name="member" select="umbraco.library:GetCurrentMember()" />
    <xsl:variable name="name" select="$member/@nodeName" />
    
    <xsl:value-of select="umbraco.library:SendMail(
        '[email protected]',
        '[email protected]',
        'Email Subject Line',
        $name,
        'false'
    )"/>
    

    Any pointing in the right direction would be great!

  • Jan Skovgaard 11264 posts 23591 karma points MVP 8x admin c-trib
    May 11, 2015 @ 13:43
    Jan Skovgaard
    0

    Hi Robzor

    What version of Umbraco are you using? And are you certain that the $member variable holds any data?

    Do you get anything if you try writing this

    <textarea rows="10" cols="10">
     <xsl:copy-of select="$name" />
    </texarea>
    

    /Jan

  • Robzor 8 posts 72 karma points
    May 11, 2015 @ 13:59
    Robzor
    0

    Hi Jan,

    I'm using Umbraco version 7.1.6.

    I'm not sure that the variables contain data, no. I tried with just a basic test variable string but even that wouldn't appear as the email body.

    I don't know how to implement the textarea check either, since the Umbraco page with the macro call only contains razor script that deals with parameters passed via query string to the page in a hidden iframe. (As far as I can tell.)

    I'm really just trying to cobble together whatever working features I can despite only having the web interface to work with. Not ideal, I know. Thanks for taking a look, anyway!

  • Robzor 8 posts 72 karma points
    May 11, 2015 @ 15:17
    Robzor
    0

    Slightly closer...

    <xsl:variable name="member" select="umbraco.library:GetMember(1594)" />
    

    That returns a list of member data, anything in the member's properties by the look of it. Can't work out how to reference a specific property though, nor the member's name or ID number. Things like select="umbraco.library:GetMember(1594)/@nodeName don't seem to work.

  • Robzor 8 posts 72 karma points
    May 11, 2015 @ 16:17
    Robzor
    0

    I repositioned the macro on the relevant page directly for easier testing to find out where it's falling over.

    Using this code:

    <xsl:choose>
    <xsl:when test="umbraco.library:IsLoggedOn() = true()">
       You are logged in as 
        <p>
    <xsl:variable name="user" select="umbraco.library:GetCurrentMember()"/>
    <xsl:value-of select="$user"/>
        </p>
      </xsl:when>
      <xsl:otherwise>
       You are not logged in.
      </xsl:otherwise>
    </xsl:choose>
     

    It always returns true, but doesn't display anything for the current member, even with GetCurrentMember()/@nodeName and suchlike.

    Is there newer syntax I should be using?

Please Sign in or register to post replies

Write your reply to:

Draft