Crowdsignal Dashboard – Polls, Surveys & more - Version 1.8.2

Version Description

  • Bug Fix: Rating were showing up on front page when posts ratings were enabled
  • Added fields to options menu to set the rating id for posts/pages/comments
Download this release

Release Info

Developer eoigal
Plugin Icon 128x128 Crowdsignal Dashboard – Polls, Surveys & more
Version 1.8.2
Comparing to
See all releases

Code changes from version 1.8.1 to 1.8.2

Files changed (4) hide show
  1. polldaddy-org.php +69 -4
  2. polldaddy.php +16 -6
  3. rating.php +29 -4
  4. readme.txt +8 -2
polldaddy-org.php CHANGED
@@ -68,7 +68,35 @@ class WPORG_PollDaddy extends WP_PollDaddy {
68
  $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
69
  $polldaddy->reset();
70
 
71
- $polldaddy_sync_account = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
 
73
  if( isset( $_POST['polldaddy-sync-account'] ) )
74
  $polldaddy_sync_account = (int) $_POST['polldaddy-sync-account'];
@@ -77,9 +105,7 @@ class WPORG_PollDaddy extends WP_PollDaddy {
77
  $this->rating_user_code = '';
78
  update_option( 'pd-rating-usercode', '' );
79
  $this->set_api_user_code();
80
- }
81
-
82
- $polldaddy_multiple_accounts = 0;
83
 
84
  if( isset( $_POST['polldaddy-multiple-accounts'] ) )
85
  $polldaddy_multiple_accounts = (int) $_POST['polldaddy-multiple-accounts'];
@@ -294,6 +320,45 @@ class WPORG_PollDaddy extends WP_PollDaddy {
294
  <label for="polldaddy-sync-account"><?php _e( 'This will syncronize your ratings PollDaddy account.', 'polldaddy' ); ?></label>
295
  </span>
296
  </td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
297
  </tr><?php }
298
  return parent::plugin_options_add();
299
  }
68
  $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->user_code );
69
  $polldaddy->reset();
70
 
71
+ $polldaddy_post_rating_id = 0;
72
+ $polldaddy_page_rating_id = 0;
73
+ $polldaddy_comment_rating_id = 0;
74
+ $polldaddy_sync_account = 0;
75
+ $polldaddy_multiple_accounts = 0;
76
+
77
+ if( !empty( $_POST['polldaddy-post-rating-id'] ) ) {
78
+ $polldaddy_post_rating_id = (int) $_POST['polldaddy-post-rating-id'];
79
+ update_option( 'pd-rating-posts-id', $polldaddy_post_rating_id );
80
+
81
+ if( (int) get_option( 'pd-rating-posts' ) > 0 )
82
+ update_option( 'pd-rating-posts', $polldaddy_post_rating_id );
83
+ }
84
+
85
+ if( !empty( $_POST['polldaddy-page-rating-id'] ) ) {
86
+ $polldaddy_page_rating_id = (int) $_POST['polldaddy-page-rating-id'];
87
+ update_option( 'pd-rating-pages-id', $polldaddy_page_rating_id );
88
+
89
+ if( (int) get_option( 'pd-rating-pages' ) > 0 )
90
+ update_option( 'pd-rating-pages', $polldaddy_page_rating_id );
91
+ }
92
+
93
+ if( !empty( $_POST['polldaddy-comment-rating-id'] ) ) {
94
+ $polldaddy_comment_rating_id = (int) $_POST['polldaddy-comment-rating-id'];
95
+ update_option( 'pd-rating-comments-id', $polldaddy_comment_rating_id );
96
+
97
+ if( (int) get_option( 'pd-rating-comments' ) > 0 )
98
+ update_option( 'pd-rating-comments', $polldaddy_comment_rating_id );
99
+ }
100
 
101
  if( isset( $_POST['polldaddy-sync-account'] ) )
102
  $polldaddy_sync_account = (int) $_POST['polldaddy-sync-account'];
105
  $this->rating_user_code = '';
106
  update_option( 'pd-rating-usercode', '' );
107
  $this->set_api_user_code();
108
+ }
 
 
109
 
110
  if( isset( $_POST['polldaddy-multiple-accounts'] ) )
