Copied to clipboard

Flag this post as spam?

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


  • Martin Rud 260 posts 1001 karma points c-trib
    Feb 18, 2010 @ 08:21
    Martin Rud
    0

    Doc2Form: How to show edit-macro in template only to member who created the document

    Hi,

    In my master template I have inserted the following macro in order to make the document editable for the frontend visitor. However, now the edit form shows up to every frontend visitor, but I only want it to show up to the member (if logged in) that has created the document using Doc2Form.

    I save the member id in the field alias myMemberId.

    I am newbie into templating and masterpages so my question is: Can somehow use an if statement to check if the user is logged in and the user has the same member id as the member id saved in the alias field myMemberId?

    The macro is on the node that contains the document so the member id is on the document.

     

    My macro:

    <umbraco:Macro DocumentType="1108" 
        Template=""
        TabName="contact"
        PageTabs="0"
        HideTabNames="0"
        ChooseWhereToStore="1080"
        EditMode="0"
        ShowTitle="0"
        TitleName=""
        SaveMemberAlias="myMemberId"
        ShowDescriptions="0"
        SubmitButtonText="Send Message"
        PreviousButtonText=""
        NextButtonText=""
        RequiredText=""
        TextOnSubmit="Thank You, we will respond as soon as possible"
        PublishOnSubmit="0"
        RefreshToParent="0"
        RedirectToNode=""
        PublishWithUserId=""
        StorePropertiesInCookies="bodyText, myName, myPhone"
        SendEmailResponse="0"
        ResponseSubject=""
        ResponseMessage=""
        ResponseEmailFieldAlias=", "
        ResponseCopyTo=""
        EmailForm="0"
        FormSubject=""
        FormMessage=""
        FormToEmailAddress=""
        FormFromEmailAddress=""
        UseAjax="1"
        DefaultValueNode=""
        Alias="Doc2FormComplete"
        runat="server">
    </umbraco:Macro> 

     

    Can I do someting like this:

     <% if (... code checking if logged in member is the same as myMemberId ....) { %>
            --- the macro here ----
    <% } %>

    ...and what will the code inside the parenthesis be?

     

    Regards,

    Martin

Please Sign in or register to post replies

Write your reply to:

Draft