⬆️ ⬇️

Create a forum on drupal

Recently, I wanted to make a forum on drupal. No, not so easy, you need a couple of clarifications.

1) The project already existed on the drupal engine, was something like a question-answer service, although I was the only one who answered.

2) When I got 50, I wanted to redo it all in the style of the forum, saving questions and answers

3) And, of course, I wanted it all to be beautiful, and the forum was comfortable.



Drupal has a built-in forum module, however it is not convenient enough. Installing the advanced_forum module didn’t solve everything either - I still have a big problem: I wanted the “new posts” button, which is standard for phpbb forums. By default, drupal did not present this feature.



To solve these problems, I had to tinker with the code. In the process, I found a bug in the current release of the drupal advanced_forum module. It, as it turned out, was fixed in the alpha version, but I didn’t go to it - there were some other conflicts.

')

Anyway, this post is dedicated to setting up a convenient forum on drupal. A solution to the problem described above will be offered.







So let's start (I remember this post habrahabr.ru/blogs/drupal/19005 , which encouraged me to study drupal, and I hope that I will not get much worse). Let's start with a simple, shamanism leave for later.



1) Enable the forum module, download and enable the drupal.org/project/advanced_forum module. A type material forum should appear. At the address admin / content / forum (I’m going to omit the site’s url hereinafter) we start forums and their descriptions. At admin / user / permissions, we give everyone the right to use the forum.



2) Select the style for advanced_forum at admin / settings / advanced-forum. I used blue_lagoon_stacked. The color scheme is corrected by editing the modules / advanced_forum / styles / blue_lagoon_stacked / advanced_forum.css file, everything is rather trivial.



3) Download and enable the drupal.org/project/forum_access module, it will allow you to create forum moderators. Do not forget to give rights to all forums for all users in



4) Smilies, download and install drupal.org/project/smileys



5) Quoting. A drupal.org/project/quote module is required.



6) To tightly ban comments from comments and get the classic linear forum logic of answers, we take drupal.org/project/flatcomments This module, by the way, will allow existing comments to be flattened.



7) To subscribe to the themes, take drupal.org/project/subscriptions. By the way, by default, you can configure the user to subscribe by default to daily notifications about new themes.








8) Go to the promised shamanism. We start with fixing the bug in the advanced_forum 6.x-1.1 version. When all messages are marked as read, it rules the date a user visits to those nodes that have either the last comment date or date created. But the fact is that this is not the right approach - the node could be changed, the creation date may be less, and the change date - more. Therefore, we take the modules / advanced_forum / advanced_forum.module file and rule in two WHERE locations (n.created>% d on WHERE (n.changed>% d



9) Next, create a view showing unread messages. To do this, download and enable drupal.org/project/views (if you haven’t already done this), a new view of the material / node type, a filter for the material type = forum and has new content. Fields: material - title, material - the last commentator, material - the date of the last comment. The first two fields to make links. In the title we make a link to / forum / markasread - mark everything as read.



10) The continuation of shamanism - we embed a link to unread messages (for example, we placed this view at new_posts) in the forum links. To do this, in modules / advanced_forum / styles / naked / advf-forums.tpl at the very end, before the div class = "forum-top-links", we write

<? php $ links ["new_posts"] = array ("title" => "List of updated topics", "href" => "address of the site / new_posts");?>



We are happy with the result. Questions? Write!

Source: https://habr.com/ru/post/100720/



All Articles