1

I have a forum using the Advanced Forum module in which users ask questions. I want to add a button next to responses, so that the poster of the question can accept one of the answers (in fact, just like this forum works). I then want that post to appear highlighted as being the correct answer.

I realise that Flag is the module to use for this functionality, but I'm not sure how to make the "Accepted answer" appear to all users when the node owner flags the comment, when they are not owners of the original comment. Any ideas about how I can implement this functionality?

  • 1
    Well, I thought I had made it clear by putting "Advanced forum" is the title! But I'll update the question. – James Nov 25 '16 at 16:22
1

Answers module as a possible alternative

To implement something like "the poster of the question can accept one of the answers" (as in your question), you'll need something to allow one or more answers to be posted, and also have a way to create a (visual) relationship between the answer(s) and the question.

To do so, you might want to have a look at the Answers module (disclosure: I'm a (co-)maintainer of it). Either to actually use this module, or to get inspiration from it to see some of its features at work.

Here are some details about it (from its project page):

Answers enables the implementation of a Question & Answer system in a Drupal site. Users can post questions and other users can answer them.

Since a picture is worth more then 1000 words, here is a sample screenprint of it (head over to its project page for more details):

enter image description here

About the Answers module

At its core, this module exists of 2 typical content types: Question and Answer (what other names would you expect ...).

The Answers module comes with integrations with other modules such as the Rules module and the Userpoints module (and supports voting, which in this use case may not be needed, unless you want users that evaluate offers to use it).

To be complete:

  • You can use the "Best Answer" submodule for implementing something like "Node author can accept". And you could make the Rules module trigger all sorts of subsequent things to happen "when an answer gets marked as best answer".
  • It also comes with a "subscribe" feature (based on the "Message stack", with the amazing the Message module at its core).
  • Since the module is using (2) standard content types, all sorts of the typical standard Drupal facilities are also available, or can be enabled. E.g. if you want, you can also use a text format like "Markdown text", provided you first enable/configure the Markdown filter module.
  • ... (there is really a lot, not just a bit, more).

Demo site

Have a look at the demo site of the Answers module. This link shows various menu options within the block with title Answers Menu, i.e.:

  • Questions (= a view):
    • All: of all existing questions (= default tab).
    • Answered: all questions which have a "best" (= accepted) answer (= sub-tab).
    • Unanswered: all questions which do not yet have a "best" (= accepted) answer (= sub-tab).
  • Answers (= a view): lists all existing answers for any of the existing questions and which does not (yet) have any submenu options (implemented as tabs).
  • Rankings (= a view): contains a list of users with their actual ranking (= reputation points implemented via user points), and with each user a link to either the questions or answers from that user.
  • Ask Question: to post a new question (the equivalent of node/add/question), which is only shown for authenticated users though.

These views also use the dataTables format, but you could easily replace that with any views display format you'd want. And because of the search box that comes with dataTables, there is no need for extra menu links to search within questions, answers or rankings.

These new/enhanced views were created starting from the 7.x-4.x-rc2 release of Answers, and will be included in the next release of it also (together with various other enhancements not yet visible in the demo site).

Try it out

To experience it yourself, try out a demo of it. Here are the steps to do so:

  • Head over to the demo site.
  • Just accept the defaults to create a sandbox demo site (make sure you're using the most recent 7.x-4.x version). Then hit the create sandbox button, and wait for the process to complete. Make sure you also enable the Answers Theme (sub-module of Answers, new as of 7.x-4.x).
  • Create at least 1 question using either the "Add content" menu link and then selecting "Question", or just enter relative path /node/add/question. And complete the title and body of the question.
  • After you save the question, you'll see the question that's created (in view mode). And below the question, you should see "No answers yet." (since you just completed posting the question). And then there is the "Your Answer" form right below that. That is the form you can use to post an answer to the question.
  • If you then use that (answer) form to post your answer, and also save that, the (first) answer is shown below the question, and below that answer there is now the "Your Answer" form again (to allow for posting an additional answer).
  • Use the Questions tab (or enter relative path /questions, to get a list (a tabular display) of all existing questions so far (there should be at least one if you completed the previous step).

Release recommendation

To decide between the 7.x-3.2 and the 7.x-4.0-rc2 release, I would recommend the 7.x-4.0-rc2 (which also has the shiny new theming stuff ...). Even though it is not yet an official release, it is fairly stable/functional, and only has a few more minor glitches to be resolved. Pretty soon an rc-3 (the last 'rc' release?) should become available also, which will include the newest features as you can see in the demo site already. More important: if you're just starting with the module, you won't have to "migrate" from 3.x in the future (some type of migration will be needed, which is still an open issue for now).

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.