Copied to clipboard

Flag this post as spam?

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


  • Fabry 7 posts 57 karma points
    Feb 03, 2013 @ 15:42
    Fabry
    0

    Using of RenderMacro datatype with actualized parameters

    Hi
    in a 4.11.4 all MVC, I have a document type, used to hold the registration data of an user to an event. I have a MemberPicker field that points at this user. In a tab of the backoffice, I would like to see, with RenderMacro, some data of user's profile.
    Can I pass to RenderMacro the value of MemberPicker as a parameter ?
    In this way, the Editors could know (read only) some information about the user (name, phone, etc), without access to the Members section.

    Thank you,
    Fabry

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 03, 2013 @ 16:29
    Jan Skovgaard
    0

    Hi Fabry and welcome to our :)

    So what you're asking is that if you have a member picker property on a document type, would it be possible to have some basic information about this member displayed in the backoffice for the content editors to see?

    Or do I misunderstand your question?

    Looking forward to hearing from you.

    /Jan

  • Fabry 7 posts 57 karma points
    Feb 03, 2013 @ 16:45
    Fabry
    0

    Hi Jan
    thanks for your quick assistance :-)

    Exactly this !

    Eventually, the MemberPicker could be replaced with a label (readonly for editors), written by the surface controller that manages the registration form. in any case, the ID of the member is available.

    Thanks,

    Fabry

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Feb 04, 2013 @ 10:08
    Lee Kelleher
    0

    Hi Fabry,

    Good question. As far as I know, there isn't a way to pass parameters into the macro when using the RenderMacro data-type.

    However if the member's ID (property value) is published, then it is possible to retrieve that data from within the macro itself.

    1. Grab the page's ID (either from the querystring, or maybe $currentPage, if using XSLT)
    2. Get the node (XML or NodeFactory) for that Id
    3. Grab the property value for the member ... get the member object
    4. Display accordingly.
    I'm sure you'll hit a few issues, let us know how you get on - will try to help where we can.
    Cheers, Lee.
  • Fabry 7 posts 57 karma points
    Feb 04, 2013 @ 16:41
    Fabry
    0

    Hi Lee,

    Thanks for your suggestion!
    I'll try and I'll keep you informed :-)

    btw, this could be a nice feature for a futur release

    Regards,
    Fabry

  • Fabry 7 posts 57 karma points
    Feb 28, 2013 @ 20:09
    Fabry
    100

    Hi Lee,

    today I implemented this part of the site and your suggestion has been very useful.
    For those interested, this is my solution.


    I have a DocumentType named "Application" that contains a member picker named "Company" (hidden with uHidesy and for administrative use only).

    I created a macro named "CompanyInfo" associated with the razor script below and a DataType named "CompanyInfo Render Macro" obviously based on uComponents Render Macro and with Macro Editor setted at "CompanyInfo" . Then, in "Application" I added a "Company" tab and, within, a field of type "CompanyInfo Render Macro".

    The razor script for macro, which render an address field of the member, is this:

    @inherits umbraco.MacroEngines.DynamicNodeContext
    @using umbraco.cms.businesslogic.member;
    @using System.Web.Profile;
    @{
        string applicationId = Request.QueryString["id"];
        var application = Library.NodeById(applicationId);
        int memberId = application.Company;

        Member member = new Member(memberId);
        var profile = ProfileBase.Create(member.LoginName);
    }
    <h2>@member.Text</h2>
    <div class="propertyItem">
        <div class="propertyItemheader">Address</div>
        <div class="propertyItemContent">@profile["address"]</div>
    </div>

    I hope it can be useful to someone.

    Bye,

    Fabry

Please Sign in or register to post replies

Write your reply to:

Draft