Changeset 597170
- Timestamp:
- 09/10/2012 09:21:25 PM (14 years ago)
- File:
-
- 1 edited
-
get-user-info/trunk/getUserInfo.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
get-user-info/trunk/getUserInfo.php
r596814 r597170 2 2 /* 3 3 Plugin Name: Get user info 4 Plugin URI: http://wordpress.org/extend/plugins/get-user-info/ 4 5 Description: A way to get the avatar, name, and description using a shortcode : use [authorinfo user="User Name"] and/or use a widget in the sidebar. Just enter the username of the user you want to display. 5 Version: 1.0 6 Version: 1.0.1 6 7 Author: Jeff Freeman 7 8 Author URI: http://graphicalforce.com … … 19 20 parent::__construct( 20 21 'featured_widget', // Base ID 21 ' Featured User', // Name22 'Get User Info', // Name 22 23 array( 'description' => __( 'Display the name, description, and avatar of any user. Just enter the username.', 'text_domain' ), ) // Args 23 24 ); … … 34 35 public function widget( $args, $instance ) { 35 36 extract( $args ); 36 $title = "Featured User of the Day";37 $user = apply_filters( 'widget_title', $instance[' title'] );37 $title = apply_filters( 'widget_title', $instance['title'] ); 38 $user = apply_filters( 'widget_title', $instance['userName'] ); 38 39 39 40 $user = get_userdatabylogin($user); … … 45 46 46 47 echo $before_widget; 47 if ( ! empty( $ title ) )48 echo $before_title . $ title . $after_title;49 echo "{$user_first} {$user_last}";50 echo "<br/>";48 if ( ! empty( $userName ) ) 49 echo $before_title . $userName . $after_title; 50 echo "<h3 class=\"widget-title\">{$title}</h3>"; 51 echo "<h4>{$user_first} {$user_last}</h4>"; 51 52 echo "{$user_avatar}"; 52 echo "<br/>"; 53 echo "{$user_description}"; 53 echo "<p>{$user_description}</p>"; 54 54 echo $after_widget; 55 55 } … … 67 67 public function update( $new_instance, $old_instance ) { 68 68 $instance = array(); 69 $instance['title'] = strip_tags( $new_instance['title'] ); 69 $instance['userName'] = strip_tags( $new_instance['userName'] ); 70 $instance['title'] = strip_tags($new_instance['title']); 70 71 71 72 return $instance; … … 80 81 */ 81 82 public function form( $instance ) { 82 if ( isset( $instance[ 'title' ] ) ) { 83 $title = $instance[ 'title' ]; 83 if ( isset( $instance[ 'userName' ] ) ) { 84 $userName = $instance[ 'userName' ]; 85 $title = $instance['title']; 84 86 } 85 87 else { 86 $ title = __( 'New title', 'text_domain' );88 $userName = __( 'New Name', 'text_domain' ); 87 89 } 88 90 ?> 89 91 <p> 90 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( ' User Name' ); ?></label>92 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label> 91 93 <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( $title ); ?>" /> 94 </p> 95 <p> 96 <label for="<?php echo $this->get_field_id( 'userName' ); ?>"><?php _e( 'User Name' ); ?></label> 97 <input class="widefat" id="<?php echo $this->get_field_id( 'userName' ); ?>" name="<?php echo $this->get_field_name( 'userName' ); ?>" type="text" value="<?php echo esc_attr( $userName ); ?>" /> 92 98 </p> 93 99 <?php … … 96 102 } // class Featured_User 97 103 98 // register Foo_Widgetwidget104 // register Get User Info widget 99 105 add_action( 'widgets_init', create_function( '', 'register_widget( "featured_widget" );' ) ); 100 106
Note: See TracChangeset
for help on using the changeset viewer.