Jump to content
GuruMeditation

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

Share this post


Link to post
Share on other sites

Also, there are some basic module settings that can also easily be used if required.

post-2170-0-36219500-1444940844_thumb.jp

The image only shows a few options. There are also options to easily set how many topics / comments to display per page for pagination etc.

  • Like 6

Share this post


Link to post
Share on other sites

Any questions etc, please feel free to ask.

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)

  • Like 7

Share this post


Link to post
Share on other sites

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. 

  • Like 1

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Looks really great :)

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

  • Like 4

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

That's a lot of fields. How about an option to bundle groups of them into Textareas fields, or maybe put some in an external table. Just thinking out loud here, haven't thought any of this through.

  • Like 1

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
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?

I believe this thread is the documentation :)

  • Like 1

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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...

  • Like 2

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

@GuruMeditation, Sure thing. At least I can listen to what you have in mind...:-)

  • Like 3

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By David Karich
      ProcessWire InputfieldRepeaterMatrixDuplicate
      Thanks to the great ProModule "RepeaterMatrix" I have the possibility to create complex repeater items. With it I have created a quite powerful page builder. Many different content modules, with many more possible design options. The RepeaterMatrix module supports the cloning of items, but only within the same page. Now I often have the case that very design-intensive pages and items are created. If you want to use a content module on a different page (e.g. in the same design), you have to rebuild each item manually every time.
      This module extends the commercial ProModule "RepeaterMatrix" by the function to duplicate repeater items from one page to another page. The condition is that the target field is the same matrix field from which the item is duplicated. This module is currently understood as proof of concept. There are a few limitations that need to be considered. The intention of the module is that this functionality is integrated into the core of RepeaterMatrix and does not require an extra module.
      Check out the screencast
      What the module can do
      Duplicate multible repeater items from one page to another No matter how complex the item is Full support for file and image fields Multilingual support Support of Min and Max settings Live synchronization of clipboard between multiple browser tabs. Copy an item and simply switch the browser tab to the target page and you will immediately see the past button Support of multiple RepeaterMatrix fields on one page Configurable which roles and fields are excluded Configurable dialogs for copy and paste Duplicated items are automatically pasted to the end of the target field and set to hidden status so that changes are not directly published Automatic clipboard update when other items are picked Automatically removes old clipboard data if it is not pasted within 6 hours Delete clipboard itself by clicking the selected item again Benefit: unbelievably fast workflow and content replication What the module can't do
      Before an item can be duplicated in its current version, the source page must be saved. This means that if you make changes to an item and copy this, the old saved state will be duplicated Dynamic loading is currently not possible. Means no AJAX. When pasting, the target page is saved completely No support for nested repeater items. Currently only first level items can be duplicated. Means a repeater field in a repeater field cannot be duplicated. Workaround: simply duplicate the parent item Dynamic reloading and adding of repeater items cannot be registered. Several interfaces and events from the core are missing. The initialization occurs only once after the page load event Changelog
      2.0.0
      Feature: Copy multiple items at once! The fundament for copying multiple items was created by @Autofahrn - THX! Feature: Optionally you can disable the copy and/or paste dialog Bug fix: A fix suggestion when additional and normal repeater fields are present was contributed by @joshua - THX! 1.0.4
      Bug fix: Various bug fixes and improvements in live synchronization Bug fix: Items are no longer inserted when the normal save button is clicked. Only when the past button is explicitly clicked Feature: Support of multiple repeater fields in one page Feature: Support of repeater Min/Max settings Feature: Configurable roles and fields Enhancement: Improved clipboard management Enhancement: Documentation improvement Enhancement: Corrected few typos #1 1.0.3
      Feature: Live synchronization Enhancement: Load the module only in the backend Enhancement: Documentation improvement 1.0.2
      Bug fix: Various bug fixes and improvements in JS functions Enhancement: Documentation improvement Enhancement: Corrected few typos 1.0.1
      Bug fix: Various bug fixes and improvements in the duplication process 1.0.0
      Initial release Support this module
      If this module is useful for you, I am very thankful for your small donation: Donate 5,- Euro (via PayPal – or an amount of your choice. Thank you!)
      Download this module (Version 2.0.0)
      > Github: https://github.com/FlipZoomMedia/InputfieldRepeaterMatrixDuplicate
      > PW module directory: https://modules.processwire.com/modules/inputfield-repeater-matrix-duplicate/
      > Old stable version (1.0.4): https://github.com/FlipZoomMedia/InputfieldRepeaterMatrixDuplicate/releases/tag/1.0.4
    • By Robin S
      A new module that hasn't had a lot of testing yet. Please do your own testing before deploying on any production website.
      Custom Paths
      Allows any page to have a custom path/URL.
      Note: Custom Paths is incompatible with the core LanguageSupportPageNames module. I have no experience working with LanguageSupportPageNames or multi-language sites in general so I'm not in a position to work out if a fix is possible. If anyone with multi-language experience can contribute a fix it would be much appreciated!
      Screenshot

      Usage
      The module creates a field named custom_path on install. Add the custom_path field to the template of any page you want to set a custom path for. Whatever path is entered into this field determines the path and URL of the page ($page->path and $page->url). Page numbers and URL segments are supported if these are enabled for the template, and previous custom paths are managed by PagePathHistory if that module is installed.
      The custom_path field appears on the Settings tab in Page Edit by default but there is an option in the module configuration to disable this if you want to position the field among the other template fields.
      If the custom_path field is populated for a page it should be a path that is relative to the site root and that starts with a forward slash. The module prevents the same custom path being set for more than one page.
      The custom_path value takes precedence over any ProcessWire path. You can even override the Home page by setting a custom path of "/" for a page.
      It is highly recommended to set access controls on the custom_path field so that only privileged roles can edit it: superuser-only is recommended.
      It is up to the user to set and maintain suitable custom paths for any pages where the module is in use. Make sure your custom paths are compatible with ProcessWire's $config and .htaccess settings, and if you are basing the custom path on the names of parent pages you will probably want to have a strategy for updating custom paths if parent pages are renamed or moved.
      Example hooks to Pages::saveReady
      You might want to use a Pages::saveReady hook to automatically set the custom path for some pages. Below are a couple of examples.
      1. In this example the start of the custom path is fixed but the end of the path will update dynamically according to the name of the page:
      $pages->addHookAfter('saveReady', function(HookEvent $event) { $page = $event->arguments(0); if($page->template == 'my_template') { $page->custom_path = "/some-custom/path-segments/$page->name/"; } }); 2. The Custom Paths module adds a new Page::realPath method/property that can be used to get the "real" ProcessWire path to a page that might have a custom path set. In this example the custom path for news items is derived from the real ProcessWire path but a parent named "news-items" is removed:
      $pages->addHookAfter('saveReady', function(HookEvent $event) { $page = $event->arguments(0); if($page->template == 'news_item') { $page->custom_path = str_replace('/news-items/', '/', $page->realPath); } }); Caveats
      The custom paths will be used automatically for links created in CKEditor fields, but if you have the "link abstraction" option enabled for CKEditor fields (Details > Markup/HTML (Content Type) > HTML Options) then you will see notices from MarkupQA warning you that it is unable to resolve the links.
      Installation
      Install the Custom Paths module.
      Uninstallation
      The custom_path field is not automatically deleted when the module is uninstalled. You can delete it manually if the field is no longer needed.
       
      https://github.com/Toutouwai/CustomPaths
      https://modules.processwire.com/modules/custom-paths/
    • By teppo
      Hey folks!
      I'm happy to finally introduce a project I've been working on for quite a while now: it's called Wireframe, and it is an output framework for ProcessWire.
      Note that I'm posting this in the module development area, maily because this project is still in rather early stage. I've built a couple of sites with it myself, and parts of the codebase have been powering some pretty big and complex sites for many years now, but this should still be considered a soft launch 🙂
      --
      Long story short, Wireframe is a module that provides the "backbone" for building sites (and apps) with ProcessWire using an MVC (or perhaps MVVM... one of those three or four letter acronyms anyway) inspired methodology. You could say that it's an output strategy, but I prefer the term "output framework", since in my mind the word "strategy" means something less tangible. A way of doing things, rather than a tool that actually does things.
      Wireframe (the module) provides a basic implementation for some familiar MVC concepts, such as Controllers and a View layer – the latter of which consists of layouts, partials, and template-specific views. There's no "model" layer, since in this context ProcessWire is the model. As a module Wireframe is actually quite simple – not even nearly the biggest one I've built – but there's still quite a bit of stuff to "get", so I've put together a demo & documentation site for it at https://wireframe-framework.com/.
      In addition to the core module, I'm also working on a couple of site profiles based on it. My current idea is actually to keep the module very light-weight, and implement most of the "opinionated" stuff in site profiles and/or companion modules. For an example MarkupMenu (which I released a while ago) was developed as one of those "companion modules" when I needed a menu module to use on the site profiles.
      Currently there are two public site profiles based on Wireframe:
      site-wireframe-docs is the demo&docs site mentioned above, just with placeholder content replaced with placeholder content. It's not a particularly complex site, but I believe it's still a pretty nice way to dig into the Wireframe module. site-wireframe-boilerplate is a boilerplate (or starter) site profile based on the docs site. This is still very much a work in progress, but essentially I'm trying to build a flexible yet full-featured starter profile you can just grab and start building upon. There will be a proper build process for resources, it will include most of the basic features one tends to need from site to site, etc. --
      Requirements and getting started:
      Wireframe can be installed just like any ProcessWire module. Just clone or download it to your site/modules/ directory and install. It doesn't, though, do a whole lot of stuff on itself – please check out the documentation site for a step-by-step guide on setting up the directory structure, adding the "bootstrap file", etc. You may find it easier to install one of the site profiles mentioned above, but note that this process involves the use of Composer. In the case of the site profiles you can install ProcessWire as usual and download or clone the site profile directory into your setup, but after that you should run "composer install" to get all the dependencies – including the Wireframe module – in place. Hard requirements for Wireframe are ProcessWire 3.0.112 and PHP 7.1+. The codebase is authored with current PHP versions in mind, and while running it on 7.0 may be possible, anything below that definitely won't work. A feature I added just today to the Wireframe module is that in case ProcessWire has write access to your site/templates/ directory, you can use the module settings screen to create the expected directories automatically. Currently that's all, and the module won't – for an example – create Controllers or layouts for you, so you should check out the site profiles for examples on these. (I'm probably going to include some additional helper features in the near future.)
      --
      This project is loosely based on an earlier project called pw-mvc, i.e. the main concepts (such as Controllers and the View layer) are very similar. That being said, Wireframe is a major upgrade in terms of both functionality and architecture: namespaces and autoloader support are now baked in, the codebase requires PHP 7, Controllers are classes extending \Wireframe\Controller (instead of regular "flat" PHP files), implementation based on a module instead of a collection of drop-in files, etc.
      While Wireframe is indeed still in a relatively early stage (0.3.0 was launched today, in case version numbers matter) for the most part I'm happy with the way it works, and likely won't change it too drastically anytime soon – so feel free to give it a try, and if you do, please let me know how it went. I will continue building upon this project, and I am also constantly working on various side projects, such as the site profiles and a few unannounced helper modules.
      I should probably add that while Wireframe is not hard to use, it is more geared towards those interested in "software development" type methodology. With future updates to the module, the site profiles, and the docs I hope to lower the learning curve, but certain level of "developer focus" will remain. Although of course the optimal outcome would be if I could use this project to lure more folks towards that end of the spectrum... 🙂
      --
      Please let me know what you think – and thanks in advance!
    • By tcnet
      PageViewStatistic for ProcessWire is a module to log page visits of the CMS. The records including some basic information like IP-address, browser, operating system, requested page and originate page. Please note that this module doesn't claim to be the best or most accurate.
      Advantages
      One of the biggest advantage is that this module doesn't require any external service like Google Analytics or similar. You don't have to modify your templates either. There is also no JavaScript or image required.
      Disadvantages
      There is only one disadvantage. This module doesn't record visits if the browser loads the page from its browser cache. To prevent the browser from loading the page from its cache, add the following meta tags to the header of your page:
      <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" /> <meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Expires" content="0" /> How to use
      The records can be accessed via the Setup-menu of the CMS backend. The first dropdown control changes the view mode. There are 4 different view modes.
      View mode "Day" shows all visits of the selected day individually with IP-address, browser, operating system, requested page and originate page. Click the update button to see new added records. View mode "Month" shows the total of all visitors per day from the first to the last day of the selected month. View mode "Year" shows the total of all visitors per month from the first to the last month of the selected year. View mode "Total" shows the total of all visitors per year for all recorded years. Please note that multiple visits from the same IP address within the selected period are counted as a single visitor.
      Settings
      You can access the module settings by clicking the Configuration button at the bottom of the records page. The settings page is also available in the menu: Modules->Configure->ProcessPageViewStat.
      IP2Location
      This module uses the IP2Location database from: http://www.ip2location.com. This database is required to obtain the country from the IP address. IP2Location updates this database at the begin of every month. The settings of ProcessPageViewStat offers the ability to automatically download the database monthly. Please note, that automatically download will not work if your webspace doesn't allow allow_url_fopen.
      Dragscroll
      This module uses DragScroll. A JavaScript available from: http://github.com/asvd/dragscroll. Dragscroll adds the ability in view mode "Day" to drag the records horizontally with the mouse pointer.
      parseUserAgentStringClass
      This module uses the PHP class parseUserAgentStringClass available from: http://www.toms-world.org/blog/parseuseragentstring/. This class is required to filter out the browser type and operating system from the server request.
      Special Feature
      PageViewStatistic for ProcessWire can record the time a visitor viewed the page. This feature is deactivated by default. To activate open the module configuration page and activate "Record view time". If activated you will find a new column "S." in the records which means the time of view in seconds. With every page request, a Javascript code is inserted directly after the <body> tag. Every time the visitor switches to another tab or closes the tab, this script reports the number of seconds the tab was visible. The initial page request is recorded only as a hyphen (-).
       
    • By MoritzLost
      This module allows you to integrate hCaptcha bot / spam protection into ProcessWire forms. hCaptcha is a great alternative to Google ReCaptcha, especially if you are in the EU and need to comply with privacy regulations.

      The development of this module is sponsored by schwarzdesign.
      The module is built as an Inputfield, allowing you to integrate it into any ProcessWire form you want. It's primarily intended for frontend forms and can be added to Form Builder forms for automatic spam protection. There's a step-by-step guide for adding the hCaptcha widget to Form Builder forms in the README, as well as instructions for API usage.
      Features
      Inputfield that displays an hCaptcha widget in ProcessWire forms. The inputfield verifies the hCaptcha response upon submission, and adds a field error if it is invalid. All hCaptcha configuration options for the widget (theme, display size etc) can be changed through the inputfield configuration, as well as programmatically. hCaptcha script options can be changed through a hook. Error messages can be translated through ProcessWire's site translations. hCaptcha secret keys and site-keys can be set for each individual inputfield or globally in your config.php. Error codes and failures are logged to help you find configuration errors. Please check the README for setup instructions.
      Links
      Github Repository and documentation InputfieldHCaptcha in the module directory Screenshots (configuration)

      Screenshots (hCaptcha widget)

       
       

       
×
×
  • Create New...