Skip to:
Content

bbPress.org


Ignore:
Timestamp:
04/18/2015 03:33:53 AM (11 years ago)
Author:
johnjamesjacoby
Message:

Common: Login actions:

  • Extract functionality from bbp_wp_login_action() into a getter: bbp_get_wp_login_action()
  • Update arguments inbbp_get_wp_login_action() to include optional url override
  • Pass original $args into login action filter
  • Also improve support for empty separator in breadcrumbs
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/common/template.php

    r5676 r5685  
    11991199 */
    12001200function bbp_wp_login_action( $args = array() ) {
    1201 
    1202         // Parse arguments against default values
    1203         $r = bbp_parse_args( $args, array(
    1204                 'action'  => '',
    1205                 'context' => ''
    1206         ), 'login_action' );
    1207 
    1208         // Add action as query arg
    1209         if ( !empty( $r['action'] ) ) {
    1210                 $login_url = add_query_arg( array( 'action' => $r['action'] ), 'wp-login.php' );
    1211 
    1212         // No query arg
    1213         } else {
    1214                 $login_url = 'wp-login.php';
    1215         }
    1216 
    1217         $login_url = site_url( $login_url, $r['context'] );
    1218 
    1219         echo apply_filters( 'bbp_wp_login_action', $login_url, $r );
    1220 }
     1201        echo esc_url( bbp_get_wp_login_action( $args ) );
     1202}
     1203
     1204        /**
     1205         * Return the login form action url
     1206         *
     1207         * @since bbPress (r5684)
     1208         *
     1209         * @param array $args This function supports these arguments:
     1210         *  - action: The action being taken
     1211         *  - context: The context the action is being taken from
     1212         * @uses add_query_arg() To add a arg to the url
     1213         * @uses site_url() Toget the site url
     1214         * @uses apply_filters() Calls 'bbp_wp_login_action' with the url and args
     1215         */
     1216        function bbp_get_wp_login_action( $args = array() ) {
     1217
     1218                // Parse arguments against default values
     1219                $r = bbp_parse_args( $args, array(
     1220                        'action'  => '',
     1221                        'context' => '',
     1222                        'url'     => 'wp-login.php'
     1223                ), 'login_action' );
     1224
     1225                // Add action as query arg
     1226                if ( ! empty( $r['action'] ) ) {
     1227                        $login_url = add_query_arg( array( 'action' => $r['action'] ), $r['url'] );
     1228
     1229                // No query arg
     1230                } else {
     1231                        $login_url = $r['url'];
     1232                }
     1233
     1234                $login_url = site_url( $login_url, $r['context'] );
     1235
     1236                return apply_filters( 'bbp_wp_login_action', $login_url, $r, $args );
     1237        }
    12211238
    12221239/**
     
    23962413                if ( ! empty( $r['sep'] ) ) {
    23972414                        $sep = $r['sep_before'] . $r['sep'] . $r['sep_after'];
     2415                } else {
     2416                        $sep = '';
    23982417                }
    23992418
Note: See TracChangeset for help on using the changeset viewer.