Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/17/2023 11:14:06 AM (22 months ago)
Author:
imath
Message:

Deprecate BP Legacy widgets

Deprecate all classes, functions, JavaScripts and files related to Legacy Widgets. Legacy Widgets are now available from the BP Classic plugin.

See #8869
Closes https://github.com/buddypress/buddypress/pull/99

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/classes/class-bp-core-login-widget.php

    r13441 r13481  
    66 * @subpackage Core
    77 * @since 1.9.0
     8 * @deprecated 12.0.0
    89 */
    910
     
    1112defined( 'ABSPATH' ) || exit;
    1213
     14_deprecated_file( basename( __FILE__ ), '12.0.0', '', __( 'BuddyPress does not include Legacy Widgets anymore, you can restore it using the BP Classic plugin', 'buddypress' ) );
     15
    1316/**
    1417 * BuddyPress Login Widget.
    1518 *
    1619 * @since 1.9.0
     20 * @deprecated 12.0.0
    1721 */
    18 class BP_Core_Login_Widget extends WP_Widget {
     22class BP_Core_Login_Widget {
    1923
    2024    /**
     
    2327     * @since 1.9.0
    2428     * @since 9.0.0 Adds the `show_instance_in_rest` property to Widget options.
     29     * @deprecated 12.0.0
    2530     */
    2631    public function __construct() {
    27         parent::__construct(
    28             false,
    29             _x( '(BuddyPress) Log In', 'Title of the login widget', 'buddypress' ),
    30             array(
    31                 'description'                 => __( 'Show a Log In form to logged-out visitors, and a Log Out link to those who are logged in.', 'buddypress' ),
    32                 'classname'                   => 'widget_bp_core_login_widget buddypress widget',
    33                 'customize_selective_refresh' => true,
    34                 'show_instance_in_rest'       => true,
    35             )
    36         );
     32        _deprecated_function( __METHOD__, '12.0.0' );
    3733    }
    3834
     
    4137     *
    4238     * @since 1.9.0
     39     * @deprecated 12.0.0
    4340     *
    4441     * @see WP_Widget::widget() for description of parameters.
     
    4845     */
    4946    public function widget( $args, $instance ) {
    50         $title = isset( $instance['title'] ) ? $instance['title'] : '';
    51 
    52         /**
    53          * Filters the title of the Login widget.
    54          *
    55          * @since 1.9.0
    56          * @since 2.3.0 Added 'instance' and 'id_base' to arguments passed to filter.
    57          *
    58          * @param string $title    The widget title.
    59          * @param array  $instance The settings for the particular instance of the widget.
    60          * @param string $id_base  Root ID for all widgets of this type.
    61          */
    62         $title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
    63 
    64         echo $args['before_widget'];
    65 
    66         echo $args['before_title'] . esc_html( $title ) . $args['after_title']; ?>
    67 
    68         <?php if ( is_user_logged_in() ) : ?>
    69 
    70             <?php
    71             /**
    72              * Fires before the display of widget content if logged in.
    73              *
    74              * @since 1.9.0
    75              */
    76             do_action( 'bp_before_login_widget_loggedin' ); ?>
    77 
    78             <div class="bp-login-widget-user-avatar">
    79                 <a href="<?php bp_loggedin_user_link(); ?>">
    80                     <?php bp_loggedin_user_avatar( 'type=thumb&width=50&height=50' ); ?>
    81                 </a>
    82             </div>
    83 
    84             <div class="bp-login-widget-user-links">
    85                 <div class="bp-login-widget-user-link"><?php echo bp_core_get_userlink( bp_loggedin_user_id() ); ?></div>
    86                 <div class="bp-login-widget-user-logout"><a class="logout" href="<?php echo wp_logout_url( bp_get_requested_url() ); ?>"><?php _e( 'Log Out', 'buddypress' ); ?></a></div>
    87             </div>
    88 
    89             <?php
    90 
    91             /**
    92              * Fires after the display of widget content if logged in.
    93              *
    94              * @since 1.9.0
    95              */
    96             do_action( 'bp_after_login_widget_loggedin' ); ?>
    97 
    98         <?php else : ?>
    99 
    100             <?php
    101 
    102             /**
    103              * Fires before the display of widget content if logged out.
    104              *
    105              * @since 1.9.0
    106              */
    107             do_action( 'bp_before_login_widget_loggedout' ); ?>
    108 
    109             <form name="bp-login-form" id="bp-login-widget-form" class="standard-form" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post">
    110                 <label for="bp-login-widget-user-login"><?php _e( 'Username', 'buddypress' ); ?></label>
    111                 <input type="text" name="log" id="bp-login-widget-user-login" class="input" value="" />
    112 
    113                 <label for="bp-login-widget-user-pass"><?php _e( 'Password', 'buddypress' ); ?></label>
    114                 <input type="password" name="pwd" id="bp-login-widget-user-pass" class="input" value="" <?php bp_form_field_attributes( 'password' ) ?> />
    115 
    116                 <div class="forgetmenot"><label for="bp-login-widget-rememberme"><input name="rememberme" type="checkbox" id="bp-login-widget-rememberme" value="forever" /> <?php _e( 'Remember Me', 'buddypress' ); ?></label></div>
    117 
    118                 <input type="submit" name="wp-submit" id="bp-login-widget-submit" value="<?php esc_attr_e( 'Log In', 'buddypress' ); ?>" />
    119 
    120                 <?php if ( bp_get_signup_allowed() ) : ?>
    121 
    122                     <span class="bp-login-widget-register-link"><a href="<?php echo esc_url( bp_get_signup_page() ); ?>"><?php _e( 'Register', 'buddypress' ); ?></a></span>
    123 
    124                 <?php endif; ?>
    125 
    126                 <?php
    127 
    128                 /**
    129                  * Fires inside the display of the login widget form.
    130                  *
    131                  * @since 2.4.0
    132                  */
    133                 do_action( 'bp_login_widget_form' ); ?>
    134 
    135             </form>
    136 
    137             <?php
    138 
    139             /**
    140              * Fires after the display of widget content if logged out.
    141              *
    142              * @since 1.9.0
    143              */
    144             do_action( 'bp_after_login_widget_loggedout' ); ?>
    145 
    146         <?php endif;
    147 
    148         echo $args['after_widget'];
     47        _deprecated_function( __METHOD__, '12.0.0' );
    14948    }
    15049
     
    15352     *
    15453     * @since 1.9.0
     54     * @deprecated 12.0.0
    15555     *
    15656     * @param array $new_instance The new instance options.
     
    15959     */
    16060    public function update( $new_instance, $old_instance ) {
    161         $instance             = $old_instance;
    162         $instance['title']    = isset( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : '';
    163 
    164         return $instance;
     61        _deprecated_function( __METHOD__, '12.0.0' );
    16562    }
    16663
     
    16966     *
    17067     * @since 1.9.0
     68     * @deprecated 12.0.0
    17169     *
    17270     * @param array $instance Settings for this widget.
     
    17472     */
    17573    public function form( $instance = array() ) {
    176 
    177         $settings = bp_parse_args(
    178             $instance,
    179             array(
    180                 'title' => '',
    181             )
    182         );
    183         ?>
    184 
    185         <p>
    186             <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'buddypress' ); ?>
    187             <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $settings['title'] ); ?>" /></label>
    188         </p>
    189 
    190         <?php
     74        _deprecated_function( __METHOD__, '12.0.0' );
    19175    }
    19276}
Note: See TracChangeset for help on using the changeset viewer.