Copied to clipboard

Flag this post as spam?

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


  • Niels Pedersen 18 posts 49 karma points
    Apr 26, 2012 @ 22:52
    Niels Pedersen
    0

    Posting a users email from "User Picker"

    Hi everybody

    I'm trying to fetch the E-mail of a user that has been picked by the "User Picker" from uComponents.

    The userpicker has the alias "articleAuthor" and is used on every page to choose who is responsible for the current page. On every page a small e-mail form is present which sends a mail to the one who has been selected from the Userpicker.

    The mail-form is working, but i can't seem to fetch anything other than the ID from the user in articleAuthor. The best possible solution would be if i could access both the Username and the Email from that ID. But i have searched all over, and havn't been found anything.

    Here is the razor-script that i'm using. Appologies for the messy code, i'm a begginner :)

    @inherits umbraco.MacroEngines.DynamicNodeContext
    @if (Model.HasProperty("articleAuthor"){
                                              
        var author @Model.articleAuthor;
                                                                               
        <p>Ansvarlig for denne side
        <href="#" id="slick-toggle"><img src="/images/mail.png" alt="" /<strong>@author</strong></a>
        </p>
                                    
              <div id="formular">
                  @if (!IsPost)
                  {
                      <form runat="server" method="POST">
                         <br/>
                      <div id="slickbox" style="display:none;">Din besked:<br/><textarea name="msg" rows="3" cols="40"></textarea><br/>
                      Dit navn:<br/><input type="text" name="name"/><br/>
                       Din e-mail:<br/><input type="text" name="mail"/><br/>
                      <input type="submit" value="Send besked"/></div>
                         <br/>
                      </form>
                  }
                  else
                  {
                     var modtager @Model.articleAuthor;
                     var side @Model.Name;
                     var message Request["msg"];
                      var name Request["name"];
                       var mail Request["mail"];
                        umbraco.library.SendMail(@mail,@modtager,"Besked fra siden: " @side " / Fra: " name,message,false);
                      <div class="henvendelse_sendt"><br/><strong>Tak for din besked @name</strong><br/>Angående siden@side<br/>Din besked@message</div><br/>
                  }     
              </div>          
                       
    else {
      
        <p></p>
    }

     

    Hope somebody can help me on the right way :)

  • Niels Pedersen 18 posts 49 karma points
    May 07, 2012 @ 22:16
    Niels Pedersen
    0

    Still no solution to my problem, still hoping for a little help in the right direction :)

Please Sign in or register to post replies

Write your reply to:

Draft