• Dev
  • Private discussions developer diary

As discussed previously here and here, I've decided to start work on a private messaging extension.

Although a few people voiced some interest in being tightly involved in such an endeavour, I firmly believe in an iterative process. The same has applied to the flagrow/upload, where features and feedback have moved gradually into the development processes.

To remain transparent on what decisions are made and what the current progress is, I decided to start this thread for you to remain informed and voice your opinions. According to the recent guidelines for extensions I am not allowed to post this under extensions in WIP state, so hence you'll find it under the dev tag.

Yesterday I once again picked up where I left off some time ago. I remember that I had caused an internal server error previously, caused by an api endpoint. Sadly this caused no errors in the flarum.log file or the valet Log directory. After a few hours of unforgiving detective work, revisiting all code, I was able to resolve the complication caused by faulty container bindings and class instantiation.

I could then inspect what I was planning to implement previously:

  • Create an icon next to the flags icon that indicates the number of open private messages.
  • On click show the last private discussions and whether they have unread messages.
  • On clicking any of these items move to a dedicated page, much like a discussion page that shows the private discussion.

Initially I was about to work only on 1 on 1 private discussions, but my database design seemed flawed anyway, so this morning I started refactoring the code and database mutations (called migrations) to facilitate private discussions between two or more users.

These are my plans for an initial version.


Feel free to provide an additional incentive. Please understand, although being a forum moderator, I am not a core developer (nor the owner) of Flarum and all Flagrow extensions I contribute to the community I do so in my free time next to a full time job and a family.


    So far I've been able to create a dropdown, create the database schema and api endpoints. Here is a small demo, where you can see how I'd like to be able to support multiple recipients using the existing autocomplete functionality:

    image pm-demo-1gif.gif

    I'm considering allow multiple recipients, and if that is the case allow naming the private discussion. One-on-one discussions will never have a name though.

    For future versions I plan on allowing members of a specific group to add their group, it will require a global permission though.

      luceos Nice. Love to see this coming along! Thanks for taking it up again. One other thought for creating new discussions could be to hook into the native Start a Discussion box. Maybe something like…

      Choose Recipients

      Just a thought. I've no idea the hurdles this might pose, but seems like it could make for a good user experience.

        UaMV that's a much easier implementation then the one I've undertaken. If this works it might be a lot faster to implement. The only worry I have is adding new features on top of this implementation.

        What would be the effect of tags on private discussion in your opinion?

          I could also use the same Composer component but replace tags with recipients and put that private messaging Composer under the "write pm" button under the dropdown..

          luceos That's a good question. It could be that private discussions allow tagging and are listed alongside other discussions in a tag's feed and marked with a private badge – although, I suppose you might then fall into permission issues where an individual included in the private discussion does not have permission to view a tag on the discussion.

          I am thinking, in the long-term, it might be nice to have a featured that would allow a private discussion to be published if all participants grant such approval – thus, it'd be nice to treat private discussion as near to standard discussions as possible. Seems like that would also allow for significant repurposing of features already present. But, I suppose, as you hinted at, it may limit the possibilities, as well.

            UaMV using private discussions as a pre-approval system is not something we should aim for with this extension in general. I'm trying to piece together the implementation you proposed and already ran into a few complications which luckily I have been able to circumvent.

            More soon.

              Tagging private discussions might be a little too complex. As UaMV mentioned, permissions start to get overly complex. Also, tagging discussions means that they start to get lost in the clutter of All Discussions more easily, especially if your private discussion takes place on a rather chatty Flarum install.

                A solution might be to remove the tag input field once recipients have been selected, making it painfully obvious tags on private discussions no longer have any effect.

                  luceos I like this implementation a lot. I think it's good for user experience and it would look nicer overall. Just one question, Is there planned Pusher support? I think it would make PM's way better in terms of speed and overall usability to a certain extent. Of course it would be an optional thing but still would be nice.

                  Would it be possible to have permission based ability to ask for read receipts as a notification?

                  luceos using private discussions as a pre-approval system is not something we should aim for with this extension in general.

                  I can totally see that and would agree know that I think about it more.

                  jordanjay29 True.

                  luceos I think this could be good. Also cross my mind, though I apparently didn't mention it. Along with this, it might also be beneficial to remove the recipient input field once tags have been selected.

                    UaMV it might also be beneficial to remove the recipient input field once tags have been selected

                    I was thinking that might complicate deciding to create a non-private discussion. I was considering allowing you to configure one tag that holds private discussions and forcing that tag while one or more recipients have been selected.

                    BlackSheep thanks, I hope I will be able to live up to your expecations.

                      Awaiting to release and installed on my forum ?

                      Is this really a Private Messaging feature or a Private Discussions one? I'm confused! They should be separate...IMO. We won't really need Private Discussions if we have Private Messages.
                      So which one is it?! Or both?

                        luceos I agree with this concept. At the end of the day on other forum engines private messages are just equal to any typical forum discussion, with the exception of being private.
                        A special tag which marks a conversation (thread) between two or more users as private is basically what a PM is.
                        We're ready to support you, also with incentives,as soon as a first version is out ?

                        staion Is this really a Private Messaging feature or a Private Discussions one?

                        BlackSheep The title of the discussion is "Private messaging".

                        Based on previous proposals I think this extension would more fulfil the role of private discussions. But private discussions between two recipients still is like private messaging.