Blog Post Author & Custom Field question

Posted by Community Admin on 04-Aug-2018 20:54

Blog Post Author & Custom Field question

All Replies

Posted by Community Admin on 31-May-2011 00:00

1 )When posting in a SF 4 blog, I notice in the template that it is supposed to display the author of the post in the list. I See "By | Date posted" but no name.

<div class="sfpostAuthorAndDate">
    <asp:Literal ID="Literal2" Text="<%$ Resources:Labels, By %>" runat="server" />
    <sf:PersonProfileView runat="server" />
    <sf:FieldListView ID="PostDate" runat="server" Format=" | PublicationDate.ToLocal():MMM dd, yyyy" />
</div>

I presume that sf:PersonProfileView is what should be pulling the author name? Will it be the name of the actual poster if set properly? How would I check into why it is not displaying my name?

2) In our 3.7 environment I set a custom Boolean field on our blog posts to allow the poster to indicate if they did not want their post published elsewhere. How can I add this custom field to the blog module for our SF 4 migration?

-Jon

Posted by Community Admin on 01-Jun-2011 00:00

Hello Jon Ingersoll,

The field is populated by the values filled in your user registration (FirstName, LastName), can you please verify whether changing these fields will introduce some change.
Concerning custom fields for the blogs module, you can simply go to Sitefinity Backend -> Content -> Blogs and select Custom Fields for Blogs (rightmost section of your screen, somewhere in the middle). Please refer to the attached screenshot for more information. If you have any further questions, please do not hesitate to let us know.

Regards,
Boyan Barnev
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 01-Jun-2011 00:00

Boyan,

Thank you for the information. I went and checked my profile and my local user did not have a first and last name. This was my second local user so I think I forgot to enter the information this time around. So now my name is display on blog posts.

As for the custom field, what you sent is a custom field at the blog level, what I need is a custom field on the blog post object. Is there something in the admin for that?

-Jon

Posted by Community Admin on 02-Jun-2011 00:00

Hello Jon Ingersoll,

Yes, when you go to the posts for a given blog you have the option to specify custom fields for posts (same location in the Backend as for permissions for blogs)

All the best,
Boyan Barnev
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 02-Jun-2011 00:00

Boyan,

Thanks, that's what I was looking for. I must be losing my mind, I swear I looked on that page after you showed me how to set the custom field on the blog module.

I've setup the custom field that I need and it now shows in the backend blog post page. How would I go about setting this field programmatically in the codebehind of my custom usercontrol?

-Jon

Posted by Community Admin on 02-Jun-2011 00:00

Hello Jon Ingersoll,

You can use the GetValue() and SetValue() methods to operate with your custom filed programatically. I'm attaching a sample that's filtering blog posts based on certain taxonomies, I believe you might find it useful, as it is taking the value of the "Tags" custom field.

Greetings,
Boyan Barnev
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 02-Jun-2011 00:00

Boyan,

Sorry, but that code doesn't really help. I'm not trying to query the posts based on that field. I'm creating new posts via a custom form and submitting them.  I don't see the getValue or setValue methods on the post object or the organizer object. How do I set the custom field value on the actual post object I've created?

This is the custom code I'm working on:

BlogsManager bManager = new BlogsManager();
BlogPost bPost = bManager.CreateBlogPost();
//title & content
bPost.Title = Title.Text;
bPost.Content = RadContent.Content.ToString();
bPost.UrlName = Title.Text.Replace(" ", "-");
 
//Tag & Category
TaxonomyManager taxMan = new TaxonomyManager();
 
string classYear = getClassYear(commonCode.getPersonID(Page.User.Identity.Name, commonCode.getSessionAuthenticationImplementationID(HttpContext.Current)));
 
 if (classYear != string.Empty)
     
var tax = taxMan.GetTaxa<FlatTaxon>().Where(t => t.Name == classYear).Single();
bPost.Organizer.AddTaxa("Tags", tax.Id);
 
bPost.ApprovalWorkflowState = "Published";
//set parent
bPost.Parent = bManager.GetBlogs().Single(b => b.Title == BlogName);
//publish
 bManager.Publish(bPost);
 bManager.SaveChanges();

Posted by Community Admin on 02-Jun-2011 00:00

Hello Jon Ingersoll,

Sorry about that, forgot to mention that you'll need to add reference to Telerik.Sitefinity.Model as Get/SetValue are extension methods.

Best wishes,
Boyan Barnev
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 07-Dec-2012 00:00

Did you get this  to work? We need to do something similar.

This thread is closed