Hi,
below I'll show you some of the steps you need to perform, but some of the steps you will need to your self.
Copy
BlogContainer.ascx to your folder (We will use it to reference all your custom Blog controls)
1. Create a page and add the
BlogContainer WebPart
...
<%@ Register TagPrefix="MonoX" TagName="BlogContainer" Src="/YourProjectName/ModuleGallery/Blog/BlogContainer.ascx" %>
...
<
MonoX:BlogContainer
ID
=
"blogContainer"
runat
=
"server"
UsePrettyPhoto
=
"true"
DateFormatString
=
"d"
RelatedContentVisible
=
"false"
EnableSyntaxHighlighter
=
"true"
GravatarRenderType
=
"NotSet"
/>
...
2. Now you need to check for the permissions
- You can check if user is a member of specific group by running this code
...
var groupBLL = MonoSoftware.MonoX.BusinessLayer.GroupBLL.GetInstance();
groupBLL.GroupId = Some group that you want to use (you can fetch the group id with the MonoSoftware.MonoX.Repositories.GroupRepository)
var status = groupBLL.GetStatus(Guid userId)
//you can use SecurityUtility.GetUserId() to get the current user id
blogContainer.Visible = (status.Equals(GroupMemberStatus.ApprovedMember) || status.Equals(GroupMemberStatus.Admin));
...
- or you can check if you are friend with the current user
...
var friendRepository = MonoSoftware.MonoX.Repositories.FriendRepository.GetInstance();
blogContainer.Visible = friendRepository.FriendRequestExists(yourId, SecurityUtility.GetUserId());
...
And as for comments you need to inherit from
BlogPostView.ascx and to do so please follow these steps
1. Copy the
BlogPostView.ascx (only ascx file) to your folder
2. Add code-behind file (cs) named
BlogPostView.ascx.cs and redirect it like this
From
<%@ Control Language="C#" AutoEventWireup="true" Inherits="MonoSoftware.MonoX.ModuleGallery.Blog.BlogPostView" Codebehind="BlogPostView.ascx.cs" %>
To
<%@ Control Language="C#" AutoEventWireup="true" Inherits="YourNameSpace.BlogPostView" Codebehind="BlogPostView.ascx.cs" %>
3. In the Page_PreRender you need to add functionality similar to the Blog permissions described above but here you will show/hide
ctlComments
4. Now you need to reference your
BlogPostView in the
BlogContainer
From
<%@ Register TagPrefix="MonoX" TagName="BlogPostView" Src="/MonoX/ModuleGallery/Blog/BlogPostView.ascx" %>
To
<%@ Register TagPrefix="MonoX" TagName="BlogPostView" Src="/YourProjectName/ModuleGallery/Blog/BlogPostView.ascx" %>
Now everything should be prepared for test run.
Regards