- Timestamp:
- 05/17/2023 11:14:06 AM (22 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/classes/class-bp-core-login-widget.php
r13441 r13481 6 6 * @subpackage Core 7 7 * @since 1.9.0 8 * @deprecated 12.0.0 8 9 */ 9 10 … … 11 12 defined( 'ABSPATH' ) || exit; 12 13 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 13 16 /** 14 17 * BuddyPress Login Widget. 15 18 * 16 19 * @since 1.9.0 20 * @deprecated 12.0.0 17 21 */ 18 class BP_Core_Login_Widget extends WP_Widget{22 class BP_Core_Login_Widget { 19 23 20 24 /** … … 23 27 * @since 1.9.0 24 28 * @since 9.0.0 Adds the `show_instance_in_rest` property to Widget options. 29 * @deprecated 12.0.0 25 30 */ 26 31 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' ); 37 33 } 38 34 … … 41 37 * 42 38 * @since 1.9.0 39 * @deprecated 12.0.0 43 40 * 44 41 * @see WP_Widget::widget() for description of parameters. … … 48 45 */ 49 46 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' ); 149 48 } 150 49 … … 153 52 * 154 53 * @since 1.9.0 54 * @deprecated 12.0.0 155 55 * 156 56 * @param array $new_instance The new instance options. … … 159 59 */ 160 60 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' ); 165 62 } 166 63 … … 169 66 * 170 67 * @since 1.9.0 68 * @deprecated 12.0.0 171 69 * 172 70 * @param array $instance Settings for this widget. … … 174 72 */ 175 73 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' ); 191 75 } 192 76 }
Note: See TracChangeset
for help on using the changeset viewer.