We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Locked Topic
[ C ] Who Voted In Polls
Topic Started: Aug 12 2017, 10:21 PM (335 Views)
vix
Member Avatar
Keeper of the Katamari
[ *  *  *  * ]
Board Address: http://s9.zetaboards.com/Katamari_Damacy/index/
Board Software: ZetaBoards
Description: I did a search through the codes and the one I found didn't seem to suit what I was looking for. I would like a code that shows who voted in a poll for every poll topic in specific forums. I would love it if I could choose to have it viewable to admin only and/or members. But if I can only have admin only, that would be fine as well. It doesn't have to show me what they voted for, just who voted. The code I had found appeared to need to be edited per poll but I would love it if I can just apply it to certain forums.

Thanks.
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
So you basically want this code, only to submit the post for specific forums?
Offline Profile Goto Top
 
vix
Member Avatar
Keeper of the Katamari
[ *  *  *  * ]
Yes, that code confused me and made it seem like I needed to edit it for every poll and I don't want to do that when the entire forum section is nothing but polls. Unless I misunderstood how it's done which is entirely possible. I wanted to be able to just, say for example, turn it on and off per forum section. Like add the forum code number and it turns it on but if it's not in the code, it's not active for that section. That's such a dumb way to explain it but I know nothing of code. Just basing that thought on codes I've used in the past. Sorry for the ramble. :)
Offline Profile Goto Top
 
DaPizzaMan
Member Avatar
#TeamSupport

Code:
 
<script type="text/javascript">
$(function() {
var allowedForumIDs = [123, 456];
var fID = 'FORUM_ID';
var tID = 'TOPIC_ID';


var currForumID = parseInt($('#nav li:last').prev().prev().find('a').attr('href').split('/forum/')[1].split('/')[0], 10);
if ($.inArray(currForumID, allowedForumIDs) !== -1 && location.href.indexOf('/topic/') !== -1) {
$('td.c_poll-vote button.btn_mod').click(function() {
var loc = window.location.href;
var uLink = $('#top_info strong a').attr('href');
var uName = $('#top_info strong a').text();
var pTitle = $(this).parents('table.poll').find('thead th').text();
var choice = $(this).parents('table.poll').find('input:checked').next('label').text();

$.get(main_url + 'post/?mode=2&type=1&f=' + fID + '&t=' + tID + '&force_ads', function(data) {
var ast = $('input[name="ast"]', data).val();
var xc = $('input[name="xc"]', data).val();
var qhash = $('input[name="qhash"]', data).val();

$.post(main_url + 'post/?mode=2&type=1&f=' + fID + '&t=' + tID + '&force_ads', {
mode: 2,
type: 1,
ast: ast,
f: fID,
xc: xc,
t: tID,
qhash: qhash,
p: 0,
sd: 1,
post: '[b]User[/b]: [url=' + uLink + ']' + uName + '[/url] \n [b]Topic[/b]: ' + loc + ' \n [b]Poll[/b]: ' + pTitle + '\n [b]Choice[/b]: ' + choice + ''
});
});
});
}
});
</script>
I made the changes to Cory's code.

Add each allowed forum ID to the allowedForumIDs variable and separate them by commas (i.e. 123, 456). The forum IDs added to that variable will be the only forums the code will work in.

Edit: Keep in mind you still need to add the forum ID and topic ID for the topic where the results/posts will go (just as you would in the original code by Cory).
Edited by DaPizzaMan, Sep 7 2017, 09:29 AM.
Offline Profile Goto Top
 
vix
Member Avatar
Keeper of the Katamari
[ *  *  *  * ]
I don't understand the bit about adding in the topic ID, I didn't really understand it in the original code which is why I didn't use it. If the entire forum is nothing but polls, I have to add in every topic that gets made to this code?
Edited by vix, Sep 8 2017, 01:03 AM.
Offline Profile Goto Top
 
DaPizzaMan
Member Avatar
#TeamSupport

The forum and topic IDs are that of the topic which stores all the data. Essentially, you have to create a (preferably hidden) topic somewhere on your board where all the information (username and what they voted for) is stored. Once you create that topic, grab the topic ID and the ID of the forum in which the topic was created and put those in the code.
Offline Profile Goto Top
 
vix
Member Avatar
Keeper of the Katamari
[ *  *  *  * ]
Does it matter then if that topic is in an admin forum where only I can see it or does it need to be in a forum where users have reply permissions like in the original code?

Sorry for being a pain about this.
Offline Profile Goto Top
 
DaPizzaMan
Member Avatar
#TeamSupport

It would be exactly like the original code since I only added to it, not changed it.
Offline Profile Goto Top
 
vix
Member Avatar
Keeper of the Katamari
[ *  *  *  * ]
Alright, thanks. I think I got it working properly now.
Offline Profile Goto Top
 
DaPizzaMan
Member Avatar
#TeamSupport

Completed!

Your request has been completed. If you have any questions or concerns regarding the state of your request, please feel free to contact me via PM.
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Closed Requests · Next Topic »
Locked Topic