YAFLogo

youtpout
  • youtpout
  • 53.6% (Neutral)
  • YAF Forumling Topic Starter
11 years ago
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
Sponsor

bbobb
  • bbobb
  • 100% (Exalted)
  • YAF Developer
11 years ago
You should write your own ActiveDiscussions control and put it into your section.
youtpout
  • youtpout
  • 53.6% (Neutral)
  • YAF Forumling Topic Starter
11 years ago
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)
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);
    } 
YAF Logo Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved
About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button