Plugin Directory

Changeset 2579017


Ignore:
Timestamp:
08/05/2021 11:35:58 PM (5 years ago)
Author:
themolitor
Message:

1.0.6 - bug fixes

Location:
wayfinder
Files:
6 added
3 edited

Legend:

Unmodified
Added
Removed
  • wayfinder/trunk/index.php

    r2578337 r2579017  
    44 * Plugin URI: https://wordpress.org/plugins/wayfinder
    55 * Description: Easily select and identify nested blocks in the editor.
    6  * Version: 1.0.5
     6 * Version: 1.0.6
    77 * Author: THE MOLITOR
    88 * Author URI: https://themolitor.com
     
    1010*/
    1111
    12 $wayfinder_version = '1.0.5';
     12$wayfinder_version = '1.0.6';
    1313
    1414
     
    169169    $wayfinder = new Wayfinder();
    170170}
     171
     172//USER PROFILE SETTINGS
     173add_action( 'show_user_profile', 'wayfinder_profile_fields' );
     174add_action( 'edit_user_profile', 'wayfinder_profile_fields' );
     175
     176function wayfinder_profile_fields( $user ) {
     177   
     178    $selected_option = 'selected="selected"';
     179   
     180    $user_block_type = get_the_author_meta( 'userblocktype', $user->ID );
     181    $user_block_classes = get_the_author_meta( 'userblockclasses', $user->ID );
     182    $user_block_outline = get_the_author_meta( 'userblockoutline', $user->ID );
     183    $user_spacer_outline = get_the_author_meta( 'userspaceroutline', $user->ID );
     184
     185    echo '<br /><h3>Wayfinder Settings</h3>'.$user_block_type.
     186
     187    '<table class="form-table">'.
     188
     189        //TYPE
     190        '<tr>'.
     191            '<th><label for="userblocktype">'.__('Block type','wayfinder').'</label></th>'.
     192
     193            '<td>'.
     194                '<select type="text" name="userblocktype" id="userblocktype">';?>
     195                    <option value="site-default" <?php if($user_block_type == 'site-default' || !$user_block_type){ echo $selected_option;} ?>><?php _e('Site Default','Wayfinder');?></option>
     196                    <option value="show" <?php if($user_block_type == 'show'){ echo $selected_option;} ?>><?php _e('Show','Wayfinder');?></option>
     197                    <option value="hide" <?php if($user_block_type == 'hide'){ echo $selected_option;} ?>><?php _e('Hide','Wayfinder');?></option>
     198                <?php echo '</select>'.
     199            '</td>'.
     200        '</tr>'.
     201       
     202        //CLASSES
     203        '<tr>'.
     204            '<th><label for="userblockclasses">'.__('Block classes','wayfinder').'</label></th>'.
     205
     206            '<td>'.
     207                '<select type="text" name="userblockclasses" id="userblockclasses">';?>
     208                    <option value="site-default" <?php if($user_block_classes == 'site-default' || !$user_block_classes){ echo $selected_option;} ?>><?php _e('Site Default','Wayfinder');?></option>
     209                    <option value="show" <?php if($user_block_classes == 'show'){ echo $selected_option;} ?>><?php _e('Show','Wayfinder');?></option>
     210                    <option value="hide" <?php if($user_block_classes == 'hide'){ echo $selected_option;} ?>><?php _e('Hide','Wayfinder');?></option>
     211                <?php echo '</select>'.
     212            '</td>'.
     213        '</tr>'.
     214       
     215        //OUTLINE
     216        '<tr>'.
     217            '<th><label for="userblockoutline">'.__('Block outline','wayfinder').'</label></th>'.
     218
     219            '<td>'.
     220                '<select type="text" name="userblockoutline" id="userblockoutline">';?>
     221                    <option value="site-default" <?php if($user_block_outline == 'site-default' || !$user_block_outline){ echo $selected_option;} ?>><?php _e('Site Default','Wayfinder');?></option>
     222                    <option value="show" <?php if($user_block_outline == 'show'){ echo $selected_option;} ?>><?php _e('Show','Wayfinder');?></option>
     223                    <option value="hide" <?php if($user_block_outline == 'hide'){ echo $selected_option;} ?>><?php _e('Hide','Wayfinder');?></option>
     224                <?php echo '</select>'.
     225            '</td>'.
     226        '</tr>'.
     227       
     228        //SPACER OUTLINE
     229        '<tr>'.
     230            '<th><label for="userspaceroutline">'.__('Spacer outline','wayfinder').'</label></th>'.
     231
     232            '<td>'.
     233                '<select type="text" name="userspaceroutline" id="userspaceroutline">';?>
     234                    <option value="site-default" <?php if($user_spacer_outline == 'site-default' || !$user_spacer_outline){ echo $selected_option;} ?>><?php _e('Site Default','Wayfinder');?></option>
     235                    <option value="show" <?php if($user_spacer_outline == 'show'){ echo $selected_option;} ?>><?php _e('Show','Wayfinder');?></option>
     236                    <option value="hide" <?php if($user_spacer_outline == 'hide'){ echo $selected_option;} ?>><?php _e('Hide','Wayfinder');?></option>
     237                <?php echo '</select>'.
     238            '</td>'.
     239        '</tr>'.
     240
     241    '</table><br />';
     242}
     243
     244//SAVE USER PROFILE SETTINGS
     245add_action( 'personal_options_update', 'wayfinder_save_profile_fields' );
     246add_action( 'edit_user_profile_update', 'wayfinder_save_profile_fields' );
     247
     248function wayfinder_save_profile_fields( $user_id ) {
     249
     250    if ( !current_user_can( 'edit_user', $user_id ) )
     251        return false;
     252
     253    update_usermeta( $user_id, 'userblocktype', $_POST['userblocktype'] );
     254    update_usermeta( $user_id, 'userblockclasses', $_POST['userblockclasses'] );
     255    update_usermeta( $user_id, 'userblockoutline', $_POST['userblockoutline'] );
     256    update_usermeta( $user_id, 'userspaceroutline', $_POST['userspaceroutline'] );
     257}
     258
    171259   
    172260//ADD WAYFINDER CLASSES TO ADMIN BODY TAG
     
    174262function custom_admin_body_class( $classes ) {
    175263   
    176     //GET VALUES
     264    //SITE DEFAULTS
    177265    $wayfinder_options = get_option( 'wayfinder_option_name' );
    178     $display_block_title_0 = isset($wayfinder_options['display_block_title_0'])
    179         ? ' wayfinder-title '
    180         : '';
    181     $display_block_classes_1 = isset($wayfinder_options['display_block_classes_1'])
    182         ? ' wayfinder-classes '
    183         : '';
    184     $display_block_outline_2 = isset($wayfinder_options['display_block_outline_2'])
    185         ? ' wayfinder-outline '
    186         : '';
    187     $display_spacer_outline_3 = isset($wayfinder_options['display_spacer_outline_3'])
    188         ? ' wayfinder-spacer-outline '
    189         : '';
     266   
     267    //USER SETTINGS
     268    $current_user_id = get_current_user_id();
     269    $user_block_type = get_the_author_meta( 'userblocktype', $current_user_id );
     270        if($user_block_type == 'show'){
     271            $display_block_title_0 = ' wayfinder-title ';
     272        } else if($user_block_type == 'hide'){
     273            $display_block_title_0 = '';
     274        } else {
     275            $display_block_title_0 = isset($wayfinder_options['display_block_title_0'])
     276                ? ' wayfinder-title '
     277                : '';
     278        }
     279    $user_block_classes = get_the_author_meta( 'userblockclasses', $current_user_id );
     280        if($user_block_classes == 'show'){
     281            $display_block_classes_1 = ' wayfinder-classes ';
     282        } else if($user_block_classes == 'hide'){
     283            $display_block_classes_1 = '';
     284        } else {
     285            $display_block_classes_1 = isset($wayfinder_options['display_block_classes_1'])
     286                ? ' wayfinder-classes '
     287                : '';
     288        }
     289    $user_block_outline = get_the_author_meta( 'userblockoutline', $current_user_id );
     290        if($user_block_outline == 'show'){
     291            $display_block_outline_2 = ' wayfinder-outline ';
     292        } else if($user_block_outline == 'hide'){
     293            $display_block_outline_2 = '';
     294        } else {
     295            $display_block_outline_2 = isset($wayfinder_options['display_block_outline_2'])
     296                ? ' wayfinder-outline '
     297                : '';
     298        }
     299    $user_spacer_outline = get_the_author_meta( 'userspaceroutline', $current_user_id );
     300        if($user_spacer_outline == 'show'){
     301            $display_spacer_outline_3 = ' wayfinder-spacer-outline ';
     302        } else if($user_spacer_outline == 'hide'){
     303            $display_spacer_outline_3 = '';
     304        } else {
     305            $display_spacer_outline_3 = isset($wayfinder_options['display_spacer_outline_3'])
     306                ? ' wayfinder-spacer-outline '
     307                : '';
     308        }
     309       
    190310    $wayfinder_classses = $display_block_title_0.$display_block_classes_1.$display_block_outline_2.$display_spacer_outline_3;
    191311   
  • wayfinder/trunk/readme.txt

    r2578337 r2579017  
    44Requires at least: 4.7
    55Tested up to: 5.7
    6 Stable tag: 1.0.5
     6Stable tag: 1.0.6
    77Requires PHP: 5.6
    88License: GPLv2 or later
     
    5252== Changelog ==
    5353
     54= 1.0.6 =
     55
     56* Bug fixes.
     57
     58
    5459= 1.0.5 =
    5560
  • wayfinder/trunk/wayfinder.pot

    r2567498 r2579017  
    1919msgid "Display spacer outline"
    2020msgstr ""
     21
     22#: index.php:191
     23msgid "Block type"
     24msgstr ""
     25
     26#: index.php:191
     27msgid "Block type"
     28msgstr ""
     29
     30#: index.php:204
     31msgid "Block classes"
     32msgstr ""
     33
     34#: index.php:217
     35msgid "Block outline"
     36msgstr ""
     37
     38#: index.php:230
     39msgid "Spacer outline"
     40msgstr ""
     41
     42
     43#: index.php:195 index.php:208 index.php:221 index.php:234
     44msgid "Site Default"
     45msgstr ""
     46
     47#: index.php:196 index.php:209 index.php:222 index.php:235
     48msgid "Show"
     49msgstr ""
     50
     51#: index.php:197 index.php:210 index.php:223 index.php:236
     52msgid "Hide"
     53msgstr ""
Note: See TracChangeset for help on using the changeset viewer.