111
  $polldaddy_multiple_accounts = (int) $_POST['polldaddy-multiple-accounts'];
320
  <label for="polldaddy-sync-account"><?php _e( 'This will syncronize your ratings PollDaddy account.', 'polldaddy' ); ?></label>
321
  </span>
322
  </td>
323
+ </tr>
324
+ <tr class="form-field form-required">
325
+ <th valign="top" scope="row">
326
+ <label for="polldaddy-post-rating-id">
327
+ <?php _e( 'Posts Rating ID', 'polldaddy' ); ?>
328
+ </label>
329
+ </th>
330
+ <td>
331
+ <input type="text" size="10" name="polldaddy-post-rating-id" id="polldaddy-post-rating-id" value="<?php echo (int) get_option( 'pd-rating-posts-id' ); ?>" style="width: auto" />
332
+ <span class="description">
333
+ <label for="polldaddy-post-rating-id"><?php _e( 'This is the rating ID used in posts', 'polldaddy' ); ?></label>
334
+ </span>
335
+ </td>
336
+ </tr>
337
+ <tr class="form-field form-required">
338
+ <th valign="top" scope="row">
339
+ <label for="polldaddy-page-rating-id">
340
+ <?php _e( 'Pages Rating ID', 'polldaddy' ); ?>
341
+ </label>
342
+ </th>
343
+ <td>
344
+ <input type="text" size="10" name="polldaddy-page-rating-id" id="polldaddy-page-rating-id" value="<?php echo (int) get_option( 'pd-rating-pages-id' ); ?>" style="width: auto" />
345
+ <span class="description">
346
+ <label for="polldaddy-page-rating-id"><?php _e( 'This is the rating ID used in pages', 'polldaddy' ); ?></label>
347
+ </span>
348
+ </td>
349
+ </tr>
350
+ <tr class="form-field form-required">
351
+ <th valign="top" scope="row">
352
+ <label for="polldaddy-comment-rating-id">
353
+ <?php _e( 'Comments Rating ID', 'polldaddy' ); ?>
354
+ </label>
355
+ </th>
356
+ <td>
357
+ <input type="text" size="10" name="polldaddy-comment-rating-id" id="polldaddy-comment-rating-id" value="<?php echo (int) get_option( 'pd-rating-comments-id' ); ?>" style="width: auto" />
358
+ <span class="description">
359
+ <label for="polldaddy-comment-rating-id"><?php _e( 'This is the rating ID used in comments', 'polldaddy' ); ?></label>
360
+ </span>
361
+ </td>
362
  </tr><?php }
363
  return parent::plugin_options_add();
364
  }
polldaddy.php CHANGED
@@ -5,7 +5,7 @@ Plugin Name: PollDaddy Polls
5
  Description: Create and manage PollDaddy polls and ratings in WordPress
6
  Author: Automattic, Inc.
7
  Author URL: http://automattic.com/
8
- Version: 1.8.1
9
  */
10
 
11
  // You can hardcode your PollDaddy PartnerGUID (API Key) here
