Jump to content

HermodBB - Basic BB/Forum/Comments module


Recommended Posts

Hi all,

I thought I'd take this opportunity to announce a module I've been working on for a private project. Although it's not yet complete, I thought I'd take the time out to see if anyone would be interested in it. I only have the module locally on a test site, so if there is any interest, I can upload it somewhere suitable and maybe others can add to it, provide feedback etc.

What is HermodBB?

Hermod (messenger of the Norse gods) BB (Bulletin Board) is a module that installs a selection of templates and fields that you'd expect for a frontend forum. It also provides some methods to easily save topics and comments.

All topics and comments (replies) are simply pages, and are organised like can be seen in the following image.

post-2170-0-05457900-1444938262_thumb.jp

Each forum has checkbox permissions for viewing, posting, pinning etc (see image below).

post-2170-0-20860700-1444938516_thumb.jp

These permissions can then be verified with some simple code (see below).

// Use the helper method to pull a list of forum pages
$forums = $hbb->forumsRender(); 

  foreach ($forums as $forum) {

    // Only show the forums to those that are allowed to view them
    $rolesForumView = $forum->hbb_forum_view;
    if ($rolesForumView->has('id=' . $user->roles)) {
      // User has view access for the forum
    }  
  }

HermodBB also makes it easy to add comments to other pages, i.e articles, blogs etc. Comments are added as sub-pages, just like they are for topics.

What HermodBB doesn't do

HermodBB does not dictate any markup or sanitization. Any sanitization method can be used, and each topic and comment can easily be rendered as required. I'm currently using UIkit and CKEditor, but this can easily be changed to Bootstrap/Foundation etc. It keeps everything simple so that Processwire can do all the heavy lifting.

Note:

I am aware that there is the excellent comments module by Ryan, and also the Discussions module by Apeisa, but I needed something a little different for my current project, so I decided to have a bash myself. I am by no means on the same level of coding as the majority of members on here, so please be gentle :)

I'd also like to thank Ryan personally for such an excellent framework.

Any questions etc, please feel free to ask.

  • Like 19
Link to comment
Share on other sites

Is there any way I can send you money?

(On some occasions I believe I have threatened to send money to someone brave enough to take a stab at creating a PW-based forum solution)

Thanks for the offer, however I don't feel that HBB warrants any sort of payment as it is essentially a simple module.

This looks great, I'd love to see a full forum system:) Well this is exciting, mind sharing some code or a github so that we can take a peek? The structure looks like it makes sense. 

I will indeed give access to the code shortly. I'm not sure if it'll dissapoint, but I'll let you be the judge of that.

I am interested in finding out what features people would like included. I'm keeping it as simple as possible, but so far there are fields to store the following information:

Author's IP address & user agent string

Topic / comment message content

Creation / edit date (if edited)

Pinned status

Locked status

Who has viewed the topic

Which members can view the topic (ideal for private messages)

The $page ID of the comment for reply status reference

I'm toying with the idea to add fields for images and attachments, thus allowing the option to store images or attachments with comments, a bit like you can do with this forum.

  • Like 3
Link to comment
Share on other sites

  • 2 weeks later...

Just to update those following this thread on the status of the module. I am still working on it, and I'm currently tidying things up :)  I'll provide a few template examples when I release the module so that you can easily have a forum up and running within a limited time.

My main priorities at present are the following:

1. A clean installation

2. A clean uninstallation

3. To plant the acorn, and for PW to grow the tree.

I personally like to know what a module installs, so I'll provide that information at a later date for those that don't want to dig through the code. It's going to be as minimalist as possible, but it's also going to do everything a forum should do, and that's all thanks to PW and the excellent API.

Below are some extra shots of my test installation. You can see the root of the forum, and then the forum view. I have added forum categories since the last time, so forums can now be grouped, i.e Member forums, guest forums etc. Those forum groups also have view permissions, so with some API magic, all the forums within that forum group can easily be hidden for specific roles without having to hide them individually.

Again there is no markup provided for this module, so it's up to you how it renders. I am currently using UIKit for testing purposes. Anyway, here's the shots..... (red writing is not part of the screenshot)

------------------- Main (root forum view)

post-2170-0-38418700-1446250317_thumb.pn

