YAFLogo

Posted by: youtpout - Wednesday, 21 March 2012 23:03:35
Hello, I have integrated yaf in my website with direct link to section in my website menu, when i have new message in category my menu show new but they didn't perfect for me, i want use the same system than the forum how i do this (when they have unread message in topic the forum show new in category but my system no) ? Sorry for my bad english

Posted by: bbobb - Wednesday, 21 March 2012 23:38:46
You should write your own ActiveDiscussions control and put it into your section.

Posted by: youtpout - Wednesday, 21 March 2012 23:56:17
But what is the code to know when i have a unread discussion in category For the moment, i have created my own code (I use entity Framework) [code=csharp]public DateTime? DerniereVisite(string nom) { DateTime? date = null; var user = ctx.yaf_User.Where(u => u.Name == nom).FirstOrDefault(); if (user != null) { date = user.LastVisit; } return date; } public DateTime? DernierPost(int? ForumId) { DateTime? date = null; var forum = ctx.yaf_Forum.Where(f => f.ForumID == ForumId).FirstOrDefault(); if (forum != null) { date = forum.LastPosted; } return date; } public DateTime? DernierPost(string nomCategorie) { DateTime? date = null; var forum = ctx.yaf_Forum.Where(f => f.Name == nomCategorie).FirstOrDefault(); if (forum != null) { date = forum.LastPosted; } return date; } public bool TopicNonLu(int? idCategorie, string nomUtilisateur) { return DerniereVisite(nomUtilisateur) < DernierPost(idCategorie); } public bool TopicNonLu(string nomCategorie, string nomUtilisateur) { return DerniereVisite(nomUtilisateur) < DernierPost(nomCategorie); } [/code]