Plugin Directory

Changeset 1914880


Ignore:
Timestamp:
07/25/2018 03:46:53 PM (8 years ago)
Author:
webmasterjunkie
Message:

Adding visibility restriction

Location:
ultimate-popunder/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ultimate-popunder/trunk/functions.php

    r1747546 r1914880  
    4949    $popLength = isset( $options['ultimate_popunder_text_poplength'] ) ? intval( $options['ultimate_popunder_text_poplength'] ) : 30;
    5050    $popMax = isset( $options['ultimate_popunder_text_popmax'] ) ? intval( $options['ultimate_popunder_text_popmax'] ) : 1;
     51
     52
    5153
    5254    $sql = "
     
    6668        {
    6769            $post_meta = get_post_meta( $obj_post->post_id );
    68             $content .= "[\"{$post_meta['_popunder_url'][0]}\", {$post_meta['_popunder_priority'][0]}],";
     70
     71            // Show it to everyone
     72            if ($post_meta['_popunder_post_visible'][0] == '*')
     73            {
     74                $content .= "[\"{$post_meta['_popunder_url'][0]}\", {$post_meta['_popunder_priority'][0]}],";
     75            }
     76
     77            // Show it to only those not logged in
     78            if ($post_meta['_popunder_post_visible'][0] == 'guest' && ! is_user_logged_in())
     79            {
     80                $content .= "[\"{$post_meta['_popunder_url'][0]}\", {$post_meta['_popunder_priority'][0]}],";
     81            }
     82
     83            // Show it to only those logged in
     84            if ($post_meta['_popunder_post_visible'][0] == 'member' && is_user_logged_in())
     85            {
     86                $content .= "[\"{$post_meta['_popunder_url'][0]}\", {$post_meta['_popunder_priority'][0]}],";
     87            }
    6988        }
    7089        $content .= "];";
     
    204223            update_post_meta( $post_id, '_popunder_post_type', sanitize_text_field( $_POST['_popunder_post_type'] ) );
    205224
     225        if( isset( $_POST['_popunder_post_visible'] ) )
     226            update_post_meta( $post_id, '_popunder_post_visible', sanitize_text_field( $_POST['_popunder_post_visible'] ) );
     227
    206228        if( isset( $_POST['_popunder_priority'] ) )
    207229            update_post_meta( $post_id, '_popunder_priority', intval( $_POST['_popunder_priority'] ) );
     
    222244    $pop_post_type = isset( $values['_popunder_post_type'] ) ? esc_attr( $values['_popunder_post_type'][0] ) : '';
    223245    $pop_priority = isset( $values['_popunder_priority'] ) ? esc_attr( $values['_popunder_priority'][0] ) : '10';
     246    $pop_visibility = isset( $values['_popunder_post_visible'] ) ? esc_attr( $values['_popunder_post_visible'][0] ) : '*';
    224247
    225248    wp_nonce_field( 'popunder_meta_box_nonce', 'popunder_post_meta_nonce' );
     
    235258                <th style="text-align:left;"><label for="_popunder_url">URL</label></th>
    236259                <th style="text-align:left;"><label for="_popunder_post_type">Post Type</label></th>
     260                <th style="text-align:left;"><label for="_popunder_post_visible">Visibility</label></th>
    237261                <th style="text-align:left;"><label for="_popunder_priority">Priority</label></th>
    238262            </tr>
     
    241265        <tbody>
    242266            <tr>
    243                 <td style="width:75%;padding-right:10px">
     267                <td style="width:55%;padding-right:10px">
    244268                    <input class="regular-text code" style="width:100%;" type="text" name="_popunder_url" id="_popunder_url" value="<?php echo $pop_url; ?>" />
    245269                </td>
     
    265289                </td>
    266290                <td style="width:15%;padding-right:10px">
     291                    <select name="_popunder_post_visible" id="_popunder_post_visible" style="width:100%;">
     292                        <option value="*"<?php if ($pop_visibility === "*") echo ' selected="selected"'; ?>>everyone</option>
     293                        <?php
     294                        $arr_visible_users = ['guest','member'];
     295                        foreach ($arr_visible_users as $str_user_type)
     296                        {
     297                            if ($str_user_type === $pop_visibility)
     298                            {
     299                                ?><option value="<?php echo $str_user_type; ?>" selected="selected"><?php echo $str_user_type; ?></option><?php
     300                            }
     301                            else
     302                            {
     303                                ?><option value="<?php echo $str_user_type; ?>"><?php echo $str_user_type; ?></option><?php
     304                            }
     305                        }
     306                        ?>
     307                    </select>
     308                </td>
     309                <td style="width:15%;padding-right:10px">
    267310                    <input style="width:100%;" type="number" name="_popunder_priority" id="_popunder_priority" onkeypress="return event.charCode >= 48 && event.charCode <= 57" value="<?php echo $pop_priority; ?>" />
    268311                </td>
  • ultimate-popunder/trunk/readme.txt

    r1776494 r1914880  
    44Donate link: paypal.me/GriffithDesignsMD
    55Requires at least: 4.0
    6 Tested up to: 4.9
     6Tested up to: 4.9.7
    77Stable tag: trunk
    88License: GPLv2 or later
     
    3434
    3535== Changelog ==
     36= 1.2.5 =
     37* Added ability to restrict popunder to the user's state:
     38  * everyone
     39  * not logged in (guest)
     40  * logged in (member)
     41
    3642= 1.2.4 =
    3743* Fix Content Closure
  • ultimate-popunder/trunk/ultimate-popunder.php

    r1747546 r1914880  
    55    Plugin URI: #
    66    Description: Be able to create any popunder AD for your site, and track the activity in 3rd party systems as well.
    7     Version: 1.2.4
     7    Version: 1.2.5
    88    Author: Cris Griffith
    99    Author URI: https://profiles.wordpress.org/webmasterjunkie
     
    1313defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
    1414
    15 define( 'ULTIMATE_POPUNDER_VERSION', '1.2.4' );
     15define( 'ULTIMATE_POPUNDER_VERSION', '1.2.5' );
    1616
    1717require_once( plugin_dir_path( __FILE__ ) . "functions.php" );
Note: See TracChangeset for help on using the changeset viewer.