Plugin Directory

Changeset 2275530


Ignore:
Timestamp:
04/03/2020 11:03:49 PM (6 years ago)
Author:
Knighthawk
Message:

Update:
added "any" as default internal role/permission

Location:
vi-member-content/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • vi-member-content/trunk/readme.txt

    r2228618 r2275530  
    55Requires at least: ?
    66Tested up to: 5.3
    7 Version: 9.1.200115
     7Version: 9.1.200310
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl.html
     
    1717Content separated by user role/ability
    1818
    19 See Installation for a list of Shortcodes
    20 
     19https://wordpress.org/plugins/vi-member-content/
    2120
    2221== Installation ==
     
    5352
    5453= 9.1.200115 =
     54* Update: default logged in value is not a predefined role or capability
     55* "any" is used internally to note "any" logged in user when no role or capability is specified
     56
     57= 9.1.200115 =
    5558* Fixed bug: potential for empty string in foreach
    5659* Edit: moved check if $content is null earlier to skip doing extra work
  • vi-member-content/trunk/vi_member_content.php

    r2228618 r2275530  
    44Plugin URI: https://neathawk.com/2019/plugin-member-content/
    55Description: A collection of generic functions that separate content by visitor/member/ member of type
    6 Version: 9.1.200115
     6Version: 9.1.200310
    77Author: Joseph Neathawk
    88Author URI: http://Neathawk.com
     
    3535
    3636    /**
    37      * display content to logged OUT users only
     37     * find if user has the given role
    3838     *
    39      * return only boolean, let no secure data escape like an array of all the roles
     39     * return only boolean, let no secure data escape ie: an array of all the roles
    4040     *
    4141     * @link https://wordpress.stackexchange.com/questions/5047/how-to-check-if-a-user-is-in-a-specific-role
     
    7878            $content = '';
    7979        }
     80
     81        //finally do any shortcodes on the content
     82        //in an effort to play nice with other plugins
     83        //also works with this plugin's nested shortcodes
    8084        return do_shortcode($content);
    8185    }
     
    97101        if ( !is_null( $content ) )
    98102        {
    99             extract( shortcode_atts( array( 'type' => 'read' ), $attr ) );
     103            //default value for all logged in users
     104            extract( shortcode_atts( array( 'type' => 'any' ), $attr ) );
    100105            //remove spaces
    101106            $type = str_replace(" ", "", $type);
     
    103108
    104109            //make absolutely sure $ability isn't empty
     110            //reset the default if it is
    105111            if( !is_array($ability) )
    106112            {
    107                 $ability[] = 'read';
     113                $ability[] = 'any';
    108114            }
    109115
     
    134140        }
    135141
     142        //finally do any shortcodes on the content
     143        //in an effort to play nice with other plugins
     144        //also works with this plugin's nested shortcodes
    136145        return do_shortcode($content);
    137146    }
Note: See TracChangeset for help on using the changeset viewer.