| | 228 | /*** LOGIN WIDGET *****************/ |
| | 229 | |
| | 230 | class BP_Core_Login_Widget extends WP_Widget { |
| | 231 | function bp_core_login_widget() { |
| | 232 | parent::WP_Widget( false, $name = __( 'BuddyPress Login', 'buddypress' ) ); |
| | 233 | } |
| | 234 | |
| | 235 | function widget($args, $instance) { |
| | 236 | global $bp; |
| | 237 | |
| | 238 | $args = apply_filters( 'bp_login_widget_args', $args ); |
| | 239 | |
| | 240 | extract( $args ); |
| | 241 | |
| | 242 | echo $before_widget; |
| | 243 | echo $before_title |
| | 244 | . $widget_name |
| | 245 | . $after_title; ?> |
| | 246 | |
| | 247 | <?php if ( is_user_logged_in() ) : ?> |
| | 248 | |
| | 249 | <?php do_action( 'bp_before_sidebar_me' ) ?> |
| | 250 | |
| | 251 | <div id="sidebar-me"> |
| | 252 | <a href="<?php echo bp_loggedin_user_domain() ?>"> |
| | 253 | <?php bp_loggedin_user_avatar( 'type=thumb&width=40&height=40' ) ?> |
| | 254 | </a> |
| | 255 | |
| | 256 | <h4><?php echo bp_core_get_userlink( bp_loggedin_user_id() ); ?></h4> |
| | 257 | <a class="button logout" href="<?php echo wp_logout_url( bp_get_root_domain() ) ?>"><?php _e( 'Log Out', 'buddypress' ) ?></a> |
| | 258 | |
| | 259 | <?php do_action( 'bp_sidebar_me' ) ?> |
| | 260 | </div> |
| | 261 | |
| | 262 | <?php do_action( 'bp_after_sidebar_me' ) ?> |
| | 263 | |
| | 264 | <?php if ( function_exists( 'bp_message_get_notices' ) ) : ?> |
| | 265 | <?php bp_message_get_notices(); /* Site wide notices to all users */ ?> |
| | 266 | <?php endif; ?> |
| | 267 | |
| | 268 | <?php else : ?> |
| | 269 | |
| | 270 | <?php do_action( 'bp_before_sidebar_login_form' ) ?> |
| | 271 | |
| | 272 | <p id="login-text"> |
| | 273 | <?php _e( 'To start connecting please log in first.', 'buddypress' ) ?> |
| | 274 | <?php if ( bp_get_signup_allowed() ) : ?> |
| | 275 | <?php printf( __( ' You can also <a href="%s" title="Create an account">create an account</a>.', 'buddypress' ), site_url( BP_REGISTER_SLUG . '/' ) ) ?> |
| | 276 | <?php endif; ?> |
| | 277 | </p> |
| | 278 | |
| | 279 | <form name="login-form" id="sidebar-login-form" class="standard-form" action="<?php echo site_url( 'wp-login.php', 'login_post' ) ?>" method="post"> |
| | 280 | <label><?php _e( 'Username', 'buddypress' ) ?><br /> |
| | 281 | <input type="text" name="log" id="sidebar-user-login" class="input" /></label> |
| | 282 | |
| | 283 | <label><?php _e( 'Password', 'buddypress' ) ?><br /> |
| | 284 | <input type="password" name="pwd" id="sidebar-user-pass" class="input" /></label> |
| | 285 | |
| | 286 | <p class="forgetmenot"><label><input name="rememberme" type="checkbox" id="sidebar-rememberme" value="forever" /> <?php _e( 'Remember Me', 'buddypress' ) ?></label></p> |
| | 287 | |
| | 288 | <?php do_action( 'bp_sidebar_login_form' ) ?> |
| | 289 | <input type="submit" name="wp-submit" id="sidebar-wp-submit" value="<?php _e('Log In'); ?>" tabindex="100" /> |
| | 290 | <input type="hidden" name="testcookie" value="1" /> |
| | 291 | </form> |
| | 292 | |
| | 293 | <?php do_action( 'bp_after_sidebar_login_form' ) ?> |
| | 294 | |
| | 295 | <?php endif; ?> |
| | 296 | |
| | 297 | <?php echo $after_widget; ?> |
| | 298 | <?php |
| | 299 | } |
| | 300 | |
| | 301 | function update( $new_instance, $old_instance ) { |
| | 302 | $instance = $old_instance; |
| | 303 | |
| | 304 | return $instance; |
| | 305 | } |
| | 306 | |
| | 307 | function form( $instance ) { |
| | 308 | $instance = wp_parse_args( (array) $instance, array( 'max_members' => 15 ) ); |
| | 309 | $max_members = strip_tags( $instance['max_members'] ); |
| | 310 | ?> |
| | 311 | |
| | 312 | <p><?php _e( 'Login/logout widget for BuddyPress.', 'buddypress' ) ?></p> |
| | 313 | <?php |
| | 314 | } |
| | 315 | } |
| | 316 | |
| | 317 | |