Question Answer Plugin

Excellent info, thanks for writing up a detailed description @angus I feel much more comfortable utilizing the plugin after understanding sort_order.

Plugin-builder newbie question - is there a significant time implication to altering the UI for this plugin (moddifying core, etc.)? Happy to help contribute, I just wanted to understand the complexity in altering the UI to look something like this:

1 Like

I really need to let my users vote more than once per topic (e.g. for different responses).
Would it be possible to allow for this? e.g. with an opt-in setting like:

qa number of votes per user per topic e.g. ā€œ5ā€ - (default ā€œ1ā€, ā€œ0ā€- unlimited) - how many responses a user can vote for.

3 Likes

Itā€™s possible :slight_smile: I wonā€™t have the time to do this till next week though.

2 Likes

Angus McLeod
May I please have some few screenshots for the plugin
Does it support anonymous answer ? if not , can it be customisable ?
Thanks

Sorry, I missed a few questions here.

Overall, I have to give my apologies in terms of doing new work on this plugin. Iā€™m happy to fix bugs with the existing functionality (I just fixed an issue with time-gaps), but for new features this plugin is near the bottom of my priority list.

If you want to add more features / customisations here your best bet is to get someone with some standard frontend skills. If that someone gets stuck with the logic of the plugin itself Iā€™m happy to help them out understanding it.


@dalerka Those changes the voter list are possible, but are slightly harder than they may first seem as this plugin uses an existing structure in Discourse called ā€œPost Actionsā€ to display the voter list. So it would require some JS changes as well.

@supernaturally The UI part of the change to the vote buttons would not be that hard to do, but down-voting would be a new feature.

You can see it in action, and try it out, on my sandbox in the QA category, e.g.
https://discourse.angusmcleod.com.au/t/what-has-cities-but-no-houses-forests-but-no-trees-and-water-but-no-fish/55/4

It should support anonymous answers (I havenā€™t tested it with anonymous users extensively though), as it has all the features of a normal Discourse topic, which allows a user to post anonymously if the ā€œallow anonymous postingā€ site setting is turned on.

5 Likes

Does this pluginā€™s vote count carry over to comments embedded into a wordpress site via the WP Discourse plugin? Does the resorting of comments based on votes impact order of comments embedded in wordpress site? I am thinking not. I imagine once comments are resorted per votes in the forum, the comments could be manually reimported to wordpress.

Has anyone tried these two plugins together?

Thanks in advance.

Iā€™ve never used the WP plugin before, but in theory the only thing youā€™d need to do to get a ā€˜read onlyā€™ version within Wordpress (i.e. you canā€™t vote, or clicking a ā€˜vote buttonā€™ would send you to the discourse topic itself) would be to customise the WP comment template to support the QA styles.

The key bits would be:

1 - If a topic has qa enabled and the post is not the first post, itā€™s a ā€˜commentā€™ if itā€™s a reply to a post and itā€™s an ā€˜answerā€™ if its not. This is the version of this logic in the Discourse client customisations in this plugin:

api.addPostClassesCallback((attrs) => {
  if (attrs.topic.qa_enabled && !attrs.firstPost) {
    return attrs.reply_to_post_number ? ["comment"] : ["answer"];
  };
});

2 - Display the property topic.vote_count alongside answers.

The posts should already be in the right order as this plugin changes the sort_order of posts in a topic, which should be respected regardless of what client is consuming the server endpoints (i.e. the Discourse client, or the Wordpress plugin).

5 Likes

This is a great plugin, Angus. Thanks. :pray:

Sounds like you are onto other things now. Good for you. Have you ever considered programming the plugin so members can change their vote to another answer if a better answer comes along as the discussion on a topic grows over time? Kinda like how you can unlike content by clicking on the heart icon a second time?

Actually, this might work too:

P.S. I will be using wp discourse and the q/a plugin together and will report in here to let you know how it goes. I imagine the prioritization of order of content based on membership consensus would be a nice complement to the settings in the wp discourse plugin where you can set the criteria in a number of ways for what gets embedded from the topic into wordpress blogs.

1 Like

