Skip to content

Commit

Permalink
applying Tmeister#16
Browse files Browse the repository at this point in the history
  • Loading branch information
fharper committed Dec 5, 2023
1 parent ad004f8 commit ec321e6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
14 changes: 8 additions & 6 deletions admin/includes/class.settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,14 @@ function get_settings_fields() {
'type' => 'text',
'default' => '',
'sanitize_callback' => 'idea_factory_sanitize_int'
),
array(
'name' => 'if_positive_only',
'label' => __( 'Positive Votes Only', 'idea-factory' ),
'desc' => __( 'Check this box to only allow positive votes.', 'idea-factory' ),
'type' => 'checkbox',
'default' => '',
'sanitize_callback' => 'idea_factory_sanitize_checkbox'
)
),
'if_settings_advanced' => array(
Expand Down Expand Up @@ -378,9 +386,3 @@ function idea_factory_sanitize_int( $input ) {
endif;

$settings = new if_settings_api_wrap();






17 changes: 8 additions & 9 deletions public/includes/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,15 @@ function idea_factory_vote_controls( $postid = '' ) {
$postid = get_the_ID();

?>
<a class="idea-factory vote-up" data-post-id="<?php echo (int) $postid;?>" href="#"></a>
<a class="idea-factory vote-down" data-post-id="<?php echo (int) $postid;?>" href="#"></a>
<a class="idea-factory vote-up" data-user-id="<?php echo get_current_user_ID();?>" data-post-id="<?php echo (int) $postid;?>" href="#"></a>

<?php
$positive = idea_factory_get_option('if_positive_only','if_settings_main');
if ( 'on' !== $positive ) {
?> <a class="idea-factory vote-down" data-user-id="<?php echo get_current_user_ID();?>" data-post-id="<?php echo (int) $postid;?> " href="#"></a>
<?php
}

}

endif;
Expand All @@ -476,10 +482,3 @@ function idea_factory_vote_status( $postid = '' ) {
}

endif;







0 comments on commit ec321e6

Please sign in to comment.