Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Group Message Board Actions Display View modes: 
User avatar
Member
Member
Naresh - 4/26/2011 6:19:36 PM
   
Group Message Board Actions Display
Hi!

I am using "GroupMessageBoard" in our web site. Everything was working fine, but i faced a problem when implementing the actions to a message.

I need to display the actions (Edit and Delete) for each message posted.

I am able to display the actions (Edit and Delete) for all the messages posted. But, these actions are shown only to Global admin or Site admin or Group admin. But, not to a normal logged in user or group member who post a message to the message board. So, the normal user/Group member can not edit or delete his/her message once posted. I should be able to display these actions to each message which he posted.

I don't find any property in the web part to show these for normal user/group member. So, I tried to use custom macro in the web part, but it didn't work. So, I thought to implement the custom macro in the transformation for this web part. But, I am not able to resolve the macro value in transformation.

So, my questions here are:
1. Is their any property for "GroupMessageBoard" web part with which I can show these actions to a normal logged in user or group member who posted that message, so that he/she can edit or delete that particular message.
2. If their is no such property, how can I achieve that functionality in my web part.

Can you guys help me with this web part.

Thank You in advance.

Naresh

User avatar
Member
Member
kentico_michal - 4/29/2011 7:33:12 AM
   
RE:Group Message Board Actions Display
Hello Naresh,

Regrettably, this behavior is by design. The edit/delete links are displayed only in following cases:

- the current user is global administrator
- the current user is owner of the user’s blog
- the current user is admin of group’s blog
- the current user is board moderator
- the current user is in role that has Modify permissions set to true for CMS.MessageBoards module

However, in any cases the user will be able to edit or delete all messages, not only his or her messages.

However, you can change this behavior in the code of following module:

~\CMSModules\MessageBoards\Controls\MessageBoard.ascx.cs


You can control displaying buttons which will cover your needs by modifying following code in the rptBoardMessages_ItemDataBound method:

                        
// Handle buttons displaying
boardMsgActions.ShowApprove = ((this.BoardProperties.ShowApproveButton) && (!bmi.MessageApproved) && userVerified);
boardMsgActions.ShowReject = ((this.BoardProperties.ShowRejectButton) && (bmi.MessageApproved) && userVerified);
boardMsgActions.ShowDelete = ((this.BoardProperties.ShowDeleteButton) && userVerified);
boardMsgActions.ShowEdit = ((this.BoardProperties.ShowEditButton) && userVerified);


For example, following code snippet enables the current user to use edit/delete button if the current user has posted the message.


if (bmi.MessageUserID == CMS.CMSHelper.CMSContext.CurrentUser.UserID) boardMsgActions.ShowDelete = true;
if (bmi.MessageUserID == CMS.CMSHelper.CMSContext.CurrentUser.UserID) boardMsgActions.ShowEdit = true;


Best regards,
Michal Legen

User avatar
Member
Member
Naresh - 4/29/2011 11:42:05 AM
   
RE:Group Message Board Actions Display
Hi Michal Legen!

Thank You very much for the reply.
I tried in the same way and it worked for me.

Thank You,

Naresh