Um, could you please give screenshots of the plugin? I am thinking of suggesting it to a forum that I am on, but I want to know how it looks first.

Try this, @Yusamac205

2 Likes

Great! Let me know how it goes.

You can change your vote by clicking ā€˜Undo voteā€™ on a post youā€™ve voted for

Screenshot%20at%20Feb%2026%2021-58-28.

This behaviour is actually part of core Discourse itself, itā€™s just not currently used. This plugin uses the latent voting logic in core Discourse where it can, this being one instance.

As @McBlu noted, you can see this plugin in action on my sandbox, e.g

https://discourse.angusmcleod.com.au/t/can-you-solve-aldhelms-lorica/59

If youā€™re considering using this, please note that Iā€™m not currently devoting much time to this plugin, and:

3 Likes

Thanks, @angus. I see this line.

56%20AM

And when I click on it the line changes to this:

05%20AM

And there is no option to undo vote. ie. This doesnā€™t come up:

22%20AM

Here are what I have checked in settings:

I have verstion 0.2 installed by Communiteq (formerly DiscourseHosting).

1 Like

Ah yes, thereā€™s a time limit to undoing post actions (ā€˜votingā€™ is a type of ā€˜post actionā€™, like ā€˜likingā€™). I canā€™t check the code right now (it may be something like 5 minutes). Increasing this limit wonā€™t be too hard, so if it helps Iā€™ll add this in as a setting tomorrow.

1 Like

Thanks, Angus, Iā€™ll keep testing the undo function to see what happens.

Which setting are you adding tomorrow?

This plugin is awesome, btw.

Sorry, I mean Iā€™ll add a setting for increasing the time limit on changing your vote (including making it always possible).

2 Likes

Awesome, Angus. Thanks. That would be great. In my scenario, I accidentally deleted a post when I went to try and undo a vote so I can imagine people accidentally voting and just wanting to undo it in the moment for which, being able to immediately undo it would be great.

I saw in an earlier post that you were toying with having a setting that lets you set how many votes per topic a member can do (sorry if I misunderstood). Is that right?

I get the impression you are done working on this plugin and moving onto other things. Of all the plugins, this is the one Iā€™d fund changes to if I had the dinero. Itā€™s fantastic and a great complement to the WP Discourse plugin that embeds comments in blogs per the criteria you set. With your plugin, members get to weigh in on what gets to the top of the comments in an impactful way.

P.S. The undo function isnā€™t working for votes that happened yesterday. I have a message into Communiteq (formerly DiscourseHosting) to see what version of the q/a plugin is installed. It says 2.0 in my settings and was very recently installed so likely we are up to date.

Iā€™ve added a setting that allows you to set a seperate time limit for undoing votes: qa undo vote action window

  • If this setting is not set, the plugin will use the core undo time limit setting for all post actions as a fallback.

  • If it is set to 0, the user will always be able to change their vote.

This change is now live on my sandbox, where Iā€™ve set the vote undo setting to 0:

This is quite possible to do, but as Iā€™m trying to not do any new work on this plugin I have to draw the line somewhere Iā€™m afraid.

Iā€™m not done forever, but I wonā€™t be doing serious work on it for a while (i.e. months). I will fix existing functionality if it breaks however.

I donā€™t take paid gigs (at the moment), but if you do decide you want to fund further development of this plugin, there are some good plugin authors here on meta that could handle it. You could post it in the #marketplace.

5 Likes

Wow, thank you, Angus! I like how in a growing discussion people can change their vote for the best answer so the posts bumped to the top are an even better concensus of what people want. I am not sure why we were barred from changing our vote hours after voting, but Iā€™ll be sure to set the setting to zero.

Forgive me for my obtuseness, but do we download an update to get this setting?

P.S. I tried the sandbox. Canā€™t wait to try it in our forum. Thanks again.

2 Likes

No worries. To upgrade a plugin go to yoursite.com/admin/upgrade and click ā€œUpgrade To the Latest Versionā€ next to the plugin you want to upgrade (i.e. the Question Answer Plugin).

2 Likes

Thanks, Angus. Communiteq (formerly DiscourseHosting) implemented the upgrade. Works like a charm. So happy.

2 Likes