+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / RSS Feed Author is missing when using ActiveDirectory

RSS Feed Author is missing when using ActiveDirectory

5 posts, 0 answered
  1. MNP
    MNP avatar
    79 posts
    Registered:
    23 Apr 2008
    20 Feb 2009
    Link to this post
    I'm having difficultly seeing the Author field when using ActiveDirectory.

    I've created some blog posts through the API and have set the Author MetaData to be "Joe User". Through the CMS backend, I can see that in fact the author is set to Joe User. This however does not show up on the Blog Post, nor does it show up on the RSS Feed.

    What am I missing?

    Thanks

    -Matt
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    23 Feb 2009
    Link to this post
    Hello Matt,

    I tried to reproduced the problem you have reported, but everything seems to be fine at my end, even using a user from the AD to create a blog post programmatically. The user was listed on the BlogPost.

    Here is my code.

           string currentuser = Telerik.Security.UserManager.GetCurrentUserName(); 
            BlogManager blogManager = new BlogManager(); 
            IList ListOfAllBlogs = blogManager.GetBlogs(); 
            foreach (IBlog blog in ListOfAllBlogs) 
            { 
                if (blog.Name == "MyADBlog"
                { 
                    DateTime time = DateTime.Today; 
     
                    // here create a content 
                    IContent cnt = blogManager.Content.CreateContent("text/html"); 
                    cnt.SetMetaData("Title""USER_AD"); 
                    cnt.SetMetaData("Author", currentuser); 
                    cnt.SetMetaData("Publication_Date", time); 
                    cnt.ParentID = blog.ID; 
                    blogManager.Content.SaveContent(cnt); 
     
                } 
            } 

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. MNP
    MNP avatar
    79 posts
    Registered:
    23 Apr 2008
    23 Feb 2009
    Link to this post
    I must be missing something then. I'm wanting to post the username on each post that happens, so I followed the example listed out here: http://www.sitefinity.com/support/forums/support-forum-thread/b1043S-btdecd.aspx

    I then modified it from your example above.

     void ContentManager_Executing(object sender, Telerik.ExecutingEventArgs e) 
        { 
           //Check whether the user is creating content  
           if (e.CommandName == "CreateContent"
           { 
              //take the IContent Item from the command arguments  
              Telerik.Cms.Engine.IContent cnt = e.CommandArguments as Telerik.Cms.Engine.IContent; 
              //chech if there is such content and if it belongs to the Blogs provider  
              if (cnt != null && cnt.ProviderName == "Blogs"
              { 
                 //Save these to the Author Metafield.  
                  
                 String username = Telerik.Security.UserManager.GetCurrentUserName(); 
                 cnt.SetMetaData("Author", username); 
                  
              } 
           } 
        }  

    It still does not set the Author correctly. The "username" string is correct is if I put a break point there, it comes back with the correct value.

    Thanks for the help.
  4. MNP
    MNP avatar
    79 posts
    Registered:
    23 Apr 2008
    23 Feb 2009
    Link to this post
    I should follow up on this and say that the Author does not show up on the Post Preview inside the CMS. The code above sets the author field and it does show up in the RSS feed and the blog post, just not in the Preview screen.
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    24 Feb 2009
    Link to this post
    Hi Matt,

    Probably you are using Sitefinity 3.5. 17547. There is a problem with the Author metakey. The only way that you could fix this is adding a new metafield, let's say Post_Author and use it instead Author.
    This problem does is fixed in 3.6.

    Also here is the modified code from your post.

      void ContentManager_Executing(object sender, Telerik.ExecutingEventArgs e) 
        { 
            if (e.CommandName == "CreateContent" || e.CommandName == "UpdateContent"
            { 
     
                Telerik.Cms.Engine.IContent cnt = e.CommandArguments as Telerik.Cms.Engine.IContent; 
                if (cnt != null && cnt.ProviderName == "Blogs"
                {   
                    string currentuser = Telerik.Security.UserManager.GetCurrentUserName(); 
                    cnt.SetMetaData("Post_Author", currentuser); 
                } 
     
            } 
        } 

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
5 posts, 0 answered