------------------- New User Forum (from the New Users forum group)

post-2170-0-05134800-1446250327_thumb.pn

-------------------

Questions, ideas etc still always welcome. And yes I will release the code shortly when I have ticked off all my to-do boxes. As you can see from the last screenshot, the forum topics are ordered by their last reply. I've made this easy to do via an extra date field, so they'll be no need to worry about comments or topic order for that.

Again you can pull the comments, topics etc however you wish. I have made it paramount that I don't include any restrictions. All my recent test helper methods have now been removed from the module.

  • Like 7
Link to comment
Share on other sites

"To plant the acorn, and for PW to grow the tree."

I could see using this to discuss work-in-progress demo sites with clients. Keeping things more on-topic than emails tend to be. Setup topics and links while coding, putting discrete links in the content. Conditionally rendered so you can turn them on and off by role/priv. Often these discussions clarify policy. Pin those for future reference. Other topics could be how-to info. 

"I would love to see the possibility to subscribe to a topic and get notified by email when an answer is posted"

Also could have a notice come from the PW messaging system after you login.

  • Like 4
Link to comment
Share on other sites

Thanks for the feedback. It's always appreciated.

My plan is to create a module with minimal code at first, and hopefully others can add to it so that together we can make this something stable and easy to use, with all the features we'd expect. One thing I don't want is a bloated mess.

I'm curious to find out what you all think about fields. A forum module obviously has the potential to install a lot of fields. Personally I don't mind if those features are useful, but I'm interested hearing what you think. HermodBB currently installs 21 fields, and these range from storing the IP address, to storing who has viewed the topic, and to storing the permissions for a per-forum based permission system. Some people will consider 21 fields to be bloat, but a forum obviously needs to store a lot of data. So what are your views? I have made sure that fields are grouped in a logical manner so that they're not all over the place.

post-2170-0-94734300-1446325220_thumb.pn

*field names are still likely to change, but you get the idea :D

  • Like 2
Link to comment
Share on other sites

I'm curious to find out what you all think about fields. A forum module obviously has the potential to install a lot of fields. Personally I don't mind if those features are useful, but I'm interested hearing what you think. HermodBB currently installs 21 fields, and these range from storing the IP address, to storing who has viewed the topic, and to storing the permissions for a per-forum based permission system. Some people will consider 21 fields to be bloat, but a forum obviously needs to store a lot of data. So what are your views? I have made sure that fields are grouped in a logical manner so that they're not all over the place.

I am not sure this is how I would consider it. Btw, a lot of fields is relative. There's a site here in the forums that had 800+ fields! Whilst I thought (then) that that was a lot of fields, some people looked at me like duh! Since then my perception has changed and is guided differently. So, rather than asking these from a cosmetic point of view (visual bloat?), I think we should be asking the following questions?

  1. What are the forums data needs?
  2. How best can we store that data to facilitate efficiency? (i.e. easy, fast and optimized queries)
  3. What format should we best store a data format in? Varchar, int, etc?
  4. If storing strings, are we better of storing some stuff as JSON?
  5. Should we store some stuff in one page or as different pages?
  6. Should we store some data in its own table or store it as part of a column (sub-field) in a row?
  7. How will the forum scale vis-a-vis our data model?
  8. EDIT: See next post - Are all/some of our data needs best served by developing custom Fieldtypes and Inputfields?

We then base our data model around such questions. If that results in 20, 50 tables, so be it. Give me a scalable data model any time than a short list of fields in the backend, something that I won't be spending my time interacting with often  ;)  :P

Just my 2p

Edited by kongondo
See #8 and next post
  • Like 5
Link to comment
Share on other sites

Looking at your fields again, I see you are storing some simple stuff as comment ID in their own field (i.e. db table). I seriously think you should consider creating some custom Fieldtypes to store some data. For instance, the forums views could all be in one Fieldtype and the different view properties would all be stored in it as sub-fields, i.e. the database schema of a FieldtypeForumViews could look something like this:

forum_id            forum_cat_view              forum_desc                                  etc
1                         xxx                                     This is a cool forum
2                         xxx                                     This is members only forum
 
