我们正在开发orchard,我们需要创建一个用户的活动供稿,意味着用户的所有活动,如更新,删除或插入其详细信息,以及他们在主页中显示的内容。如何使用orchard cms创建自定义活动源?或者是否有任何现有的设计?
答案 0 :(得分:1)
您可以通过为UserPart创建内容处理程序来拦截用户详细信息上的“活动”,如此
public class MyHandler : Orchard.ContentManagement.Handlers.ContentHandler
{
// public
public MyHandler()
{
// listen to user events
OnPublishing<Orchard.Users.Models.UserPart>(UserPublishing);
OnRemoving<Orchard.Users.Models.UserPart>(UserRemoving);
...
}
// private
private void UserPublishing(Orchard.ContentManagement.Handlers.PublishContentContext aContext, Orchard.Users.Models.UserPart aUserPart)
{
// do some stuff on user publishing
}
private void UserRemoving(Orchard.ContentManagement.Handlers.RemoveContentContext aContext, Orchard.Users.Models.UserPart aUserPart)
{
// do some stuff on user removal
}
...
}
可在此处找到大量文档: http://docs.orchardproject.net/en/latest/Documentation/Understanding-content-handlers/
还有一个名为Orchard Audit的模块,它似乎记录了用户活动: http://gallery.orchardproject.net/Packages/Orchard.Module.Downplay.Audit