[wp-trac] [WordPress Trac] #19898: Create a is_login() function similar to is_admin()

WordPress Trac wp-trac at lists.automattic.com
Wed Jan 25 23:13:44 UTC 2012


#19898: Create a is_login() function similar to is_admin()
----------------------------+-----------------------------
 Reporter:  dcowgill        |      Owner:
     Type:  enhancement     |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Administration  |    Version:  3.3.1
 Severity:  normal          |   Keywords:
----------------------------+-----------------------------
 It would be useful for developers to have better detection of being on the
 wp-login.php and wp-register.php pages. Sure, this can currently be done
 by using the $pagenow global variable but having a similar function like
 is_admin() would make things easier/cleaner.

 One use case:

 -Using a hosted javascript file but then requiring SSL (FORCE_SSL_LOGIN).

 {{{
 #!php
 function javascript_init() {
     if ( $pagenow == 'wp-login.php' || is_admin() )
         return;

     wp_deregister_script( 'jquery' );
     wp_register_script( 'jquery',
 'http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js');
     wp_enqueue_script( 'jquery' );
 }
 add_action( 'wp_print_scripts', 'javascript_init' );
 }}}


 Proposed solution:
 Create a new function that does all the checking.
 {{{
 #!php
 function is_login() {
     return in_array( $GLOBALS['pagenow'], array( 'wp-login.php', 'wp-
 register.php' ) );
 }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19898>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list