WordPress.org

Plugin Directory

Changeset 761944


Ignore:
Timestamp:
08/25/13 09:52:03 (8 months ago)
Author:
eskapism
Message:

deploy from git

Location:
ep-admin-messages/trunk
Files:
1 added
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • ep-admin-messages/trunk/ep-admin-messages.class.php

    r761226 r761944  
    3131        // If current screen is showing a post then get the post 
    3232        if ( "post" === $current_screen->base ) { 
    33              
    3433             
    3534            // Get post type and possibly post name 
     
    5453             
    5554                // Get settings for message 
     55 
    5656                $locations = array(); 
    5757                if (! empty($one_message->location) ) 
     
    6565                if (! empty($one_message->capability) ) 
    6666                    $capabilities = $this->get_array_from_string( $one_message->capability ); 
     67 
     68                $user_ids = array(); 
     69                if (! empty($one_message->user_id) ) 
     70                    $user_ids = $this->get_array_from_string( $one_message->user_id ); 
     71 
     72                $usernames = array(); 
     73                if (! empty($one_message->username) ) 
     74                    $usernames = $this->get_array_from_string( $one_message->username ); 
    6775 
    6876                // Detect language 
     
    220228                    if ( ! $do_show_post_slug ) 
    221229                        $do_show = false; 
     230 
     231                } 
     232 
     233                // If user_id is set then show only to users with that id 
     234                if ( ! empty( $user_ids ) ) { 
     235                     
     236                    $do_show_user = false; 
     237 
     238                    $current_user = wp_get_current_user(); 
     239                    if ( in_array( $current_user->ID, $user_ids ) ) 
     240                        $do_show_user = true; 
     241 
     242                    if ( ! $do_show_user ) 
     243                        $do_show = false; 
     244 
     245                } 
     246 
     247                // If username is set then only show to user with that username 
     248                if ( ! empty( $usernames ) ) { 
     249 
     250                    $do_show_user = false; 
     251 
     252                    $current_user = wp_get_current_user(); 
     253                    if ( in_array( $current_user->data->user_login, $usernames ) ) 
     254                        $do_show_user = true; 
     255 
     256                    if ( ! $do_show_user ) 
     257                        $do_show = false; 
     258 
    222259 
    223260                } 
  • ep-admin-messages/trunk/ep-admin-messages.php

    r761226 r761944  
    44Plugin URI: http://earthpeople.se/ 
    55Description: Show custom messages in the admin area 
    6 Version: 0.1.1 
     6Version: 0.1.2 
    77Author: Earth People 
    88Author URI: http://earthpeople.se/ 
  • ep-admin-messages/trunk/readme.txt

    r761291 r761944  
    77Requires at least: 3.6 
    88Tested up to: 3.6 
    9 Stable tag: 0.1.1 
     9Stable tag: 0.1.2 
    1010 
    1111Show messages in WP Admin. Different messages can be shown at different places, for different people. 
     
    5353 
    5454 
    55 = Config file uses JSON = 
     55= JSON-based config file = 
    5656 
    57 All settings are configured with a config file that uses JSON and that you put in the themes directory. 
     57All settings are configured with a config file ([view example config](https://github.com/EarthPeople/ep-admin-messages/blob/master/ep-config-example.json)) that uses JSON and that you put in the themes directory. 
    5858 
    5959This means that there are no settings for the user to change. This also means that you can add messages using your regular deploy method. Just upload an updated config file and you're done. No database syncing needed; hooray! 
     
    101101== Changelog == 
    102102 
     103= 0.1.2 = 
     104 
     105* Added support for limiting messages to users based on their ID or their username. 
     106 
    103107= 0.1.1 = 
    104108 
Note: See TracChangeset for help on using the changeset viewer.