Sorry if this seems to be taking you back. My thinking is that you'd rather get it right (or better) at the beginning than later. I don't  know how comfortable you are with code and if you will be able to develop custom Fieldtypes and Inputfields that will come as part of the forum. However, Fieldtypes are very powerful, modular, will still allow you to use the PW API, are very scalable and will allow storing of lots of stuff that would otherwise probably end up as a page (nothing wrong with pages but sometimes a custom Fieldtype is better than using a field that ships with the core). TBH, if I was to do my Blog module all over again, this is the approach I would most likely follow. I for one would be willing to help you although my time is very limited. 
 
Sorry if I am raining on your parade, but thought this was an important matter to consider. 
  • Like 4
Link to comment
Share on other sites

Feedback like that is always appreciated. Custom Fieldtypes certainly make sense and you're certainly not raining on my parade, as I would want the module to be done correctly.

I will admit that I know nothing about creating custom Fieldtypes, and my PHP coding level isn't on par with most people on here. So I'm not sure where to start with that as I can't seem to find any documentation on it?

Thanks for the comments.

  • Like 1
Link to comment
Share on other sites

Now that makes sense. So it's basically (for newbies like me) about grouping related data together to make it more efficient and scalable, and this in turn will cut down on the number of custom fields I need to install?

I'll be sure to download that module and have a good read.

Thanks!

  • Like 1
Link to comment
Share on other sites

Ye, that + more :-)..
 
Have a read here + Ryan's comment here
 

snip....There is far less overhead in having a custom Fieldtype that represents a table with 100 columns, than there is in having 100 separate fields. Have a look at Adrian's new FieldtypePhone/InputfieldPhone module for a good example of how to represent a DB table with a Fieldtype....


More stuff about Fieldtypes here (see the links I posted there...am too lazy to copy them here all over again): 

Let us know how you get on. If this will be a full fledged forum, then be prepared for a whole lot of work. If it is a simpler forum, I can try to commit some very limited time (away from client work) to help you with the Fieldtypes but can't promise how much time, unfortunately.... 

  • Like 3
Link to comment
Share on other sites

Thanks for the info. Reading through that seriously melted my brain :D I must say I am kind of bewildered by most of it. So I'm not sure what I'm going to do at the moment. On another note, I'm assuming something like ProFields : Table would make this an easy task to achieve?

Thanks again.

Link to comment
Share on other sites

I know the feeling :-). ...If you haven't worked with Fieldtypes before, there is some learning curve..Onto the main question, given the task involved in developing a forum (depending on whether it is basic or has advanced features, is modular, etc.. [have a read here btw]), I think we have about 3 options:

  1. Given the time constraints we (most of us) face, proceed as you originally intended. A basic forum is better than none :-)
  2. Ask guys who has some time to spare if we shared the work, e.g. somebody to deal with the model (data), another to deal with permissions and security, another with membership + login, another with...etc...
  3. If there is enough demand for a more than basic, scalable  modular forum, and the community is willing to raise some funds to support its development, get a couple of heads (and hands!) together to work on this thing. The sponsorship really would be about compensation for time taken away from client work.

#3 is probably the most difficult to organise but if it works, would probably bear most fruit.

These are just my thoughts. Don't feel pressured by any of them :-). Even if we ended up taking option  #1, I'd welcome it. You've made a good start and yours is probably the attempt that has come farthest to date (IIRC). So unless something shifts soon, I'd go ahead and release your module as is. It's not the end of the world if it doesn't have native Fieldtypes  :P  :lol:. It is a working solution. We appreciate your efforts and thank you for giving it to us gratis  ^-^  :)

Edited by kongondo
  • Like 4
Link to comment
Share on other sites

I know the feeling :-). ...If you haven't worked with Fieldtypes before, there is some learning curve..Onto the main question, given the task involved in developing a forum (depending on whether it is basic or has advanced features, is modular, etc.. [have a read here btw]), I think we have about 3 options:

  1. Given the time constraints we (most of us) face, proceed as you originally intended. A basic forum is better than none :-)
  2. Ask guys who has some time to spare if we shared the work, e.g. somebody to deal with the model (data), another to deal with permissions and security, another with membership + login, another with...etc...
  3. If there is enough demand for a more than basic, scalable  modular forum, and the community is willing to raise some funds to support its development, get a couple of heads (and hands!) together to work on this thing. The sponsorship really would be about compensation for time taken away from client work.

