Changeset 2827
- Timestamp:
- 02/03/2011 08:00:34 PM (15 years ago)
- Location:
- branches/plugin
- Files:
-
- 5 edited
-
bbp-includes/bbp-general-template.php (modified) (5 diffs)
-
bbp-includes/bbp-hooks.php (modified) (1 diff)
-
bbp-includes/bbp-user-template.php (modified) (2 diffs)
-
bbp-includes/bbp-widgets.php (modified) (3 diffs)
-
bbp-themes/bbp-twentyten/css/bbpress.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-general-template.php
r2823 r2827 324 324 * @since bbPress (r2815) 325 325 * 326 * @param str $url Pass a URL to redirect to326 * @param string $url Pass a URL to redirect to 327 327 * @uses add_query_arg() To add a arg to the url 328 328 * @uses site_url() Toget the site url … … 356 356 * 357 357 * @param string $url Pass a URL to redirect to 358 * @uses home_url() To get the url 358 * @uses wp_get_referer() To get the referer 359 * @uses esc_attr() To escape the url 359 360 * @uses apply_filters() Calls 'bbp_redirect_to_field' with the referer field 360 361 * and url 361 362 */ 362 363 function bbp_redirect_to_field( $url = '' ) { 363 // If no URL is passed, use request 364 if ( empty( $url ) && !empty( $_SERVER['HTTP_REFERER'] ) ) 365 $url = esc_url( $_SERVER['HTTP_REFERER'] ); 364 // If no URL is passed, try to get the referer and then the request uri 365 if ( empty( $url ) && ( !$url = wp_get_referer() ) && ( !empty( $_SERVER['REQUEST_URI'] ) ) ) 366 $url = $_SERVER['REQUEST_URI']; 367 368 $url = (string) esc_attr( $url ); 366 369 367 370 $referer_field = '<input type="hidden" name="redirect_to" value="' . $url . '" />'; … … 411 414 // Treat different kinds of fields in different ways 412 415 switch ( $input_type ) { 413 case 'text' :416 case 'text' : 414 417 case 'textarea' : 415 418 $retval = esc_attr( stripslashes( $pre_ret_val ) ); … … 417 420 418 421 case 'password' : 419 case 'select' :420 case 'radio' :422 case 'select' : 423 case 'radio' : 421 424 case 'checkbox' : 422 425 default : … … 1062 1065 } 1063 1066 1067 /** Login/logout/register/lost pass *******************************************/ 1068 1069 /** 1070 * Output the logout link 1071 * 1072 * @since bbPress (r) 1073 * 1074 * @param string $redirect_to Redirect to url 1075 * @uses bbp_get_logout_link() To get the logout link 1076 */ 1077 function bbp_logout_link( $redirect_to = '' ) { 1078 echo bbp_get_logout_link( $redirect_to ); 1079 } 1080 /** 1081 * Return the logout link 1082 * 1083 * @since bbPress (r) 1084 * 1085 * @param string $redirect_to Redirect to url 1086 * @uses wp_logout_url() To get the logout url 1087 * @uses apply_filters() Calls 'bbp_get_logout_link' with the logout link and 1088 * redirect to url 1089 * @return string The logout link 1090 */ 1091 function bbp_get_logout_link( $redirect_to = '' ) { 1092 return apply_filters( 'bbp_get_logout_link', '<a href="' . wp_logout_url() . '" class="button logout-link">' . __( 'Log Out', 'bbpress' ) . '</a>', $redirect_to ); 1093 } 1094 1064 1095 ?> -
branches/plugin/bbp-includes/bbp-hooks.php
r2823 r2827 69 69 70 70 // Widgets 71 add_action( 'widgets_init', create_function( '', 'return register_widget("BBP_Login_Widget");' ) ); 71 72 add_action( 'widgets_init', create_function( '', 'return register_widget("BBP_Forums_Widget");' ) ); 72 73 add_action( 'widgets_init', create_function( '', 'return register_widget("BBP_Topics_Widget");' ) ); -
branches/plugin/bbp-includes/bbp-user-template.php
r2823 r2827 362 362 return apply_filters( 'bbp_get_user_edit_profile_url', $url, $user_id, $user_nicename ); 363 363 364 } 365 366 /** 367 * Output the link to the admin section 368 * 369 * @since bbPress (r) 370 * 371 * @param mixed $args Optional. See {@link bbp_get_admin_link()} 372 * @uses bbp_get_admin_link() To get the admin link 373 */ 374 function bbp_admin_link( $args = '' ) { 375 echo bbp_get_admin_link( $args ); 376 } 377 /** 378 * Return the link to the admin section 379 * 380 * @since bbPress (r) 381 * 382 * @param mixed $args Optional. This function supports these arguments: 383 * - text: The text 384 * - before: Before the lnk 385 * - after: After the link 386 * @uses current_user_can() To check if the current user can moderate 387 * @uses admin_url() To get the admin url 388 * @uses apply_filters() Calls 'bbp_get_admin_link' with the link & args 389 * @return The link 390 */ 391 function bbp_get_admin_link( $args = '' ) { 392 if ( !current_user_can( 'moderate' ) ) 393 return; 394 395 if ( $args && is_string( $args ) && false === strpos( $args, '=' ) ) 396 $args = array( 'text' => $args ); 397 398 $defaults = array( 'text' => __( 'Admin', 'bbpress' ), 'before' => '', 'after' => '' ); 399 $args = wp_parse_args( $args, $defaults ); 400 extract( $args, EXTR_SKIP ); 401 402 $uri = admin_url(); 403 404 return apply_filters( 'bbp_get_admin_link', $before . '<a href="' . $uri . '">' . $text . '</a>' . $after, $args ); 364 405 } 365 406 … … 743 784 */ 744 785 function bbp_logged_in_redirect( $url = '' ) { 745 if ( is_user_logged_in() ) { 746 $redirect_to = !empty( $url ) ? $url : bbp_get_user_profile_url( bbp_get_current_user_id() ); 747 wp_safe_redirect( $redirect_to ); 748 exit; 749 } 786 if ( !is_user_logged_in() ) 787 return; 788 789 $redirect_to = !empty( $url ) ? $url : bbp_get_user_profile_url( bbp_get_current_user_id() ); 790 wp_safe_redirect( $redirect_to ); 791 exit; 750 792 } 751 793 -
branches/plugin/bbp-includes/bbp-widgets.php
r2818 r2827 3 3 /** 4 4 * bbPress Widgets 5 * 6 * Contains the forum list, topic list, reply list and login form widgets. 5 7 * 6 8 * @package bbPress 7 9 * @subpackage Widgets 8 10 */ 11 12 /** 13 * bbPress Login Widget 14 * 15 * Adds a widget which displays the login form 16 * 17 * @since bbPress (r2827) 18 * 19 * @uses WP_Widget 20 */ 21 class BBP_Login_Widget extends WP_Widget { 22 23 /** 24 * bbPress Login Widget 25 * 26 * Registers the login widget 27 * 28 * @since bbPress (r2827) 29 * 30 * @uses apply_filters() Calls 'bbp_login_widget_options' with the 31 * widget options 32 */ 33 function BBP_Login_Widget() { 34 $widget_ops = apply_filters( 'bbp_login_widget_options', array( 35 'classname' => 'bbp_widget_login', 36 'description' => __( 'The login widget.', 'bbpress' ) 37 ) ); 38 39 parent::WP_Widget( false, __( 'bbPress Login Widget', 'bbpress' ), $widget_ops ); 40 } 41 42 /** 43 * Displays the output, the login form 44 * 45 * @since bbPress (r2827) 46 * 47 * @param mixed $args Arguments 48 * @param array $instance Instance 49 * @uses apply_filters() Calls 'bbp_login_widget_title' with the title 50 * @uses get_template_part() To get the login/logged in form 51 */ 52 function widget( $args, $instance ) { 53 extract( $args ); 54 55 $title = apply_filters( 'bbp_login_widget_title', $instance['title'] ); 56 57 echo $before_widget; 58 59 if ( !empty( $title ) ) 60 echo $before_title . $title . $after_title; 61 62 if ( !is_user_logged_in() ) : ?> 63 64 <form method="post" action="<?php bbp_wp_login_action( array( 'context' => 'login_post' ) ); ?>" class="bbp-login-form"> 65 <fieldset> 66 <legend><?php _e( 'Login', 'bbpress' ); ?></legend> 67 68 <?php do_action( 'bbp_template_notices' ); ?> 69 70 <div class="bbp-username"> 71 <label for="user_login"><?php _e( 'Username', 'bbpress' ); ?>: </label> 72 <input type="text" name="log" value="<?php bbp_sanitize_val( 'user_login', 'text' ); ?>" size="20" id="user_login" tabindex="<?php bbp_tab_index(); ?>" /> 73 </div> 74 75 <div class="bbp-password"> 76 <label for="user_pass"><?php _e( 'Password', 'bbpress' ); ?>: </label> 77 <input type="password" name="pwd" value="<?php bbp_sanitize_val( 'user_pass', 'password' ); ?>" size="20" id="user_pass" tabindex="<?php bbp_tab_index(); ?>" /> 78 </div> 79 80 <div class="bbp-remember-me"> 81 <input type="checkbox" name="rememberme" value="forever" <?php checked( bbp_get_sanitize_val( 'rememberme', 'checkbox' ), true, true ); ?> id="rememberme" tabindex="<?php bbp_tab_index(); ?>" /> 82 <label for="rememberme"><?php _e( 'Keep me signed in', 'bbpress' ); ?></label> 83 </div> 84 85 <div class="bbp-submit-wrapper"> 86 87 <?php do_action( 'login_form' ); ?> 88 89 <input type="submit" name="user-submit" value="<?php _e( 'Log In', 'bbpress' ); ?>" tabindex="<?php bbp_tab_index(); ?>" class="user-submit" /> 90 91 <?php bbp_user_login_fields(); ?> 92 93 </div> 94 </fieldset> 95 </form> 96 97 <?php else : ?> 98 99 <div class="bbp-logged-in"> 100 <a href="<?php echo bp_loggedin_user_domain(); ?>"><?php echo get_avatar( bbp_get_current_user_id(), '40' ); ?></a> 101 <h4><?php echo bbp_get_user_profile_link( bbp_get_current_user_id() ); ?></h4> 102 103 <?php bbp_logout_link(); ?> 104 </div> 105 106 <?php endif; 107 108 echo $after_widget; 109 } 110 111 /** 112 * Update the login widget options 113 * 114 * @since bbPress (r2827) 115 * 116 * @param array $new_instance The new instance options 117 * @param array $old_instance The old instance options 118 */ 119 function update( $new_instance, $old_instance ) { 120 $instance = $old_instance; 121 $instance['title'] = strip_tags( $new_instance['title'] ); 122 123 return $instance; 124 } 125 126 /** 127 * Output the login widget options form 128 * 129 * @since bbPress (r2827) 130 * 131 * @param $instance Instance 132 * @uses BBP_Login_Widget::get_field_id() To output the field id 133 * @uses BBP_Login_Widget::get_field_name() To output the field name 134 */ 135 function form( $instance ) { 136 $title = !empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; ?> 137 138 <p> 139 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'bbpress' ); ?> 140 <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></label> 141 </p> 142 143 <?php 144 } 145 } 9 146 10 147 /** … … 83 220 <?php echo $after_widget; 84 221 85 endif; 222 endif; 86 223 } 87 224 … … 279 416 */ 280 417 function form( $instance ) { 281 $title = !empty( $instance['title'] )? esc_attr( $instance['title'] ) : '';418 $title = !empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; 282 419 $max_shown = !empty( $instance['max_shown'] ) ? esc_attr( $instance['max_shown'] ) : ''; 283 420 $show_date = !empty( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : ''; -
branches/plugin/bbp-themes/bbp-twentyten/css/bbpress.css
r2826 r2827 387 387 color: #aaa; 388 388 } 389 390 /* =Widgets 391 -------------------------------------------------------------- */ 392 393 .widget-area .bbp-login-form fieldset legend { 394 display: none; 395 } 396 397 .widget-area .bbp-login-form .bbp-username label, 398 .widget-area .bbp-login-form .bbp-password label { 399 width: 70px; 400 display: inline-block; 401 } 402 .widget-area .bbp-login-form .bbp-username, 403 .widget-area .bbp-login-form .bbp-password, 404 .widget-area .bbp-login-form .bbp-remember-me, 405 .widget-area .bbp-login-form .bbp-submit-wrapper { 406 margin-top: 10px; 407 } 408 409 .widget-area .bbp-login-form .bbp-remember-me { 410 float: left; 411 } 412 413 .widget-area .bbp-login-form .bbp-submit-wrapper { 414 float: right; 415 } 416 417 .widget-area .bbp-logged-in img.avatar { 418 float: left; 419 margin-right: 15px; 420 } 421 422 .widget-area .bbp-logged-in h4 { 423 font-weight: bold; 424 font-size: 1.3em; 425 display: inline; 426 clear: none; 427 } 428 429 .widget-area .bbp-logged-in a.logout-link { 430 display: block; 431 }
Note: See TracChangeset
for help on using the changeset viewer.