Plugin Directory

Changeset 3096344


Ignore:
Timestamp:
06/02/2024 04:17:46 PM (20 months ago)
Author:
Hakik
Message:

v1.1.4: Settings UI update, instant update the selected image for background and logo, Updated the script

Location:
ideal-wp-login-logo-changer
Files:
10 added
3 edited

Legend:

Unmodified
Added
Removed
  • ideal-wp-login-logo-changer/trunk/admin/backend.js

    r2898156 r3096344  
    3434
    3535        // Image Popup Function
     36        var frame;
    3637        $('[id=iwllc-upload-btn]').click(function(e) {
    3738            e.preventDefault();
     39
    3840            var btn = $(this);
    39             var image = wp.media({
    40                 title: 'Upload Logo',
     41
     42            // If the media frame already exists, reopen it.
     43            if ( frame ) {
     44              frame.open();
     45              return;
     46            }
     47            // Create a new media frame
     48            var frame = wp.media({
     49                title: btn.hasClass('iwllc-logo') ? 'Upload Logo' : 'Upload Background',
    4150                multiple: false
    42             }).open()
    43             .on('select', function(e){
    44                 var uploaded_image = image.state().get('selection').first();
    45                 console.log(uploaded_image);
     51            });
     52            // When an image is selected in the media frame...
     53            frame.on('select', function(e){
     54                var uploaded_image = frame.state().get('selection').first();
     55                // console.log(uploaded_image);
    4656                var image_url = uploaded_image.toJSON().url;
    4757                btn.closest('td').find('input[type=text]').val(image_url);
     58                // Instant replace image src to display selected logo
     59                if( btn.hasClass('iwllc-logo') ){
     60                    $('.iwllc_current_logo').attr( 'src', image_url );
     61                }
     62                // Instant replace background img src to display selected background img
     63                if( btn.hasClass('iwllc-bg') ){
     64                    $('.iwllc_current_bg').attr( 'src', image_url );
     65                }
    4866            });
     67            // Finally, open the modal on click
     68            frame.open();
    4969        });
    5070
  • ideal-wp-login-logo-changer/trunk/ideal-wp-login-logo-changer.php

    r3074587 r3096344  
    33Plugin Name: Custom Login Logo
    44description: Change the default WordPress logo by uploading your site logo for the login page.
    5 Version: 1.1.3
     5Version: 1.1.4
    66Author: Hakik Zaman
    77Author URI: https://github.com/hakikz
     
    2323
    2424/*Defining Constant*/
    25 define("IWLLC_VERSION", '1.1.3');
     25define("IWLLC_VERSION", '1.1.4');
    2626
    2727/*Add body class for options page*/
     
    107107                    <th>Current Logo</th>
    108108                    <td>
    109                         <img src="<?php echo esc_attr( get_option('iwllc_wp_logo_url') ); ?>" alt="Current Logo" width="220">
     109                        <img class="iwllc_current_logo" src="<?php echo esc_url( get_option('iwllc_wp_logo_url') ); ?>" alt="<?php echo esc_html__( 'Current Logo', 'ideal-wp-login-logo-changer' ) ?>" width="220">
    110110                    </td>
    111111                </tr>
     
    116116                    <td>
    117117                        <input type="text" id="iwllc_wp_logo_url" name="iwllc_wp_logo_url" value="<?php echo esc_attr( get_option('iwllc_wp_logo_url') ); ?>" />
    118                         <input type="button" name="iwllc-upload-btn" id="iwllc-upload-btn" class="button-secondary" value="Upload Logo">
     118                        <input type="button" name="iwllc-upload-btn" id="iwllc-upload-btn" class="button-secondary iwllc-logo" value="<?php echo esc_html__( 'Upload Logo', 'ideal-wp-login-logo-changer' ) ?>">
    119119                        <p class="description"><i><?php echo esc_html__( 'This Image will be displayed in Login Page', 'ideal-wp-login-logo-changer' ) ?></i></p>
    120120                    </td>
     
    148148                    <th>Current Background Image</th>
    149149                    <td>
    150                         <img src="<?php echo esc_attr( get_option('iwllc_wp_bg_img_url') ); ?>" alt="Current Background Image" width="220">
     150                        <img class="iwllc_current_bg" src="<?php echo esc_url( get_option('iwllc_wp_bg_img_url') ); ?>" alt="Current Background Image" width="220">
    151151                    </td>
    152152                </tr>
     
    158158                    <td>
    159159                        <input type="text" id="iwllc_wp_bg_img_url" name="iwllc_wp_bg_img_url" value="<?php echo esc_attr( get_option('iwllc_wp_bg_img_url') ); ?>" />
    160                         <input type="button" name="iwllc-upload-btn" id="iwllc-upload-btn" class="button-secondary" value="Upload Logo">
    161                         <p class="description"><i><?php echo esc_html__( 'This Image will be displayed as background image of Login Page' ) ?></i></p>
     160                        <input type="button" name="iwllc-upload-btn" id="iwllc-upload-btn" class="button-secondary iwllc-bg" value="<?php echo esc_html__( 'Upload Background', 'ideal-wp-login-logo-changer' ) ?>">
     161                        <p class="description"><i><?php echo esc_html__( 'This Image will be displayed as background image of Login Page', 'ideal-wp-login-logo-changer' ) ?></i></p>
    162162                    </td>
    163163                </tr>
     
    168168                    <td>
    169169                        <input type="url" id="iwllc_wp_logo_link" name="iwllc_wp_logo_link" value="<?php echo esc_attr( get_option('iwllc_wp_logo_link') ); ?>" />
    170                         <p class="description"><i><?php echo esc_html__( 'Set your desired link, to redirect after clicking on your logo' ) ?></i></p>
     170                        <p class="description"><i><?php echo esc_html__( 'Set your desired link, to redirect after clicking on your logo', 'ideal-wp-login-logo-changer' ) ?></i></p>
    171171                    </td>
    172172                </tr>
     
    177177                    <td>
    178178                        <input type="text" name="iwllc_wp_logo_width" value="<?php echo esc_attr( get_option('iwllc_wp_logo_width') ); ?>" />
    179                         <p class="description"><i><?php echo esc_html__( 'Default width is 100%' ) ?></i></p>
     179                        <p class="description"><i><?php echo esc_html__( 'Default width is 100%', 'ideal-wp-login-logo-changer' ) ?></i></p>
    180180                    </td>
    181181                </tr>
  • ideal-wp-login-logo-changer/trunk/readme.txt

    r3074587 r3096344  
    55Tested up to: 6.5
    66Requires PHP: 5.2.4
    7 Stable tag: 1.1.3
     7Stable tag: 1.1.4
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    2323👉 By default, the login logo will not redirect to wordpress.org rather than redirect to your site.
    2424👉 You can redirect anywhere after clicking on your site logo (if you set a link).
    25 👉 You can check current logo right after save your settings on plugin setting page.
     25👉 You can check current logo right after saving your settings on plugin setting page.
    2626
    2727== How does the Custom Login Logo For WordPress work: ==
     
    6262== Changelog ==
    6363
     64= 1.1.4 [02-06-2024] =
     65* Enhancement: Settings UI. Now, it will display the selected image (with current logo/background image) right after selecting an image.
     66* Update: Script Update.
     67
    6468= 1.1.3 [21-04-2024] =
    6569* Security: Whole codebase using PCP (Plugin Check Plugin).
Note: See TracChangeset for help on using the changeset viewer.