Commit 63b72312 authored by Thomas Brace's avatar Thomas Brace
Browse files

Add extra helper functions

parent f9769f8f
......@@ -209,6 +209,14 @@ I spent most of my free time creating, updating, maintaining and supporting thes
<?php endif; ?>
```
### To Display Poll Votes by ID
```php
<?php if ( function_exists( 'get_pollvotes_by_id' ) ): ?>
<?php get_pollvotes_by_id($poll_id); ?>
<?php endif; ?>
```
### To Display Total Poll Voters
```php
......@@ -216,3 +224,11 @@ I spent most of my free time creating, updating, maintaining and supporting thes
<?php get_pollvoters(); ?>
<?php endif; ?>
```
### To Display Poll Timestamp by ID
```php
<?php if ( function_exists( 'get_polltimestamp' ) ): ?>
<?php get_polltimestamp($poll_id); ?>
<?php endif; ?>
```
......@@ -851,6 +851,20 @@ if(!function_exists('get_pollvotes')) {
}
}
### Function: Get Poll Votes Based on Poll ID
if(!function_exists('get_pollvotes_by_id')) {
function get_pollvotes_by_id($poll_id, $display = true) {
global $wpdb;
$poll_id = (int) $poll_id;
$totalvotes = (int) $wpdb->get_var("SELECT pollq_totalvotes FROM $wpdb->pollsq WHERE pollq_id = %d LIMIT 1", $poll_id);
if($display) {
echo $totalvotes;
} else {
return $totalvotes;
}
}
}
### Function: Get Poll Total Voters
if(!function_exists('get_pollvoters')) {
......@@ -865,6 +879,20 @@ if(!function_exists('get_pollvoters')) {
}
}
### Function: Get Poll Timestamp Based on Poll ID
if(!function_exists('get_polltimestamp')) {
function get_pollvotes_by_id($poll_id, $display = true) {
global $wpdb;
$poll_id = (int) $poll_id;
$timestamp = (int) $wpdb->get_var("SELECT pollq_timestamp FROM $wpdb->pollsq WHERE pollq_id = %d LIMIT 1", $poll_id);
if($display) {
echo $timestamp;
} else {
return $timestamp;
}
}
}
### Function: Check Voted To Get Voted Answer
function check_voted_multiple($poll_id, $polls_ips) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment