Plugin Directory

Changeset 1956786


Ignore:
Timestamp:
10/15/2018 10:26:03 AM (7 years ago)
Author:
frankschrijvers
Message:

1.2.6 fixes 500 error on switch to none genesis theme, tweak login urls

Location:
wpstudio-login-modal-box/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • wpstudio-login-modal-box/trunk/genesis-login-modal-box.php

    r1844266 r1956786  
    44 * Plugin URI: https://wpstud.io/plugins
    55 * Description: Login modal box
    6  * Version: 1.2.3
     6 * Version: 1.2.4
    77 * Author: Frank Schrijvers
    88 * Author URI: https://www.wpstud.io
     
    2525 */
    2626
    27 if ( ! defined( 'ABSPATH' ) ) {
    28     die( 'Sorry, you are not allowed to access this page directly.' );
     27// If this file is called directly, abort.
     28if ( ! defined( 'WPINC' ) ) {
     29    die;
    2930}
    3031
    31 define( 'GLMBVERSION', '1.2' );
    32 define( 'GLMBRELEASEDATE', 'february, 2015' );
     32require_once ABSPATH . 'wp-admin/includes/plugin.php';
    3333
    34 add_action( 'init', 'wps_load_plugin_textdomain' );
    3534/**
    3635 * Callback on the `plugins_loaded` hook.
     
    4443 */
    4544function wps_load_plugin_textdomain() {
     45
    4646    load_plugin_textdomain( 'wpstudio-login-modal-box', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
     47
    4748}
    4849
    49 register_activation_hook( __FILE__, 'wps_glmb_activation_check' );
     50add_action( 'init', 'wps_load_plugin_textdomain' );
     51
    5052/**
    5153 * This function runs on plugin activation. It checks to make sure the required
     
    6062
    6163        deactivate_plugins( plugin_basename( __FILE__ ) ); // Deactivate plugin.
    62         wp_die( sprintf( __( 'Sorry, you can not activate the Genesis Slide-in Widget unless you have installed the Genesis Framewor. Go back to the Plugins Page.', 'genesis-overlay-widget' ), '<em>', '</em>', '<a href="http://www.studiopress.com/themes/genesis" target="_blank">', '</a>', '<a href="javascript:history.back()">' ) );
     64        wp_die( sprintf( __( 'Sorry, you can not activate the Genesis Slide-in Widget unless you have installed the Genesis Framework. Go back to the Plugins Page.', 'wpstudio-login-modal-box' ), '<em>', '</em>', '<a href="http://www.studiopress.com/themes/genesis" target="_blank">', '</a>', '<a href="javascript:history.back()">' ) );
    6365
    6466    }
     
    6769
    6870        deactivate_plugins( plugin_basename( __FILE__ ) ); // Deactivate plugin.
    69         wp_die( sprintf( __( 'Sorry, you can not activate the Genesis Slide-in Widget unless you have installed the Genesis Framework. Go back to the Plugins Page.', 'genesis-overlay-widget' ), '<em>', '</em>', '<a href="http://www.studiopress.com/themes/genesis" target="_blank">', $latest, '</a>', '<a href="javascript:history.back()">' ) );
     71        wp_die( sprintf( __( 'Sorry, you can not activate the Genesis Slide-in Widget unless you have installed the Genesis Framework. Go back to the Plugins Page.', 'wpstudio-login-modal-box' ), '<em>', '</em>', '<a href="http://www.studiopress.com/themes/genesis" target="_blank">', $latest, '</a>', '<a href="javascript:history.back()">' ) );
    7072
    7173    }
     
    7375}
    7476
    75 add_action( 'after_switch_theme', 'wps_glmb_deactivate_check' );
     77/**
     78 * This function runs on plugin deactivation.
     79 */
    7680function wps_glmb_deactivate_check() {
    7781
     
    8488}
    8589
    86 add_action( 'wp_enqueue_scripts', 'wps_glmb_load_scripts', 99 );
     90add_action( 'after_switch_theme', 'wps_glmb_deactivate_check', 10 );
     91
     92
    8793/**
    8894 *  Enqueue scripts and styles
     
    96102}
    97103
    98 add_action( 'after_setup_theme', 'wps_glmb_init' );
     104add_action( 'wp_enqueue_scripts', 'wps_glmb_load_scripts', 99 );
     105
     106
     107/**
     108 * Load required files.
     109 */
    99110function wps_glmb_init() {
    100111
    101     require dirname( __FILE__ )  . '/inc/glmb-admin.php';
    102     include dirname( __FILE__ ) . '/inc/glmb-frontend.php';
    103     new WPSTUDIO_Glmb_Settings();
     112    if ( function_exists( 'genesis_pre' ) ) {
     113
     114        require dirname( __FILE__ )  . '/inc/glmb-admin.php';
     115        include dirname( __FILE__ ) . '/inc/glmb-frontend.php';
     116        new WPSTUDIO_Glmb_Settings();
     117
     118    }
    104119
    105120}
    106121
    107 add_shortcode( 'wps_login', 'wps_glmb_shortcode' );
     122add_action( 'after_setup_theme', 'wps_glmb_init' );
     123
     124
    108125/**
    109126 * Add shortcode
     
    119136}
    120137
    121 add_action( 'wp_login_failed', 'wps_login_fail' );
     138add_shortcode( 'wps_login', 'wps_glmb_shortcode' );
     139
     140
    122141/**
    123142 * If username or password is wrong redirect
     
    139158    }
    140159}
     160
     161add_action( 'wp_login_failed', 'wps_login_fail' );
  • wpstudio-login-modal-box/trunk/inc/glmb-admin.php

    r1815571 r1956786  
    8383        <li><strong style="width: 180px; margin: 0 40px 20px 0; display: inline-block; font-weight: 600;">' . __( 'Website', 'wpstudio-login-modal-box' ) . ':</strong> <a href="https://www.wpstud.io" target="_blank">www.wpstud.io</a></li>
    8484        <li><strong style="width: 180px; margin: 0 40px 20px 0; display: inline-block; font-weight: 600;">' . __( 'Contact', 'wpstudio-login-modal-box' ) . ':</strong> <a href="mailto:[email protected]">[email protected]</a></li>
    85         <li><strong style="width: 180px; margin: 0 40px 20px 0; display: inline-block; font-weight: 600;">' . __( 'Version', 'wpstudio-login-modal-box' ) . ':</strong>' .  GLMBVERSION .'</li>
    86         <li><strong style="width: 180px; margin: 0 40px 20px 0; display: inline-block; font-weight: 600;">' . __( 'Release date', 'wpstudio-login-modal-box' ) . ':</strong>' .  GLMBRELEASEDATE .'</li>
    8785        </ul>';
    8886    }
  • wpstudio-login-modal-box/trunk/inc/glmb-frontend.php

    r1844266 r1956786  
    2121        $login_url = genesis_get_option( 'glmb_loginurl', 'glmb-settings' );
    2222
     23    } elseif ( is_home() || is_404() ) {
     24
     25        $login_url = '/';
     26
    2327    } else {
    2428
    25         $login_url = get_the_permalink();
     29        $login_url = get_permalink();
     30
    2631
    2732    }
     
    6267    );
    6368    wp_login_form( $args );
     69
    6470    echo '</div>';
    6571
     
    8490    } else {
    8591
    86         $logout_url = get_the_permalink();
     92        $logout_url = '/';
    8793
    8894    }
     
    112118    if ( $login_location !== $args['theme_location']  )
    113119
    114         return $menu;
     120    return $menu;
    115121
    116         $logout = '<li class="menu-item logout"><a href="' . wp_logout_url( home_url() ) . '" title="Logout">' . esc_html__( 'Log out', 'wpstudio-login-modal-box' ) . '</a></li>';
     122    $logout = '<li class="menu-item logout"><a href="' . wp_logout_url( home_url() ) . '" title="Logout">' . esc_html__( 'Log out', 'wpstudio-login-modal-box' ) . '</a></li>';
     123
     124    if ( is_home() ) {
     125
     126        $login = '<li class="menu-item login"><a href="/#login" title="Login">' . esc_html__( 'Login', 'wpstudio-login-modal-box' ) . '</a></li>';
     127
     128    } else {
    117129
    118130        $login = '<li class="menu-item login"><a href="' . get_the_permalink() . '/#login" title="Login">' . esc_html__( 'Login', 'wpstudio-login-modal-box' ) . '</a></li>';
     131    }
    119132
    120133    if ( has_filter( 'wpstudio_add_logout_filter' ) ) {
     
    130143    }
    131144
    132     if ( is_user_logged_in() )
     145    if ( is_user_logged_in() ) {
    133146
    134147        return $menu . $logout;
    135148
    136     else {
     149    } else {
    137150
    138151        return $menu . $login;
  • wpstudio-login-modal-box/trunk/readme.txt

    r1844266 r1956786  
    33Tags: overlay, genesis, login, modal, Genesis Framework, genesiswp, login form, custom login, wordpress login
    44Requires at least: 3.6
    5 Tested up to: 4.9.4
    6 Stable tag: 1.2.3
     5Tested up to: 4.9.8
     6Stable tag: 1.2.4
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4545== Changelog ==
    4646
     47=1.2.4 =
     48* Bug fix: fixed check wich causes a error 500 if switched to an none Genesis theme.
     49* Tweak: login from 404 directs to homepage
     50* Tweak: login from homepage does not redirect anymore to another post before lauching pop-up
     51
    4752= 1.2.3 =
    4853* fix: made lost password string translatable.
Note: See TracChangeset for help on using the changeset viewer.