Plugin Directory

Changeset 1971507


Ignore:
Timestamp:
11/09/2018 11:29:49 AM (7 years ago)
Author:
franciscopalacios
Message:

version 1.9.5

Location:
postem-ipsum/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • postem-ipsum/trunk/README.txt

    r1971430 r1971507  
    1616
    1717
    18 - Select post type, taxonomy, term.
     18- Select post type, taxonomy, term. Author can be selected or random.
    1919- Chosse number to posts or pages to create.
    2020- Paragraph long, ul, ol, and so on.
     
    4242
    4343== Changelog ==
     44= 1.9.5 =
     45* Select author/random author
    4446= 1.9.4.1 =
    4547* Hide terms when Pages or none is selected
  • postem-ipsum/trunk/admin/assets/js/postem_ipsum_admin_main.js

    r1971430 r1971507  
    99    var time = 2000;
    1010    var cat_random = 0;
     11    var author_random = 0;
    1112    var bg_random = 0;
    1213    var price_min = document.getElementById('price_slider-padding-value-min'),
     
    182183
    183184            cat_random = 0;
     185        }
     186    });
     187
     188    // Elegimos author aletatoria?
     189    $(document).on("change", "#author_random", function () {
     190
     191        if ($('input[name="author_random"]').is(':checked')) {
     192
     193            $("#postem_ipsum_author").prop("disabled", true);
     194
     195            author_random = 1;
     196        } else {
     197
     198            $("#postem_ipsum_author").prop("disabled", false);
     199
     200            author_random = 0;
    184201        }
    185202    });
     
    274291        if (
    275292            $("#postem_ipsum_post_type").val() != "0" &&
    276             //$("#postem_ipsum_taxonomy").val() != "0" &&
    277             //$("#postem_ipsum_term").val() != "0" &&
    278293            $("#postem_ipsum_post_number").val() != "" &&
    279294            $("#postem_ipsum_paragraphs").val() != "") {
     
    295310                    bg_random: bg_random,
    296311                    cat_random: cat_random,
     312                    author_random: author_random,
    297313                    postem_ipsum_term: terms,
    298314                })
  • postem-ipsum/trunk/admin/postem-ipsum-admin.php

    r1971430 r1971507  
    131131    public function postem_ipsum_general_settings() {
    132132
    133         // Testing metaboxes
    134 
    135 
    136 
     133        // Testing metaboxes
     134        // Authors
     135        $args = array(
     136            'blog_id'     => $GLOBALS['blog_id'],
     137            'orderby'     => 'login',
     138            'order'       => 'ASC',
     139            'offset'      => '',
     140            'search'      => '',
     141            'number'      => '',
     142            'count_total' => false,
     143            'fields'      => array( 'ID', 'display_name' ),
     144            'who'         => 'autrhor',
     145        );
     146
     147        $authors = get_users( $args );
    137148
    138149        $args_post_types = array(
     
    318329            $taxonomy         = isset( $variables['postem_ipsum_taxonomy'] ) ? sanitize_text_field( $variables['postem_ipsum_taxonomy'] ) : "";
    319330
     331            $author_random = isset( $_POST["author_random"] ) ? sanitize_text_field( $_POST["author_random"] ) : "0";
     332            $author        = isset( $variables['postem_ipsum_author'] ) ? sanitize_text_field( $variables['postem_ipsum_author'] ) : "";
     333
    320334
    321335            // Cogemos todas las categorias por si queremos coger una aleatoria
     
    326340            $categories        = get_terms( $args );
    327341            $categories_number = sizeof( $categories );
     342
     343
     344            // Authors if we choose random
     345            $args = array(
     346                'blog_id'     => $GLOBALS['blog_id'],
     347                'orderby'     => 'login',
     348                'order'       => 'ASC',
     349                'offset'      => '',
     350                'search'      => '',
     351                'number'      => '',
     352                'count_total' => false,
     353                'fields'      => array( 'ID', 'display_name' ),
     354                'who'         => 'autrhor',
     355            );
     356
     357            $authors        = get_users( $args );
     358            $authors_number = sizeof( $authors );
    328359
    329360
     
    363394                }
    364395
     396                // The author
     397                if ( $author_random == "1" ) {
     398
     399                    $author = $authors[ rand( 0, $authors_number - 1 ) ]->ID;
     400
     401                } else {
     402
     403                    if ( $author != "" && sizeof( $authors ) != 0 ) {
     404
     405
     406                    }
     407                }
     408
    365409
    366410                $title                 = $this->postem_ipsum_truncate_words( $title_text, 10 );
     
    379423                        'post_content' => $data,
    380424                        'post_status'  => 'publish',
     425                        'post_author'  => $author,
    381426                        'post_excerpt' => sanitize_textarea_field( $short_description ),
    382427                    ) );
     
    671716
    672717                        foreach ( $terms as $term ) {
    673                            
     718
    674719                        }
    675 
    676720
    677721
  • postem-ipsum/trunk/admin/views/postem_ipsum_settings.php

    r1969026 r1971507  
    5353                            </td>
    5454                        </tr>
     55
     56                        <tr>
     57                            <th scope="row"><?php _e( 'Select Author', POSTEM_IPSUM_TEXT_DOMAIN ); ?></th>
     58                            <td>
     59                                <label><?php _e( "Random", POSTEM_IPSUM_TEXT_DOMAIN ); ?>: </label>
     60                                <input type="checkbox" name="author_random" id="author_random">
     61                                <select name="postem_ipsum_author" id="postem_ipsum_author">
     62                                    <option value="0"
     63                                            selected><?php _e( 'Select an author', POSTEM_IPSUM_TEXT_DOMAIN ); ?></option>
     64                                    <?php foreach($authors as $author):?>
     65                                    <option value="<?php echo $author->ID;?>"
     66                                            selected><?php echo $author->display_name; ?></option>
     67                                    <?php endforeach;?>
     68                                </select>
     69                            </td>
     70                        </tr>
     71
    5572                        <tr>
    5673                            <th scope="row"><?php _e( 'How many posts', POSTEM_IPSUM_TEXT_DOMAIN ); ?></th>
  • postem-ipsum/trunk/postem-ipsum.php

    r1971430 r1971507  
    44 * Plugin URI:
    55 * Description:       Plugin to create some random posts from scratch
    6  * Version:           1.9.4.1
     6 * Version:           1.9.5
    77 * Author:            Fco Palacios
    88 * Author URI:
Note: See TracChangeset for help on using the changeset viewer.