Copied to clipboard

Flag this post as spam?

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


  • Ali Sheikh Taheri 470 posts 1648 karma points c-trib
    Feb 06, 2014 @ 14:59
    Ali Sheikh Taheri
    0

    Get Current User in Dewd

    Hi ,

    In my custom table I've got "LastEditedBy" column and I would like to fill in the column by the current user, is there any way that I can pass the current user ?

    I am currently using version 1.4.

    Thanks

    Ali

  • Ali Sheikh Taheri 470 posts 1648 karma points c-trib
    Feb 11, 2014 @ 12:40
    Ali Sheikh Taheri
    101

    answer to my question,

    1. create a static class
    2. create a static method as below
    3. overwrite the value of the property
    4. call event from your xml config file in the editor tag.

      using Eksponent.Dewd;
      using umbraco.BusinessLogic;
      
      
      public static class MyClassEvents
      {
          public static void BeforeSave(object sender, BeforeSaveEventArgs e)
          {
              // tab name _ property name 
              e.Values["Properties_Last Modified By"] = User.GetCurrent().LoginName;
          }
      }
      

    this is event tag within the editor tag

    event handler="NameSpace.MyClassEvents.BeforeSave,AssemblyDll" name="BeforeSave"
    
Please Sign in or register to post replies

Write your reply to:

Draft