mybb - 如何检查新的私人消息

发布于 2024-10-18 08:12:26 字数 109 浏览 1 评论 0原文

我正在尝试为我的网站构建一个 chrome 应用程序/扩展程序,该网站主要是一个 mybb 论坛。我想知道是否有人知道我如何检查用户的线程上是否有新的 Pm 或新帖子?也许通过 JS、AJAX 或 PHP

I'm trying to build an chrome app/extension for my website which is mostly a mybb forum. I am wondering if anybody knows how would I check to see if a user has new Pm's or maybe new posts on his thread? Maybe by JS, AJAX, or PHP

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

话少情深 2024-10-25 08:12:26

就事件而言,通常对于 PM 来说,数据库中有一个名为“read”的字段,如果他们没有打开它,则该字段为 false,如果打开则为 true。在页面加载时,检查是否有任何给用户的消息是“未读”的,如果有,加载它们,并使用 JQuery 弹出一个简短的描述。您还可以使用一个小型 AJAX 脚本定期检查这一点。

就新帖子而言,我所看到的传统方式(但绝不是最好的方式)是保留用户上次访问该网站的时间戳。页面加载时,获取在该时间戳之后创建的每个新帖子/主题,然后序列化此数据并将其存储在数据库或 cookie 中(如果此序列化数据已存在,则将其反序列化,合并两者并重新序列化) 。如果用户访问某个主题,则从匹配的序列化条目中获取所有数据(IE,在同一主题中,或帖子编号),并将其从序列化数据中删除。然后再次在页面加载时或通过使用 AJAX 脚本,定期检查他们是否在属于他们的主题上有“未读”帖子(IE,在其最后一个时间戳值之后创建),并使用一些 JQuery 来通知他们。

As far as events go, generally for PM's there is a field in the database called 'read', which is false if they haven't opened it, and true if they have. On a page load, check to see if there are any messages to the user that are 'unread', and if so, load them, and use JQuery to make a pop up saying a short description of them. You could also have a small AJAX script periodically check for this.

As far as new posts go, the traditional way that I've seen it done (but by no means the best way) is to keep a timestamp of when a user last visited the site. On page load, get every new post/topic that was created after that timestamp, then serialize this data and store it in the database, or in a cookie (if this serialized data already exists, unserialize it, merge the two and reserialize it). If a user visits a topic, get all data from the serialized entry that matches (IE, in the same topic, or the post number) and remove it from the serialized data. Then again on page load or by using an AJAX script, check periodically if they have an 'unread' post on a topic that belong to them (IE, created after their last timestamp value), and use a bit of JQuery to notify them.

白日梦 2024-10-25 08:12:26
  • 了解 JQuery。这是一个非常友好的 JavaScript 框架,您很快就会启动并运行。使用 JQuery 编码很有趣!
  • 执行定期 AJAX 请求
  • 将数据注入到 DOM 中,或者如果您正在创建一个 Google Chrome 扩展,就像您的标签所告诉的那样,请使用很棒的 桌面通知系统
  • Learn JQuery. It is a very friendly javascript framework and you will be up and running in no time. Coding in JQuery is fun!
  • Do periodic AJAX request.
  • inject data into DOM or maybe if you are creating a Google Chrome Extension like your tag is telling use the awesome Desktop Notifications System.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文