Plugin Directory

Changeset 2060854


Ignore:
Timestamp:
04/01/2019 08:53:21 AM (7 years ago)
Author:
sebastiantiede
Message:

Patch 0.0.6-1

Location:
wp-open-votomat
Files:
3031 added
9 edited

Legend:

Unmodified
Added
Removed
  • wp-open-votomat/trunk/backend_assets/js/wpov-admin.js

    r2053270 r2060854  
    44    var content = {
    55        init: function() {
    6             console.log('wpov_admin');
     6            this.actions.init();
    77        },
    88        plugins: {
     
    1313
    1414            }
     15        },
     16        actions: {
     17            init: function() {
     18                var label = 'wpov-js-click-action';
     19                jQuery(document).on('click', '[data-'+ label +']', function(e) {
     20                    e.preventDefault();
     21                    var $t = jQuery(this),
     22                        data = $t.data(label);
     23                   
     24                    wpov_admin.actions.actions[data]($t);
     25                });
     26            },
     27            actions: {
     28                reset_user_votings: function($t) {
     29                    var confirm = window.confirm('Do you really want to reset the user data?');
     30                   
     31                    if(confirm == true) {
     32                        jQuery.post(ajaxurl, {
     33                            action : 'wpov_reset_user_votings',
     34                            post_id : $t.data('post_id')
     35                        }, function(data) {
     36                            console.log(data);
     37                            setTimeout(function() {
     38                                window.alert(data);
     39                            }, 200);
     40                        });                       
     41                    }
     42                }
     43            }
    1544        }
    1645    }   
  • wp-open-votomat/trunk/includes/admin/post_type-voting.php

    r2058867 r2060854  
    1919       
    2020        add_action('manage_edit-'.$this->post_type.'_columns', array($this, 'admin_column_header'));
    21         add_action('manage_'.$this->post_type.'_posts_custom_column', array($this, 'admin_column_content'));       
    22     }
     21        add_action('manage_'.$this->post_type.'_posts_custom_column', array($this, 'admin_column_content'));   
     22       
     23        add_filter( 'cmb2_input_attributes', array($this, 'set_datetime_placeholder'), 20, 4 );
     24               
     25    }
     26   
     27    function set_datetime_placeholder($args, $type_defaults, $field, $types) {
     28        if(in_array($args['name'], array($this->prefix.'period_from[time]', $this->prefix.'period_to[time]'))) {
     29            $args['placeholder'] = sprintf(__('Time (e.g. %s)', 'wpov'), date('H:i'));
     30        }
     31        return $args;
     32    }
     33
    2334   
    2435    function admin_column_header($columns) {
     
    7283                        __('Voting is on hold!', WPOV__PLUGIN_NAME_SLUG)
    7384                    );
     85                   
     86                    printf(
     87                        '<button data-wpov-js-click-action="reset_user_votings" data-post_id="%d" class="button-secondary">%s</button></form>',
     88                        $post->ID,
     89                        __('Reset user voting', WPOV__PLUGIN_NAME_SLUG)
     90                    );                   
     91                   
    7492                } elseif($status['time_to_end'] < 0) {
    7593                    printf(
     
    97115        }       
    98116    }   
    99    
    100117   
    101118    function enter_title_here($title) {
     
    266283            'id'   => $this->prefix . 'period_from',
    267284            'type' => 'text_datetime_timestamp',
     285            'date_format' => 'd.m.Y',
     286            'time_format' => 'H:i',
     287            'attributes'  => array(
     288                'placeholder' => sprintf(__('Date (e.g. %s)', 'wpov'), date('d.m.Y')),
     289                'autocomplete' => 'off',
     290                'required'    => 'required',
     291            )           
    268292        ) );       
    269293       
     
    272296            'id'   => $this->prefix . 'period_to',
    273297            'type' => 'text_datetime_timestamp',
     298            'date_format' => 'd.m.Y',
     299            'time_format' => 'H:i',
     300            'attributes'  => array(
     301                'placeholder' => sprintf(__('Date (e.g. %s)', 'wpov'), date('d.m.Y')),
     302                'autocomplete' => 'off',
     303                'required'    => 'required',
     304            )               
    274305        ) );           
    275306       
     
    277308            'name' => __('Keep online after expiration', WPOV__PLUGIN_NAME_SLUG),
    278309            'id'   => $this->prefix . 'keep_online',
     310            'after_row' => sprintf('<p>%s</p>', __('If this checkbox is selected, the voting doesn’t disappear after expiration. You can still vote. Votes are not included in the statistics after expiration.', 'wpov')),
    279311            'type' => 'checkbox',
    280312        ) );
    281                      
     313                            
    282314    }
    283315   
  • wp-open-votomat/trunk/includes/api/wpov_voting.php

    r2053270 r2060854  
    241241    }
    242242   
     243    function reset_user_votings() {
     244        global $wpdb;
     245       
     246        $query = "
     247            SELECT p.ID 
     248            FROM $wpdb->posts as p
     249            JOIN $wpdb->postmeta as m ON (p.ID = m.post_id)
     250            WHERE
     251                p.post_type = 'wpov-user-vote' AND
     252                m.meta_key REGEXP '^_wpov_voting_{$this->get_id()}'
     253            GROUP BY p.ID
     254        ";
     255       
     256        $post_ids = (array) $wpdb->get_col($query);
     257       
     258        $delete_query = array();
     259        $delete_query[] = "DELETE FROM $wpdb->postmeta WHERE post_id = {$this->get_id()} AND meta_key REGEXP '^_wpov_counter_question_'";       
     260       
     261        foreach($post_ids as $post_id) {
     262            $delete_query[] = "DELETE FROM $wpdb->postmeta WHERE post_id = {$post_id}";
     263            $delete_query[] = "DELETE FROM $wpdb->posts WHERE ID = {$post_id}";
     264            delete_transient(sprintf('wpov_voter_%d_votes', $post_id));
     265        }
     266       
     267        foreach($delete_query as $query) {
     268            $wpdb->query($query);
     269        }
     270
     271        return $post_ids;
     272    }
     273   
    243274       
    244275}
  • wp-open-votomat/trunk/includes/voter/wpov_voter_current.php

    r2053270 r2060854  
    1010        }
    1111               
     12       
    1213        $this->set('user_db_id', isset($_SESSION['user_db_id']) ? $_SESSION['user_db_id'] : false);
     14       
     15        if(get_post_status( $this->get('user_db_id' ) ) === false) {
     16            $this->set('user_db_id', false);
     17        }
     18
    1319        $this->get_db_votes();
    1420        //if($this->count_votes())
     
    9298        }
    9399       
     100        $prev_vote = get_post_meta( $post_id, $meta_key, true );
     101       
    94102        if ( ! add_post_meta( $post_id, $meta_key, $meta_value, true ) ) {
    95103           update_post_meta( $post_id, $meta_key, $meta_value );
     
    98106        delete_transient( $this->wpov_voter_votes_transient_key );       
    99107       
    100         $meta_key = "_wpov_counter_question_{$question}_{$vote}";
    101         $meta_value = intval(get_post_meta($voting, $meta_key));
    102         $meta_value++;
     108        $_voting = wpov_get_voting($voting);
     109        $status = $_voting->publication_status_array();
    103110       
    104         if ( ! add_post_meta( $voting, $meta_key, $meta_value, true ) ) {
    105            update_post_meta( $voting, $meta_key, $meta_value );
    106         }             
     111        // count up if online
     112        if($status['is_live']) {
     113
     114
     115            $meta_key = "_wpov_counter_question_{$question}_{$vote}";
     116            $meta_value = intval(get_post_meta($voting, $meta_key));
     117            $meta_value++;
     118
     119            if ( ! add_post_meta( $voting, $meta_key, $meta_value, true ) ) {
     120               update_post_meta( $voting, $meta_key, $meta_value );
     121            }   
     122
     123            // count down previous vote
     124            if($prev_vote and $prev_vote != $meta_value) {
     125                $prev_meta_key = "_wpov_counter_question_{$question}_{$prev_vote}";
     126                $prev_meta_value = intval(get_post_meta($voting, $prev_meta_key));
     127                if($prev_meta_value > 0) {
     128                    if ( ! add_post_meta( $voting, $prev_meta_key, ($prev_meta_value-1), true ) ) {
     129                       update_post_meta( $voting, $prev_meta_key, ($prev_meta_value-1) );
     130                    }                 
     131                }
     132            }       
     133        }
    107134       
    108135        wp_update_post( array(
     
    111138            'post_modified_gmt' => current_time( 'mysql', 1 )
    112139        ) );
    113         /*
    114         wp_update_post(array(
    115             'ID' => $post_id,
    116             'post_content' => maybe_serialize($votes)
    117         ));
    118         */
     140
    119141    }   
    120142   
  • wp-open-votomat/trunk/languages/wp-open-votomat-de_DE.po

    r2058867 r2060854  
    55"Project-Id-Version: Shortcake (Shortcode UI) 0.7.3\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/shortcode-ui\n"
    7 "POT-Creation-Date: 2019-03-28 11:48+0100\n"
    8 "PO-Revision-Date: 2019-03-28 11:49+0100\n"
     7"POT-Creation-Date: 2019-03-29 17:23+0100\n"
     8"PO-Revision-Date: 2019-03-29 17:24+0100\n"
    99"Last-Translator: \n"
    1010"Language-Team: \n"
     
    7070#: includes/admin/post_type-question.php:75
    7171#: includes/admin/post_type-question.php:85
    72 #: includes/admin/post_type-voting.php:41
    73 #: includes/admin/post_type-voting.php:238 wp-open-votomat.php:322
     72#: includes/admin/post_type-voting.php:52
     73#: includes/admin/post_type-voting.php:255 wp-open-votomat.php:350
    7474msgid "Question"
    7575msgstr "Frage"
     
    8888
    8989#: wpov_template/twentynineteen/twig/page-voting-result.twig:11
    90 #: includes/admin/post_type-voting.php:45
    91 #: includes/admin/post_type-voting.php:189 wp-open-votomat.php:289
     90#: includes/admin/post_type-voting.php:56
     91#: includes/admin/post_type-voting.php:206 wp-open-votomat.php:317
    9292msgid "Party"
    9393msgstr "Partei"
     
    145145
    146146#: includes/admin/options-settings.php:25
    147 #: includes/admin/post_type-voting.php:257
     147#: includes/admin/post_type-voting.php:274
    148148msgid "Settings"
    149149msgstr "Einstellungen"
     
    260260msgstr "Erklärung"
    261261
    262 #: includes/admin/post_type-voting.php:25
    263 #: includes/admin/post_type-voting.php:46
    264 #: includes/admin/post_type-voting.php:149 wp-open-votomat.php:288
     262#: includes/admin/post_type-voting.php:29
     263#, php-format
     264msgid "Time (e.g. %s)"
     265msgstr "Zeit (z.B. %s)"
     266
     267#: includes/admin/post_type-voting.php:36
     268#: includes/admin/post_type-voting.php:57
     269#: includes/admin/post_type-voting.php:166 wp-open-votomat.php:316
    265270msgid "Parties"
    266271msgstr "Parteien"
    267272
    268 #: includes/admin/post_type-voting.php:26
    269 #: includes/admin/post_type-voting.php:42
    270 #: includes/admin/post_type-voting.php:200 wp-open-votomat.php:321
     273#: includes/admin/post_type-voting.php:37
     274#: includes/admin/post_type-voting.php:53
     275#: includes/admin/post_type-voting.php:217 wp-open-votomat.php:349
    271276msgid "Questions"
    272277msgstr "Fragen"
    273278
    274 #: includes/admin/post_type-voting.php:27
     279#: includes/admin/post_type-voting.php:38
    275280msgid "Period"
    276281msgstr "Zeitraum"
    277282
    278 #: includes/admin/post_type-voting.php:66
     283#: includes/admin/post_type-voting.php:77
    279284msgid "Voting is live!"
    280285msgstr "Wahl ist live!"
    281286
    282 #: includes/admin/post_type-voting.php:72
     287#: includes/admin/post_type-voting.php:83
    283288msgid "Voting is on hold!"
    284289msgstr "Wahl ist in Wartestellung!"
    285290
    286 #: includes/admin/post_type-voting.php:78
     291#: includes/admin/post_type-voting.php:89
     292msgid "Reset user voting"
     293msgstr "Benutzerstimmen zurücksetzen"
     294
     295#: includes/admin/post_type-voting.php:96
    287296msgid "Voting has ended!"
    288297msgstr "Wahl wurde beendet!"
    289298
    290 #: includes/admin/post_type-voting.php:83
     299#: includes/admin/post_type-voting.php:101
    291300msgid "Voting has ended but is kept online!"
    292301msgstr "Wahl wurde beendet aber ist weiterhin online!"
    293302
    294 #: includes/admin/post_type-voting.php:88
    295 #: includes/admin/post_type-voting.php:265
     303#: includes/admin/post_type-voting.php:106
     304#: includes/admin/post_type-voting.php:282
    296305msgid "From"
    297306msgstr "Von"
    298307
    299 #: includes/admin/post_type-voting.php:89
    300 #: includes/admin/post_type-voting.php:94
     308#: includes/admin/post_type-voting.php:107
     309#: includes/admin/post_type-voting.php:112
    301310msgid "d.m.Y H:i:s"
    302311msgstr "d.m.Y H:i:s"
    303312
    304 #: includes/admin/post_type-voting.php:93
     313#: includes/admin/post_type-voting.php:111
    305314msgid "To"
    306315msgstr "Bis"
    307316
    308 #: includes/admin/post_type-voting.php:102
     317#: includes/admin/post_type-voting.php:119
    309318msgid "Enter voting title here"
    310319msgstr "Gebe den Wahl-Titel hier ein"
    311320
    312 #: includes/admin/post_type-voting.php:122
     321#: includes/admin/post_type-voting.php:139
    313322msgid "Descriptions"
    314323msgstr "Beschreibung"
    315324
    316 #: includes/admin/post_type-voting.php:130
     325#: includes/admin/post_type-voting.php:147
    317326msgid "Description before publication"
    318327msgstr "Beschreibung vor der Veröffentlichung"
    319328
    320 #: includes/admin/post_type-voting.php:137
     329#: includes/admin/post_type-voting.php:154
    321330msgid "Description after expiry"
    322331msgstr "Beschreibung nach Ablauf"
    323332
    324 #: includes/admin/post_type-voting.php:138
     333#: includes/admin/post_type-voting.php:155
    325334msgid "If this field is empty this voting will disappear after expiration!"
    326335msgstr "Wenn dieses Feld leer ist, verschwindet diese Wahl nach Ablauf!"
    327336
    328 #: includes/admin/post_type-voting.php:162
     337#: includes/admin/post_type-voting.php:179
    329338msgid ""
    330339"No parties have been created so far. If you have created some, you can link "
     
    334343"sie an dieser Stelle verlinken!"
    335344
    336 #: includes/admin/post_type-voting.php:174
     345#: includes/admin/post_type-voting.php:191
    337346msgid "Party {#}"
    338347msgstr "Partei {#}"
    339348
    340 #: includes/admin/post_type-voting.php:175
     349#: includes/admin/post_type-voting.php:192
    341350msgid "Add Another Party"
    342351msgstr "Weitere Partei hinzufügen"
    343352
    344 #: includes/admin/post_type-voting.php:176
     353#: includes/admin/post_type-voting.php:193
    345354msgid "Remove Party"
    346355msgstr "Partei entfernen"
    347356
    348 #: includes/admin/post_type-voting.php:211
     357#: includes/admin/post_type-voting.php:228
    349358msgid ""
    350359"No questions have been created so far. If you have created some, you can "
     
    354363"sie hier verknüpfen!"
    355364
    356 #: includes/admin/post_type-voting.php:223
     365#: includes/admin/post_type-voting.php:240
    357366msgid "Question {#}"
    358367msgstr "Frage {#}"
    359368
    360 #: includes/admin/post_type-voting.php:224
     369#: includes/admin/post_type-voting.php:241
    361370msgid "Add Another Question"
    362371msgstr "Weitere Frage hinzufügen"
    363372
    364 #: includes/admin/post_type-voting.php:225
     373#: includes/admin/post_type-voting.php:242
    365374msgid "Remove Question"
    366375msgstr "Frage entfernen"
    367376
    368 #: includes/admin/post_type-voting.php:271
     377#: includes/admin/post_type-voting.php:288
     378#: includes/admin/post_type-voting.php:301
     379#, php-format
     380msgid "Date (e.g. %s)"
     381msgstr "Datum (z.B. %s)"
     382
     383#: includes/admin/post_type-voting.php:295
    369384msgid "to"
    370385msgstr "bis"
    371386
    372 #: includes/admin/post_type-voting.php:277
     387#: includes/admin/post_type-voting.php:308
    373388msgid "Keep online after expiration"
    374389msgstr "Nach Ablauf online halten"
     390
     391#: includes/admin/post_type-voting.php:310
     392msgid ""
     393"If this checkbox is selected, the voting doesn’t disappear after expiration. "
     394"You can still vote. Votes are not included in the statistics after "
     395"expiration."
     396msgstr ""
     397"Wenn diese Checkbox ausgewählt wurde, verschwindet die Wahl nicht nach "
     398"Ablauf. Es kann weiterhin abgestimmt werden. Abstimmungen nach Ablauf "
     399"fließen nicht in die Statistik ein."
    375400
    376401#: includes/helpers/helpers.php:175
     
    415440msgstr[1] "Sekunden"
    416441
    417 #: wp-open-votomat.php:237
     442#: wp-open-votomat.php:202
     443msgid "Post not found!"
     444msgstr "Post nicht gefunden!"
     445
     446#: wp-open-votomat.php:206
     447msgid "Not permitted!"
     448msgstr "Nicht authorisiert!"
     449
     450#: wp-open-votomat.php:212
     451msgid "Not allowed!"
     452msgstr "Nicht erlaubt!"
     453
     454#: wp-open-votomat.php:265
    418455msgid "WPOV Footer Menu"
    419456msgstr "WPOV Fußmenü"
    420457
    421 #: wp-open-votomat.php:290 wp-open-votomat.php:323 wp-open-votomat.php:354
     458#: wp-open-votomat.php:318 wp-open-votomat.php:351 wp-open-votomat.php:382
    422459msgid "Add New"
    423460msgstr "Neue hinzufügen"
    424461
    425 #: wp-open-votomat.php:291
     462#: wp-open-votomat.php:319
    426463msgid "Add New Party"
    427464msgstr "Neue Partei hinzufügen"
    428465
    429 #: wp-open-votomat.php:292
     466#: wp-open-votomat.php:320
    430467msgid "Edit Party"
    431468msgstr "Partei bearbeiten"
    432469
    433 #: wp-open-votomat.php:293
     470#: wp-open-votomat.php:321
    434471msgid "New Party"
    435472msgstr "Neue Partei"
    436473
    437 #: wp-open-votomat.php:294
     474#: wp-open-votomat.php:322
    438475msgid "View Party"
    439476msgstr "Partei ansehen"
    440477
    441 #: wp-open-votomat.php:295
     478#: wp-open-votomat.php:323
    442479msgid "Search Parties"
    443480msgstr "Nach Partei suchen"
    444481
    445 #: wp-open-votomat.php:296
     482#: wp-open-votomat.php:324
    446483msgid "No Parties found"
    447484msgstr "Keine Partei gefunden"
    448485
    449 #: wp-open-votomat.php:297
     486#: wp-open-votomat.php:325
    450487msgid "No Parties found in Trash"
    451488msgstr "Keine Partei im Papierkorb gefunden"
    452489
    453 #: wp-open-votomat.php:324
     490#: wp-open-votomat.php:352
    454491msgid "Add New Question"
    455492msgstr "Neue Frage hinzufügen"
    456493
    457 #: wp-open-votomat.php:325
     494#: wp-open-votomat.php:353
    458495msgid "Edit Question"
    459496msgstr "Frage bearbeiten"
    460497
    461 #: wp-open-votomat.php:326
     498#: wp-open-votomat.php:354
    462499msgid "New Question"
    463500msgstr "Neue Frage"
    464501
    465 #: wp-open-votomat.php:327
     502#: wp-open-votomat.php:355
    466503msgid "View Question"
    467504msgstr "Frage ansehen"
    468505
    469 #: wp-open-votomat.php:328
     506#: wp-open-votomat.php:356
    470507msgid "Search Questions"
    471508msgstr "Nach Fragen suchen"
    472509
    473 #: wp-open-votomat.php:329
     510#: wp-open-votomat.php:357
    474511msgid "No Questions found"
    475512msgstr "Keine Fragen gefunden"
    476513
    477 #: wp-open-votomat.php:330
     514#: wp-open-votomat.php:358
    478515msgid "No Questions found in Trash"
    479516msgstr "Keine Fragen im Papierkorb gefunden"
    480517
    481 #: wp-open-votomat.php:352
     518#: wp-open-votomat.php:380
    482519msgid "Votings"
    483520msgstr "Wahlen"
    484521
    485 #: wp-open-votomat.php:353
     522#: wp-open-votomat.php:381
    486523msgid "Voting"
    487524msgstr "Wahl"
    488525
    489 #: wp-open-votomat.php:355
     526#: wp-open-votomat.php:383
    490527msgid "Add New Voting"
    491528msgstr "Neue Wahl hinzufügen"
    492529
    493 #: wp-open-votomat.php:356
     530#: wp-open-votomat.php:384
    494531msgid "Edit Voting"
    495532msgstr "Wahl bearbeiten"
    496533
    497 #: wp-open-votomat.php:357
     534#: wp-open-votomat.php:385
    498535msgid "New Voting"
    499536msgstr "Neue Wahl"
    500537
    501 #: wp-open-votomat.php:358
     538#: wp-open-votomat.php:386
    502539msgid "View Voting"
    503540msgstr "Wahl ansehen"
    504541
    505 #: wp-open-votomat.php:359
     542#: wp-open-votomat.php:387
    506543msgid "Search Votings"
    507544msgstr "Wahlen suchen"
    508545
    509 #: wp-open-votomat.php:360
     546#: wp-open-votomat.php:388
    510547msgid "No Votings found"
    511548msgstr "Keine Wahlen gefunden"
    512549
    513 #: wp-open-votomat.php:361
     550#: wp-open-votomat.php:389
    514551msgid "No Votings found in Trash"
    515552msgstr "Keine Wahlen im Papierkorb gefunden"
    516553
    517 #: wp-open-votomat.php:407
     554#: wp-open-votomat.php:435
    518555msgid "WP Open Votomat Sidebar"
    519556msgstr "WP Open Votomat Seitenspalte"
    520557
    521 #: wp-open-votomat.php:455
     558#: wp-open-votomat.php:483
    522559#, php-format
    523560msgid "Class »%s« exists!"
    524561msgstr "Klasse »%s« existiert!"
    525562
    526 #: wpov_template/twentynineteen/bower_components/moment/min/locales.min.js:1
    527 msgid "s"
    528 msgstr ""
    529 
    530 #: wpov_template/twentynineteen/bower_components/moment/min/locales.min.js:1
    531 msgid "m"
    532 msgstr ""
    533 
    534 #: wpov_template/twentynineteen/bower_components/moment/min/locales.min.js:1
    535 msgid "h"
    536 msgstr ""
    537 
    538 #: wpov_template/twentynineteen/bower_components/moment/min/locales.min.js:1
    539 msgid "d"
    540 msgstr ""
    541 
    542 #: wpov_template/twentynineteen/bower_components/moment/min/locales.min.js:1
    543 msgid "M"
    544 msgstr ""
    545 
    546 #: wpov_template/twentynineteen/bower_components/moment/min/locales.min.js:1
    547 msgid "y"
    548 msgstr ""
    549 
    550 #: wpov_template/twentynineteen/bower_components/moment/min/moment.min.js:1
    551 msgid ": "
    552 msgstr ""
    553 
    554563#: wpov_template/twentynineteen/page.php:48
    555564msgid "Voting is not published yet!"
  • wp-open-votomat/trunk/wp-open-votomat.php

    r2059019 r2060854  
    44 * Description: This plugin allows you to use your website as a voting advice application.
    55 * Author: Sebastian Tiede @ magma
    6  * Version: 0.0.5
     6 * Version: 0.0.6
    77 * Author URI: https://magmadesignstudio.de
    88 * Text Domain: wpov
     
    2828define( 'WPOV__PLUGIN_NAME_SLUG', 'wp-open-votomat' );
    2929
    30 define( 'WPOV_VERSION', '0.0.5' );
     30define( 'WPOV_VERSION', '0.0.6' );
    3131define( 'WPOV__MINIMUM_WP_VERSION', '4.0' );
    3232define( 'WPOV__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
     
    193193           
    194194            add_action( 'wp_enqueue_scripts', array($this, 'custom_assets'), 1000);
    195         }
     195            add_action( 'wp_ajax_wpov_reset_user_votings', array($this, 'ajax_reset_user_votings'));   
     196
     197        }
     198
     199        function ajax_reset_user_votings() {
     200                       
     201            if(empty($_POST['post_id']) or !is_object($voting = wpov_get_voting($_POST['post_id']))) {
     202                die(__('Post not found!', 'wpov'));
     203            }
     204           
     205            if(!current_user_can(wpov_get_setting('capability'))) {
     206                die(__('Not permitted!', 'wpov'));
     207            }
     208           
     209            $status = $voting->publication_status_array();
     210           
     211            if($status['time_to_start'] <= 0) {
     212                die(__('Not allowed!', 'wpov'));
     213            }
     214           
     215            if($post_ids = $voting->reset_user_votings()) {
     216                die(__(sprintf('%d user votings have been deleted!', count($post_ids)), 'wpov'));
     217            } else {
     218                die(__(sprintf('No user voting was deleted!', count($post_ids)), 'wpov'));
     219            }
     220                       
     221            wp_die();
     222        }       
     223       
    196224       
    197225        function custom_assets() {
  • wp-open-votomat/trunk/wpov_template/twentynineteen/page.php

    r2053270 r2060854  
    4545        } else {
    4646            $status = $voting->publication_status_array();
    47             if(!$status['is_live'] and !is_user_logged_in()) {
     47            if(!$status['is_live'] and !$status['keep_online'] and !is_user_logged_in()) {
    4848                $label = __('Voting is not published yet!', WPOV__PLUGIN_NAME_SLUG);
    4949                wp_die($label, $label, array('response' => 403));
  • wp-open-votomat/trunk/wpov_template/twentynineteen/twig/home.twig

    r2058867 r2060854  
    3636                {% endif %}
    3737                <p class="card-text">{{ post.the_content() }}</p>
    38                 {% if status.is_live or fn('is_user_logged_in') %}
     38                {% if status.is_live or status.keep_online or fn('is_user_logged_in') %}
    3939                <a href="{{ post.link() }}" class="btn btn-primary">Befragung starten</a>
    4040                {% endif %}
     
    4646
    4747    {% if admin_settings.sponsor %}
    48             {% if admin_settings.sponsors_section_title %}
    49                 <h3>{{ admin_settings.sponsors_section_title }}</h3>
    50             {% endif %}
    51             {% set row_start %}
    52             <div class="row">
    53             {% endset %}
     48    <div class="mt-5 mb-3">
     49        {% if admin_settings.sponsors_section_title %}
     50            <h3>{{ admin_settings.sponsors_section_title }}</h3>
     51        {% endif %}
     52        {% set row_start %}
     53        <div class="row">
     54        {% endset %}
    5455
    55             {% set row_end %}
    56             </div>                       
    57             {% endset %}
    58             {% for sponsor in admin_settings.sponsor %}
    59             {% if sponsor.seperator %}
    60                 {% if not loop.first %}{{ row_end }}{% endif %}
    61             <h4 class="w-100">{{ sponsor.seperator }}</h4>
    62                 {{ row_start }}
    63             {% elseif loop.first  %}
    64                 {% if not loop.first %}{{ row_end }}{% endif %}
    65                 {{ row_start }}
    66             {% endif %}
    67            
    68             {% set columns = sponsor.column_width ? sponsor.column_width : 1 %}
    69             {% set columns_medium = (columns*2) %}
    70             {% set columns_small = (columns*4) %}
    71            
    72             <div class="col-{{ columns_small }} col-sm-{{ columns_medium }}">
    73                 <a href="{{ sponsor.url }}" target="_blank">
    74                     {{ fn('wp_get_attachment_image', sponsor.logo_id, 'large', false, {
    75                         alt : sponsor.title,
    76                         class : 'img-fluid'
    77                     }) }}                   
    78                 </a>
    79             </div>
    80             {% endfor %}
    81             {{ row_end }}
     56        {% set row_end %}
     57        </div>                       
     58        {% endset %}
     59        {% for sponsor in admin_settings.sponsor %}
     60        {% if sponsor.seperator %}
     61            {% if not loop.first %}{{ row_end }}{% endif %}
     62        <h4 class="w-100">{{ sponsor.seperator }}</h4>
     63            {{ row_start }}
     64        {% elseif loop.first  %}
     65            {% if not loop.first %}{{ row_end }}{% endif %}
     66            {{ row_start }}
     67        {% endif %}
     68
     69        {% set columns = sponsor.column_width ? sponsor.column_width : 1 %}
     70        {% set columns_medium = (columns*2) %}
     71        {% set columns_small = (columns*4) %}
     72
     73        <div class="col-{{ columns_small }} col-sm-{{ columns_medium }}">
     74            <a href="{{ sponsor.url }}" target="_blank">
     75                {{ fn('wp_get_attachment_image', sponsor.logo_id, 'large', false, {
     76                    alt : sponsor.title,
     77                    class : 'img-fluid'
     78                }) }}                   
     79            </a>
     80        </div>
     81        {% endfor %}
     82        {{ row_end }}
     83    </div>
    8284    {% endif %}
    8385
Note: See TracChangeset for help on using the changeset viewer.