Connect votes to user

Permalink Browser Info Environment
Hello,

This looks like an excellent add-on. I am trying to figure out how to allow a user to 'like' or 'save' pages and then be able to access those pages from their user profile. I know this is a voting add-on and not a favoriting add-on, but I'm wondering if you think it's possible for me to re-appropriate this add-on to act as a favoriting system where a user can see the pages they vote up. I'm thinking I can create a template that removes access to the vote-down function and style the thumbs up to be a heart or something, but want I can't tell is if this add-on could in any way be used to list a user's voted pages on their user profile.

If you could just let me know if oyu think this add-on would make that possibly, and if so, generally how difficult it would be. We can discuss custom development options after gauging whether this is even in the realm of possibility. Thank you!

Type: Pre-Sale
Status: In Progress
kspitzley
View Replies:
goutnet replied on at Permalink Reply
goutnet
Well, it would be feasible, but not simple:

Votes are indeed recorded in the database, so you would (in theory) be able to query the table to retrieve the list of pages. Unfortunately, the page list currently does not swing that way… and you have no simple way to achieve this in the current setup.

The best way would be me adding this option in the page list controller, (and the appropriate configuration). That's about a week of work (including doc & testing).

All other options are really hacky, you could think of creating your own template, return all results (no pagination support in that solution), then filter them out one by one by retrieving the ballot box and checking if the user "liked" it "disliked" it or did not vote for it at all…

Something along the lines:

use Concrete\Package\GntVoteList\Src\PageBallotBox;
use Concrete\Package\GntVoteList\Src\BallotBox;
$box = new PageBallotBox($pageID, $ballotBoxHandle);
$vote = $box->getUserVote();
if (BallotBox::VOTE_UP == $vote) {
   // user voted up
} else if (BallotBox::VOTE_DOWN == $vote) {
  // user voted down
} else {
 // user did not vote
}
// simple filter:
if ( !$box->didVote()) {
  // filter out
}


Although this would work in theory, you would have to drop the pagination support… and you would need to handle special cases when no pages are found etc... Also, this might be a bit slow in case of big sites (query everything in SQL, then filter out in PHP involving one more query per page to the best… not great indeed).

Best way would be to build this in the query directly as I mentionned before.
Resipisco replied on at Permalink Reply
Resipisco
Hi there,

sounds good, did you made it?
I'm still searching for a powerfull voting add-on and if this feature of "My votes list - with links to the related pages" would be create and a big argument to by this add-on.

Best wishes
Danny
goutnet replied on at Permalink Reply
goutnet
The user filter ability is ready now but not yet released. This will be in 2.0.12 version.

I am waiting for some feedback from another ticket (sb having a bug shown in a weird spot), and will release this feature along with the bug fix.

concrete5 Environment Information

5.7+ (site not yet created so I don't have environment info.

Browser User-Agent String

Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.