@@ -33,7 +33,7 @@ class WP_PollDaddy {
33
  global $current_user;
34
  $this->errors = new WP_Error;
35
  $this->scheme = 'https';
36
- $this->version = '1.8.1';
37
  $this->multiple_accounts = true;
38
  $this->polldaddy_client_class = 'api_client';
39
  $this->polldaddy_clients = array();
@@ -2983,7 +2983,7 @@ class WP_PollDaddy {
2983
  $rating_updated = true;
2984
  break;
2985
 
2986
- case 'comments':
2987
  if ( isset( $_POST[ 'pd_show_comments' ] ) && (int) $_POST[ 'pd_show_comments' ] == 1 )
2988
  $show_comments = get_option( 'pd-rating-comments-id' );
2989
 
@@ -3032,9 +3032,19 @@ class WP_PollDaddy {
3032
  }
3033
 
3034
  $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->rating_user_code );
3035
- $polldaddy->reset();
 
3036
 
3037
- $response = $polldaddy->get_rating( $rating_id );
 
 
 
 
 
 
 
 
 
3038
 
3039
  if ( empty( $response ) || (int) $response->_id == 0 ) {
3040
  $polldaddy->reset();
@@ -3045,7 +3055,7 @@ class WP_PollDaddy {
3045
  $blog_name = get_option( 'blogname' );
3046
 
3047
  if ( empty( $blog_name ) )
3048
- $blog_name = 'WPORG Blog';
3049
 
3050
  $blog_name .= ' - ' . $report_type;
3051
 
5
  Description: Create and manage PollDaddy polls and ratings in WordPress
6
  Author: Automattic, Inc.
7
  Author URL: http://automattic.com/
8
+ Version: 1.8.2
9
  */
10
 
11
  // You can hardcode your PollDaddy PartnerGUID (API Key) here
33
  global $current_user;
34
  $this->errors = new WP_Error;
35
  $this->scheme = 'https';
36
+ $this->version = '1.8.2';
37
  $this->multiple_accounts = true;
38
  $this->polldaddy_client_class = 'api_client';
39
  $this->polldaddy_clients = array();
2983
  $rating_updated = true;
2984
  break;
2985
 
2986
+ case 'comments':
2987
  if ( isset( $_POST[ 'pd_show_comments' ] ) && (int) $_POST[ 'pd_show_comments' ] == 1 )
2988
  $show_comments = get_option( 'pd-rating-comments-id' );
2989
 
3032
  }
3033
 
3034
  $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->rating_user_code );
3035
+ $polldaddy->reset();
3036
+ $response = $polldaddy->get_rating( $rating_id );
3037
 
3038
+ if ( $polldaddy->errors ) {
3039
+ if( array_key_exists( 4, $polldaddy->errors ) ) { //Obsolete key
3040
+ $this->rating_user_code = '';
3041
+ update_option( 'pd-rating-usercode', '' );
3042
+ $this->set_api_user_code(); // get latest key
3043
+ $polldaddy = $this->get_client( WP_POLLDADDY__PARTNERGUID, $this->rating_user_code );
3044
+ $polldaddy->reset();
3045
+ $response = $polldaddy->get_rating( $rating_id );
3046
+ }
3047
+ }
3048
 
3049
  if ( empty( $response ) || (int) $response->_id == 0 ) {
3050
  $polldaddy->reset();
3055
  $blog_name = get_option( 'blogname' );
3056
 
3057
  if ( empty( $blog_name ) )
3058
+ $blog_name = 'WordPress Blog';
3059
 
3060
  $blog_name .= ' - ' . $report_type;
3061
 
rating.php CHANGED
@@ -35,7 +35,7 @@ function polldaddy_show_rating_comments( $content ){
35
  function polldaddy_show_rating( $content ) {
36
  if ( !is_feed() && !is_attachment() ) {
37
  if ( is_single() || is_page() || is_home() ) {
38
- $html = polldaddy_get_rating_html();
39
 
40
  if( !empty( $html ) ) {
41
  $rating_pos = 0;
@@ -58,7 +58,7 @@ function polldaddy_show_rating( $content ) {
58
  return $content;
59
  }
60
 
61
- function polldaddy_get_rating_html(){
62
  global $post;
63
  $html = '';
64
 
@@ -70,11 +70,36 @@ function polldaddy_get_rating_html(){
70
  $item_id = '';
71
 
72
  if ( is_page() ) {
73
- $rating_id = (int) get_option( 'pd-rating-pages-id' );
 
 
 
 
 
 
 
74
  $unique_id = 'wp-page-' . $post->ID;
75
  $item_id = '_page_' . $post->ID;
 
 
 
 
 
 
 
 
 
 
 
76
  } else {
77
- $rating_id = (int) get_option( 'pd-rating-posts-id' );
 
 
 
 
 
 
 
78
  $unique_id = 'wp-post-' . $post->ID;
79
  $item_id = '_post_' . $post->ID;
80
  }
35
  function polldaddy_show_rating( $content ) {
36
  if ( !is_feed() && !is_attachment() ) {
37
  if ( is_single() || is_page() || is_home() ) {
38
+ $html = polldaddy_get_rating_html( 'check-options' );
39
 
40
  if( !empty( $html ) ) {
41
  $rating_pos = 0;
58
  return $content;
59
  }
60
 
61
+ function polldaddy_get_rating_html( $condition = '' ){
62
  global $post;
63
  $html = '';
64
 
70
  $item_id = '';
71
 
72
  if ( is_page() ) {
73
+ if ( $condition = 'check-options' ){
74
+ if( (int) get_option( 'pd-rating-pages' ) > 0 ){
75
+ $rating_id = (int) get_option( 'pd-rating-pages-id' );
76
+ }
77
+ } else {
78
+ $rating_id = (int) get_option( 'pd-rating-pages-id' );
79
+ }
80
+
81
  $unique_id = 'wp-page-' . $post->ID;
82
  $item_id = '_page_' . $post->ID;
83
+ } else if ( is_home() ) {
84
+ if ( $condition = 'check-options' ){
85
+ if( (int) get_option( 'pd-rating-posts-index' ) > 0 ){
86
+ $rating_id = (int) get_option( 'pd-rating-posts-id' );
87
+ }
88
+ } else {
89
+ $rating_id = (int) get_option( 'pd-rating-posts-id' );
90
+ }
91
+
92
+ $unique_id = 'wp-post-' . $post->ID;
93
+ $item_id = '_post_' . $post->ID;
94
  } else {
95
+ if ( $condition = 'check-options' ){
96
+ if( (int) get_option( 'pd-rating-posts' ) > 0 ){
97
+ $rating_id = (int) get_option( 'pd-rating-posts-id' );
98
+ }
99
+ } else {
100
+ $rating_id = (int) get_option( 'pd-rating-posts-id' );
101
+ }
102
+
103
  $unique_id = 'wp-post-' . $post->ID;
104
  $item_id = '_post_' . $post->ID;
105
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: mdawaffe, eoigal
3
  Tags: polls, poll, polldaddy, wppolls, vote, polling, surveys, rate, rating, ratings
4
  Requires at least: 2.6
5
  Tested up to: 2.9.1
6
- Stable tag: 1.8.1
7
 
8
  Create and manage PollDaddy polls and ratings from within WordPress.
9
 
@@ -48,13 +48,19 @@ Nope. The permissions are the same as for posts. So Editors and Administrators
48
 
49
  = Where are my ratings? =
50
 
51
- Check your theme's footer.php calls wp_footer. The rating javascript is loaded on this action. More here - http://codex.wordpress.org/Theme_Development#Plugin_API_Hooks
 
 
52
 
53
  = I cannot access my ratings settings, I am getting a "Sorry! There was an error creating your rating widget. Please contact PollDaddy support to fix this." message. =
54
 
55
  You need to select the synchronize ratings account in the Options menu to make sure the ratings API key is valid.
56
 
57
  == Change Log ==
 
 
 
 
58
  = 1.8.1 =
59
  * Added a template tag to allow themes to place the rating wherever they want by echoing the function polldaddy_get_rating_html()
60
  * Added shortcodes to text widget, so now all Polldaddy shortcodes will work in the text widget.
3
  Tags: polls, poll, polldaddy, wppolls, vote, polling, surveys, rate, rating, ratings
4
  Requires at least: 2.6
5
  Tested up to: 2.9.1
6
+ Stable tag: 1.8.2
7
 
8
  Create and manage PollDaddy polls and ratings from within WordPress.
9
 
48
 
49
  = Where are my ratings? =
50
 
51
+ Check your theme's footer.php calls wp_footer. The rating javascript is loaded on this action.
52
+
53
+ More info here - http://codex.wordpress.org/Theme_Development#Plugin_API_Hooks
54
 
55
  = I cannot access my ratings settings, I am getting a "Sorry! There was an error creating your rating widget. Please contact PollDaddy support to fix this." message. =
56
 
57
  You need to select the synchronize ratings account in the Options menu to make sure the ratings API key is valid.
58
 
59
  == Change Log ==
60
+ = 1.8.2 =
61
+ * Bug Fix: Rating were showing up on front page when posts ratings were enabled
62
+ * Added fields to options menu to set the rating id for posts/pages/comments
63
+
64
  = 1.8.1 =
65
  * Added a template tag to allow themes to place the rating wherever they want by echoing the function polldaddy_get_rating_html()
66
  * Added shortcodes to text widget, so now all Polldaddy shortcodes will work in the text widget.