View Full Version : Active Posts Widget
burn0050
08-27-2010, 04:56 PM
Hi,
I'm trying to make a scrolling new posts widget. This will use javascript to poll a page every few seconds to look for new posts.
The main thing I can't figure out - how do I know what are only forum posts? There doesn't seem to be a field in the forum table that specifies what is the main forum - it looks like it has a main category, cms comments, main forum (this is a fresh install). Threads are in more than just the forum. Can anyone help?
The second thing will be putting javascript into a widget - it seems like the static html type would work for this, but from what I read it looks like I would have to create a new widget type. Is this correct?
Thanks!
Bill
Lynne
08-27-2010, 05:08 PM
I don't understand your question. Posts are stored in the posts table.
I don't think you'd have to create a new widget type. If you are going to have a query, then you will want to use a PHP widget.
burn0050
08-27-2010, 05:38 PM
I don't understand your question. Posts are stored in the posts table.
I don't think you'd have to create a new widget type. If you are going to have a query, then you will want to use a PHP widget.
Posts of all types are stored in the post table - comments on articles, for instance. I only want posts that are related to forums, not article or blog comments.
The query won't reside in the widget - the widget will use the xmlhttp object in javascript to hit a php page. This separate php page will contain the query that will return the latest posts to the user. The javascript will then insert new divs with post information - this will be a scrolling widget that will have divs added to the top that are new posts (really, links to the posts, just user subject and thread will be displayed).
Thanks,
Bill
Lynne
08-27-2010, 08:20 PM
When you write your post query, you will exclude those posts that are in threads that are in forums that you don't want to include (like the article forum).
burn0050
08-27-2010, 08:44 PM
When you write your post query, you will exclude those posts that are in threads that are in forums that you don't want to include (like the article forum).
Yes, that is my plan. What I'm asking is HOW to determine if a forum is a forum? I want to programmatically exclude posts that are not forum posts, but there's no way to tell in the forum table, from what I can see. I don't want to just exclude forum id '3' in the code - hardcode it - I want to be able to determine if an entry in the forum table is actually a forum and not something like a comment thread. I don't want to include/exclude based on the title, because the title can be changed.
The documentation talks about a form "category" - but I don't know how it makes that association. Is there another table for forum categories?
Lynne
08-27-2010, 09:42 PM
The forum table lists forums. Period. ALL of those are listed in your Forum Manager. They are ALL forums. Some may then be identified as Categories. That option is stored in forum.options. It's bitfield is called "cancontainthreads" and the value is 4 (so, 0 if No, 4 if true). See the forumoptions bitfields defined in bitfield_vbulletin.xml. There is one forum set to contain article comments and that is set in $vbulletin->options['vbcmsforumid'], so it's a variable.
burn0050
08-27-2010, 09:56 PM
The forum table lists forums. Period. ALL of those are listed in your Forum Manager. They are ALL forums. Some may then be identified as Categories. That option is stored in forum.options. It's bitfield is called "cancontainthreads" and the value is 4 (so, 0 if No, 4 if true). See the forumoptions bitfields defined in bitfield_vbulletin.xml. There is one forum set to contain article comments and that is set in $vbulletin->options['vbcmsforumid'], so it's a variable.
Thank you! Exactly what I needed to know!
So, if "cancontainthreads" is false(0) - then it is the comment forum? Or, would it be best to just exclude $vbulletin->options['vbcmsforumid'] in the query "and forumid <> " . $vbulletin->options['vbcmsforumid'] ? Or would I exclude all forums that can't contain threads (in case someone has created another forum that is something like a category)?
Thanks,
Bill
Lynne
08-28-2010, 02:10 AM
the comment forum is not a category. It is just a plain forum like all other forums. The only difference is that you can get this forumid from the variable $vbulletin->options['vbcmsforumid'] (it's the setting in vboptions > Content Management > Associated Forum for Comments) So, you can use that variable in the query to not grab any posts that are in threads that are in the forum $vbulletin->options['vbcmsforumid']
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.