Copied to clipboard

Flag this post as spam?

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


  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Nov 17, 2011 @ 10:42
    Ismail Mayat
    0

    Last edit dashboard

    In umbraco 4.7 for the last edit dashboard control is it possible to update so that you can also put the editor name next to node name? Also does the last edit only show last edits for currently logged in user or is that list for all users?

    Regards

    Ismail

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Nov 17, 2011 @ 11:21
    Lee Kelleher
    1

    Hi Ismail,

    You could create a new inline method to effectively override the PrintNodeName one? Like so...

    <%@ Control Language="c#" AutoEventWireup="True" Codebehind="LatestEdits.ascx.cs" Inherits="dashboardUtilities.LatestEdits" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
    <link href="/umbraco_client/propertypane/style.css" rel="stylesheet" />
    
    <script runat="server">
        public string PrintLine(object nodeId, object date, object userId)
        {
            var nodeName = PrintNodeName(nodeId, date);
    
            int id;
            if (int.TryParse(userId.ToString(), out id) && !string.IsNullOrWhiteSpace(nodeName))
            {
                var user = umbraco.BusinessLogic.User.GetUser(id);
                if (user != null)
                {
                    return string.Format("{0} by {1} <br/>", nodeName.Replace("<br/>", string.Empty), user.Name);
                }
            }
    
            return nodeName;
        }
    </script>
    
    <asp:Repeater id="Repeater1" runat="server">
        <HeaderTemplate>
        <div class="propertypane">
            <div class="guiDialogNormal" style="margin: 10px">
            <h2><%=umbraco.ui.Text("defaultdialogs", "lastEdited")%>:</h2>
        </HeaderTemplate>
    
        <ItemTemplate>
            <%# PrintLine(DataBinder.Eval(Container.DataItem, "NodeId"), DataBinder.Eval(Container.DataItem, "datestamp"), DataBinder.Eval(Container.DataItem, "userId")) %>
        </ItemTemplate>
    
        <FooterTemplate>
            </div>
        </div>
        </FooterTemplate>
    
    </asp:Repeater>
    

    You could extend it to only display currently logged in user - umbraco.BusinessLogic.User.GetCurrent()

    Enjoy!  (Keep in mind that upgrades will overwrite this!)

    Cheers, Lee.

  • Chris Randle 85 posts 199 karma points c-trib
    Oct 17, 2012 @ 19:47
    Chris Randle
    0

    It only displays the currently logged in user! The real question is "how do I get the control to display all users?"

  • Tom W 39 posts 96 karma points
    Apr 14, 2014 @ 17:04
    Tom W
    0

    I've just had to do this for a client, and it seems as if the Writer is the last user to edit the document, which is a User object, with a "Name"

    var d = new Document(int.Parse(nodeId.ToString())); 
    var by = d.Writer.Name; 

     

    Just in case anyone else gets befuddled.

Please Sign in or register to post replies

Write your reply to:

Draft