#3 is probably the most difficult to organise but if it works, would probably bear most fruit.

These are just my thoughts. Don't feel pressured by any of them :-). Even if we ended up taking option  #1, I'd welcome it. You've made a good start and yours is probably the attempt that has come farthest to date (IIRC). So unless something shifts soon, I'd go ahead and release your module as is. It's not the end of the world if it doesn't have native Fieldtypes  :P  :lol:. It is a working solution. We appreciate your efforts and thank you for giving it to us gratis  ^-^  :)

I know the topic regarding a forum solution has popped up a few times, and I understand that existing solutions are often better suited. However, I just love PW and wanted to have a go at creating a forum module, as I'm becoming more familiar with how PW works. My plan was never to create a forum like this one, but rather a forum that could utilise the power of PW to handle membership, permissions, which in turn would save a lot of time. Basically a functional forum that isn't bloated and doesn't get in the way of the front-end design. Nothing too fancy, but something that has the expected features. I also wanted it to use the same principle so that it can be used to add comments to other pages etc.

At present, the forum has potential, but obviously one of the main issues is the amount of installed fields, but custom Fieldtypes are beyond me at the moment. I like the idea that everything is a page as it makes it easy to deal with, but I'm always open to criticism and suggestions.

I'd love others to get involved with this as I can see it as a useful addition, but I understand that people don't always have the time. So maybe I will keep tinkering with it and keep the updates coming here, but if others are interested in joining in, we can take it from there.

Again thanks for your comments and encouragement as it means a lot.

I also started with "discuss" a simple, extendable forum module based on PW pages few month ago, but stopped work in favor of Flarum (Demo). I like the EsoTalk successor and maybe start an integration for my small forum site instead of a native PW forum...

Yeah, I've been watching Flarum since it was announced and it's looking great. I'd just prefer a PW alternative though, just to keep everything feeling the same.

  • Like 4
Link to comment
Share on other sites

Yeah, I've been watching Flarum since it was announced and it's looking great. I'd just prefer a PW alternative though, just to keep everything feeling the same.

I would like to see a native forum. So I'll take a look at your module :)

  • Like 2
Link to comment
Share on other sites

I'd love a native solution too!

At present, the forum has potential, but obviously one of the main issues is the amount of installed fields, but custom Fieldtypes are beyond me at the moment. I like the idea that everything is a page as it makes it easy to deal with, but I'm always open to criticism and suggestions.

Let me clarify: To me, the main issue is not the amount of installed fields :-). Like I said, we shouldn't let then number of fields be the overriding factor to guide our data storage needs. Rather, it is the questions I raised earlier. Fields are actually just Fieldtypes themselves :-). The idea behind using custom Fieldtypes was not necessarily about avoiding using pages. Fieldtypes are (usually [always?]) attached to pages :-). One of the ideas with custom Fieldtypes is to help better organise data, avoid duplication and redundancies. There are other advantages as well. Custom Fieldtypes can also be used in conjunction with core Fieldtypes, e.g. we could reuse the title Field, if you are using pages, say, for threads. Another example, consider the FieldtypeEvent that was linked to above. It stores three pieces of custom information on each row - notes; location and date all in one table. If we were to duplicate that using 'normal' fields, we would need at least three fields for each piece of information, a date field, and maybe two text fields. Those are three tables. Yes, that will also work, but at some scale, it is more efficient to query only one table than query several tables. Maybe even some custom Fieldtype could act as an 'external db table', but I don't know how feasible it is to have a Fieldtype that doesn't interact with a page. Anyway, I've gone overboard :-)....

Looking forward to see the forum! Maybe then we'll have a clearer picture of what could be tweaked RE data storage, presentation, etc.

Edited by kongondo
  • Like 3
Link to comment
Share on other sites

Kongondo, I've just read through your posts again, and it all makes sense to me. I'm sorry if my response made it sound like I hadn't taken in what you said, it's just all new to me at the moment :lol:

I was wondering if I could send you a PM regarding a very simple and minimalist Fieldtype example I have in mind. I am keen to get my head around them, and if you can spare some free time I would really appreciate it. If not, I understand and you've been more than helpful. But I would really prefer to use Fieldtypes to store some of the data.

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...