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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Similar Content

    • By MarkE
      This fieldtype and inputfield bundle was built for storing measurement values within a field, rendering them in a variety of formats and converting them to other units or otherwise modifying them via the API.
      The API consists of a number of predefined functions, some of which include...
      render() for rendering the measurement object, valueAs() for converting the value to another unit value, convertTo() for converting the whole measurement object to different units, and add() and subtract() for creating a new measurement object from the sum or difference between two other objects. In the admin the inputfield includes a checkbox (which can be optionally disabled) for converting values on page save. For an example if a value was typed in as centimeters, the unit was changed to metres, and the page saved with this checkbox selected, said value would be automatically converted so that e.g. 170 cm becomes 1.7 m.
      A simple length field using Fieldtype Measurement and Inputfield Measurement.
      Combination units (e.g. feet and inches) are also supported.
      Please note that this module is 'proof of concept' at the moment - there are limited units available and quite a lot of code tidying to do. More units will be added shortly.
      See the GitHub at https://github.com/MetaTunes/FieldtypeMeasurement for full details and updates.
    • By tcnet
      File Manager for ProcessWire is a module to manager files and folders from the CMS backend. It supports creating, deleting, renaming, packing, unpacking, uploading, downloading and editing of files and folders. The integrated code editor ACE supports highlighting of all common programming languages.
      https://github.com/techcnet/ProcessFileManager

      Warning
      This module is probably the most powerful module. You might destroy your processwire installation if you don't exactly know what you doing. Be careful and use it at your own risk!
      ACE code editor
      This module uses ACE code editor available from: https://github.com/ajaxorg/ace

      Dragscroll
      This module uses the JavaScript dragscroll available from: http://github.com/asvd/dragscroll. Dragscroll adds the ability to drag the table horizontally with the mouse pointer.
      PHP File Manager
      This module uses a modified version of PHP File Manager available from: https://github.com/alexantr/filemanager
       
    • By tcnet
      This module implements the website live chat service from tawk.to. Actually the module doesn't have to do much. It just need to inserted a few lines of JavaScript just before the closing body tag </body> on each side. However, the module offers additional options to display the widget only on certain pages.
      Create an account
      Visit https://www.tawk.to and create an account. It's free! At some point you will reach a page where you can copy the required JavaScript-code.

      Open the module settings and paste the JavaScript-code into the field as shown below. Click "Submit" and that's all.

      Open the module settings
      The settings for this module are located int the menu Modules=>Configure=>LiveChatTawkTo.

       
    • By tcnet
      Session Viewer is a module for ProcessWire to list session files and display session data. This module is helpful to display the session data of a specific session or to kick out a logged in user by simply delete his session file. After installation the module is available in the Setup menu.

      The following conditions must be met for the module to work properly:
      Session files
      Session data must be stored in session files, which is the default way in ProcessWire. Sessions stored in the database are not supported by this module. The path to the directory where the session files are stored must be declared in the ProcessWire configuration which is by default: site/assets/sessions.
      Serialize handler
      In order to transform session data easier back to a PHP array, the session data is stored serialized. PHP offers a way to declare a custom serialize handler. This module supports only the default serialize handlers: php, php_binary and php_serialize. WDDX was dropped in PHP 7.4.0 and is therefore not supported by this module as well as any other custom serialize handler. Which serialize handler is actually used you can find out in the module configuration which is available under Modules=>Configure=>SessionViewer.

      Session data
      The session data can be displayed in two different ways. PHP's default output for arrays print_r() or by default for this module nice_r() offered on github: https://github.com/uuf6429/nice_r. There is a setting in the module configuration if someone prefers print_r(). Apart from the better handling and overview of the folded session data the output of nice_r() looks indeed nicer.

      Links
      ProcessWire module directory
      github.com
    • By Robin S
      Repeater Easy Sort
      Adds a compact "easy-sort" mode to Repeater and Repeater Matrix, making those fields easier to sort when there are a large number of items.
      The module also enhances Repeater Matrix by allowing a colour to be set for each matrix type. This colour is used in the item headers and in the "add new" links, to help visually distinguish different matrix types in the inputfield.
      Screencasts
      A Repeater field

      A Repeater Matrix field with custom header colours

      Easy-sort mode
      Each Repeater/Matrix item gets an double-arrow icon in the item header. Click this icon to enter easy-sort mode.
      While in easy-sort mode:
      The items will reduce in width so that more items can be shown on the screen at once. The minimum width is configurable in the field settings. Any items that were in an open state are collapsed, but when you exit easy-sort mode the previously open items will be reopened. You can drag an item left/right/up/down to sort it within the items. The item that you clicked the icon for is shown with a black background. This makes it easier to find the item you want to move in easy-sort mode. You can click an item header to open the item. An "Exit easy-sort mode" button appears at the bottom of the inputfield. Configuration
      In the field settings for Repeater and Repeater Matrix fields you can define a minimum width in pixels for items in easy-sort mode. While in easy-sort mode the items will be sized to neatly fill the available width on any screen size but will never be narrower than the width you set here.
      In the field settings for Repeater Matrix you can define a custom header colour for each matrix type using an HTML "color" type input. The default colour for this type of input is black, so when black is selected in the input it means that no custom colour will be applied to the header.
      Exclusions
      The easy-sort mode is only possible on Repeater/Matrix fields that do not use the "item depth" option.
       
      https://github.com/Toutouwai/RepeaterEasySort
      https://processwire.com/modules/repeater-easy-sort/
×
×
  • Create New...