ITWolfy Posted October 22, 2017 Share Posted October 22, 2017 Hi Community, Its Normal behavior to be able to vote only once on an article BUT now if you go to any other article, after rating/voting just a single article, the message appears above all articles you happen browse to :Thanks for rating the article for us Thanks for looking into this, I would like to know if anyone of you members see this behavior please. Greets Wolf 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 23, 2017 Share Posted October 23, 2017 15 hours ago, ITWolfy said: Thanks for looking into this, I would like to know if anyone of you members see this behaviour please. I see it in v7.2.3 and looking at the code, it might be intentional - actually, with WHMCS, just toss a coin and let that decide if it's a bug or intentional design. either way, it's one of those lazy generic WHMCS error messages that could make no sense to the user.... if I had a pound/dollar/euro (delete as applicable) for every time I have seen an incorrect error shown to the user that doesn't make sense (it happens with domain registration search errors too)... offhand, I can't see an obvious quick way around it... once a user has voted on an article, a flag variable is set... and if true, the message you see is displayed... now that's fine on the article they've voted on, but makes no sense to show it on another article... but that flag always remains true after voting, therefore they continue to see that message... if they logged off, and logged back in again (or started a new session if not logged in), they could vote on another article (just one) and so on. if you disable the flag, then the user could vote multiple times for the same, or multiple, articles... that's why I think it might be intentional as it's a quick way of preventing multiple votes. btw - the database doesn't store who votes on a particular article, only the number of votes... so there's no way from that to tell if a user has already voted on a particular article. though you could use a Language Override to modify that output string and mention that they can only vote once per session... $_LANG['knowledgebaseArticleRatingThanks'] = "Thanks for rating the article for us"; 1 Quote Link to comment Share on other sites More sharing options...
ITWolfy Posted October 23, 2017 Author Share Posted October 23, 2017 (edited) Thanks Brian! for your always in depth and thoughtful answers on this forum and taking the time that you do. It is sad, as it did work fine before v7.2.3 Thank you for the LO Override tip, I will use that in the time being, until its decided if it is a bug or a feature Edited October 23, 2017 by ITWolfy spelling 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 23, 2017 Share Posted October 23, 2017 4 minutes ago, ITWolfy said: It is sad, as it did work fine before v7.2.3 which version? I just tried both v6.2.2 and v6.3.1 devs and they're both letting me vote multiple times on the same article... though there's a mention of a change in the v7.2.2 changelog... Quote CORE-11336 - Correct Knowledgebase Article voting via POST if you wanted to allow multiple votes, then that's simple enough with a template tweak (basically just remove the {if $kbarticle.voted} references in knowledgebasearticle.tpl)... or perhaps use an action hook to permanently mark it false. 1 Quote Link to comment Share on other sites More sharing options...
ITWolfy Posted October 23, 2017 Author Share Posted October 23, 2017 45 minutes ago, brian! said: which version? I just tried both v6.2.2 and v6.3.1 devs and they're both letting me vote multiple times on the same article... though there's a mention of a change in the v7.2.2 changelog... if you wanted to allow multiple votes, then that's simple enough with a template tweak (basically just remove the {if $kbarticle.voted} references in knowledgebasearticle.tpl)... or perhaps use an action hook to permanently mark it false. Version 7.2.2 let you vote once and said thank you, but if you refresh the article or re-load it again, you could vote again on the same article. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 23, 2017 Share Posted October 23, 2017 6 minutes ago, ITWolfy said: Version 7.2.2 let you vote once and said thank you, but if you refresh the article or re-load it again, you could vote again on the same article. interesting... don't have a v7.2.2 dev, but the v7.2.3 template is exactly the same - so maybe WHMCS changed how $kbarticle.voted is generated. 0 Quote Link to comment Share on other sites More sharing options...
ITWolfy Posted October 23, 2017 Author Share Posted October 23, 2017 You might be right that the function was intended by WHMCS to work as it currently does. Not that it works for the customer now. Yes something definitely changed , as we use the voting on our site regularly to improve articles everyday, now it does not make it easy for a user to show us what they like in one session anymore, BUT I will follow your advice on editing the knowledgebasearticle.tpl (Thank you) 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Developer WHMCS Andrew Posted October 25, 2017 WHMCS Developer Share Posted October 25, 2017 Hi, We already have a case open to resolve this: CORE-11587 0 Quote Link to comment Share on other sites More sharing options...
ITWolfy Posted October 25, 2017 Author Share Posted October 25, 2017 1 hour ago, WHMCS Andrew said: Hi, We already have a case open to resolve this: CORE-11587 Thank You Andrew, we appreciate it. 0 Quote Link to comment Share on other sites More sharing options...
mihai666g Posted April 9, 2020 Share Posted April 9, 2020 2 years later this bug still exists. 🙂 0 Quote Link to comment Share on other sites More sharing options...
ITWolfy Posted April 9, 2020 Author Share Posted April 9, 2020 Yes we gave up on this , just like we gave up on many other errors or un-wanted features , still not fixed, after all the years passed 😞 Also new errors now, with the new update/s, just going to live with it ,until we can find a better billing solution, for now we re stuck with WHMCS & the cPanel clan. 2 Quote Link to comment Share on other sites More sharing options...
McAtze Posted April 27, 2020 Share Posted April 27, 2020 This is very disappointing. If you could at least look into the code yourself, but you can't do that through ioncube either. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 28, 2020 Share Posted April 28, 2020 23 hours ago, McAtze said: This is very disappointing. If you could at least look into the code yourself, but you can't do that through ioncube either. it would be interesting to know what the CORE-11587 relates to - e.g whether it's just that the alert box is constantly shown after voting, or the whole limitation of only being able to vote on one kb article. I assume that it's the first - in which case, you can just remove the block of code below from knowledgebasearticle.tpl and the alerts will never be shown... {if $kbarticle.voted} {include file="$template/includes/alert.tpl" type="success alert-bordered-left" msg="{lang key="knowledgebaseArticleRatingThanks"}" textcenter=true} {/if} if it's the second, that's going to take some changes and I doubt it would occur within the core before v8. using the hook idea from 2017, I can suppress the "thanks for voting" alert and allows users to vote on multiple articles during the same session... it won't acknowledge visually that they have voted though, other than if they have voted positively, then they will see the "useful" value increase in the article... <?php # Suppress Alert & Allow Multiple Voting on KB Articles Hook # Written by brian! function kb_articles_multiple_voting_hook($vars) { $kbarticle = $vars['kbarticle']; $kbarticle['voted'] = false; return array("kbarticle" => $kbarticle); } add_hook("ClientAreaPageKnowledgebase", 1, "kb_articles_multiple_voting_hook"); they can, if they choose to, vote for the same article multiple times... I daresay that can be fixed too, but not today! ☺️ 2 Quote Link to comment Share on other sites More sharing options...
McAtze Posted April 29, 2020 Share Posted April 29, 2020 @brian! thanks for that code snippet. It work as it should, i can vote multiple times on each article. It doesn't matter, but i got no alert anymore. How can i change this? BTW.. i added two rows in your qouted hook. if (!defined("WHMCS")) die("This file cannot be accessed directly"); 1 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 29, 2020 Share Posted April 29, 2020 1 minute ago, McAtze said: How can i change this? not quickly - permanently making "voted" false effectively disables the bootstrap alert from ever appearing, and allows users to vote on multiple articles... I did see yesterday if I could quickly do both (show alert only after voting AND allow multiple votes), but there wasn't an obvious quick solution - the emphasis here being on quick! ☺️ if you want to edit the knowledgebasearticle.tpl, you can modify the buttons to show a alert popup on voting... <button type="submit" name="vote" value="yes" class="btn btn-lg btn-link" onclick="window.alert('{$LANG.knowledgebaseArticleRatingThanks}');"><i class="far fa-thumbs-up"></i> {$LANG.knowledgebaseyes}</button> <button type="submit" name="vote" value="no" class="btn btn-lg btn-link" onclick="window.alert('{$LANG.knowledgebaseArticleRatingThanks}');"><i class="far fa-thumbs-down"></i> {$LANG.knowledgebaseno}</button> looks a little ugly, but when they click ok, their vote will be registered. 2 Quote Link to comment Share on other sites More sharing options...
McAtze Posted April 29, 2020 Share Posted April 29, 2020 This is a good idea. Thanks for your help.. 👍 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.