HelpHub
HelpHub copied to clipboard
Article voting functionality
In the single article wireframes (https://wp-commhub.mybalsamiq.com/projects/helphub/Single%20article) we included a thumbs up/down function. We need to spec that out and decide just how it will work before building it.
I've implemented this on a few different sites. The most straightforward way I know of doing this is to simply use a "votes" meta field, and add a AJAX handler to manage the functionality. There are a coupel of hangups though
- One question I would have is to we really want up and down voting functionality? Presumably the content making it to Helphub would be vetted already, so I don't see how down votes would be useful (unless things really are all user-submitted). Would it be useful to just allow for upvoting instead of both?
- The other tricky part is authentication + voting. Ideally we want to limit users to only vote once per article. If that's the case, are we going to require users to be logged in to vote? If not, then some sort of cookie authentication can work here, but it's not as effective. There are two ways I know of to store who has voted on what post. The first is to store an array of post ID's or individual post ID's in author meta. The other is to create a join table of some sort, a la Posts to Posts to associate users with votes.
- The WP Post Ratings plugin takes the latter approach (https://github.com/lesterchan/wp-postratings) and I think is pretty effective, but I'm sure there are other plugins out there. Would we want to use an existing solution or implement something more bespoke?
Just trying to think through it. Don't want to over-complicate things too much.
Down voting is helpful even is the information is vetted. It will help editors know what is working and what needs to be more clear. Sometime editors get too close to the fire.
IMO, I see something like "Was this article helpful?" a better approach than just up/down. If the user clicks "no" then we always have the option of capturing user feedback at a later time. The voting idea is more for editors and admins in the long run.
If we do Was this Article Helpful, then we don't have to worry about users being logged in to ensure valid data and or abuse of the system.
Just my thoughts
The w.org "devhub" project includes up/down voting:
• Example: https://developer.wordpress.org/reference/functions/register_post_type/#comments • Source Code: https://meta.trac.wordpress.org/browser/sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content-voting.php
That's great, no need to re-invent the wheel right?
In the case of DevHub, the voting is on the user contributed notes and not on the article itself, but the general functionality can easily be pulled across.
That being said, maybe down voting isn't such a great idea. We could instead have a 'was this article useful?' type field (like many other platforms have) and then people can optionally submit a more detailed explanation of their answer.
It's worth discussing this further.
Ok, I managed to get a working prototype of something basic up on the feature-voting branch. It can be invoked within a post using the function show_voting();
. Though, I haven't styled it or added it to the theme. Waiting for things to get a bit farther along.
I took the really simple approach, modeled a bit after what I've seen on the Media Temple knowledge base. A simple thumbs up button if you found an article useful, like so:

But I know there were talks of allowing up and down votes / expanding a box for feedback. Is that something we wanted to implement, or do we want the basic version for now?
Feedback welcome!
I'd +1 the "found this useful" with a feedback box if they didn't. That way any negative reactions request feedback and don't downplay an article based on people randomly/incorrectly downvoting something (so only positives are shown but negatives are captured)
Forgot to reply here, but I agree - a thumbs up ("found this useful" is a good phrase, but happy for that to be anything that works well) and then a text box for feedback (either positive or negative). Keeps all publicly visible feedback positive and allows us to gather all the feedback, no matter what it is.
By the way, I looked at WooThemes' doc Article Feedback mechanism, I actually quite like it. eg when it's in the listed format, https://docs.woothemes.com/documentation/plugins/woocommerce/getting-started/installation-and-updating/ and https://docs.woothemes.com/document/installing-uninstalling-woocommerce/ when it's in the article single page, with a form to send feedback
@Kenshino @hlashbrooke I have pushed the latest to the feature-voting branch. Here's what it does:
- Filters the comment template and adds a custom template from the plugin
- Adds the voting module to the top of this form. Thumbs up or thumbs down.
- If a user votes, it attaches to the comment as a piece of comment_meta
- If a user submits feedbacks, it sends the comment through via AJAX, with the associated vote and shows a thank you message
I haven't added anything to the back-end yet (for instance, that shows what vote is associated with each comment), but I think this is a good first step. I also haven't added any styles, as I'm holding off for the theme to become a bit more complete.
Would love some feedback or direction. This may be good to merge in, and keep improving upon but let me know if there's anything else you would want added before we do that.
@JasonHoffmann Hey Jason, awesome! Sorry it took me days to respond.
I'm gonna take a quick look before our meeting tomorrow and post here!
@JasonHoffmann This is really great. My local dev environment has been on the blink for the last few days, but I did manage to check this out before then. I like that the yes/no vote is stored as comment meta and that the comment submission is via AJAX - that seems like the best way forward.
I think it would be great if the comment box only appeared after the user selected yes or no - that way it will be less clutter in the UI and make things a bit cleaner. It might, however, be best to wait for the single page template to be properly built before doing that though.
Other than that it all seems pretty solid to me. We can chat about it in today's meeting.
After doing some poking around a bit I think @JasonHoffmann did a pretty good job on this. The branch needs a bit of love still but that was expected. Here is a list of things that I am wanting to go through.
- Hide the comment box and only show it if the user votes.
- @JasonHoffmann mentioned about having a back-end to see what vote belongs to which comment. For version 1 of the feature, I am not sure we really need any admin feature like this just yet. We can still see the feedback for each article as of now.
- It looks like there is some funckyness if the UX of the voting. I am going to see about making this more solid.
This branch is really solid from just glancing at it as of now. Once @NicoleA has a look, she may be bale to provide some more feedback well.
What's the status on this? Are either @JasonHoffmann or @justingreerbbi around to continue pushing this functionality forward? I can review the feature-voting
branch and bring it up to parity with the current master and see where we go from there.
Hello. I thought about the voting function. Samsup may be difficult to understand depending on the region of the world. I made a design to choose with Yes or No.
I think it would be great if the comment box only appeared after the user selected yes or no. Do you want the comment to be visible to the public?
We really only need feedback if the article wasn't helpful, so no, keep it hidden.
Thanks for the feedback. @Clorith I will design a screen to send comments. It will also upload.
@nukaga The button should follow a color pattern as a current design. 👍
@khoipro Thanks for the feedback😊 From to issue #142 , "a color pattern" will be followed " https://wordpress.org/support/ "? If so, I will make it.
@nukaga Just try to make like that. I think it should be ok!
Thanks for feedbacks!
I tried to match a color pattern as a current design.
Blue button
Gray button
There are two action buttons with a current design. Blue is more critical than gray. Which is the button for this vote? I thought that it might be gray.
I designed the comment box.
That is very simple.
I think the comment box only appeared after the user selected yes or no.
Can we offer more guidelines for this feedback?
I think we would have more people willing to leave feedback if we saved them from typing as much as possible.
Example
They clicked "no" and new set of questions show up (these could be just checkboxes):
- Following steps in tutorial doesn't give promised result
- Tutorial is not for claimed knowledge level (it is more difficult)
- Tutorial is not for claimed knowledge level (it is too simple)
- Wording and language are not clear
- Screenshots are strange, I don't have that in my installation ...
And after all that show textarea for "Anything else?" option.
Any thoughts?
Pinging some people to include them in discussion: @atachibana @Clorith @mapk @ntwb @Kenshino @joyously