Changeset 700584
- Timestamp:
- 04/20/2013 05:01:45 AM (13 years ago)
- Location:
- wp-last-login/trunk
- Files:
-
- 2 added
- 4 edited
-
lang/wp-last-login-da_DK.mo (added)
-
lang/wp-last-login-da_DK.po (added)
-
obenland-wp-plugins.php (modified) (11 diffs)
-
readme.txt (modified) (4 diffs)
-
uninstall.php (modified) (1 diff)
-
wp-last-login.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-last-login/trunk/obenland-wp-plugins.php
r525795 r700584 2 2 /** obenland-wp-plugins.php 3 3 * 4 * @author Konstantin Obenland5 * @version 1.54 * @author Konstantin Obenland 5 * @version 3.0.1 6 6 */ 7 7 8 8 9 class Obenland_Wp_Plugins_v15 { 10 9 class Obenland_Wp_Plugins_v301 { 11 10 12 11 ///////////////////////////////////////////////////////////////////////////// … … 15 14 16 15 /** 17 * The plugins' text domain 18 * 19 * @author Konstantin Obenland20 * @since 1.1 - 03.04.201121 * @access protected22 * 23 * @var string16 * The plugins' text domain. 17 * 18 * @author Konstantin Obenland 19 * @since 1.1 - 03.04.2011 20 * @access protected 21 * 22 * @var string 24 23 */ 25 24 protected $textdomain; … … 27 26 28 27 /** 29 * The name of the calling plugin 30 * 31 * @author Konstantin Obenland32 * @since 1.0 - 23.03.201133 * @access protected34 * 35 * @var string28 * The name of the calling plugin. 29 * 30 * @author Konstantin Obenland 31 * @since 1.0 - 23.03.2011 32 * @access protected 33 * 34 * @var string 36 35 */ 37 36 protected $plugin_name; … … 39 38 40 39 /** 41 * The donate link for the plugin 42 * 43 * @author Konstantin Obenland44 * @since 1.0 - 23.03.201145 * @access protected46 * 47 * @var string40 * The donate link for the plugin. 41 * 42 * @author Konstantin Obenland 43 * @since 1.0 - 23.03.2011 44 * @access protected 45 * 46 * @var string 48 47 */ 49 48 protected $donate_link; … … 51 50 52 51 /** 53 * The path to the plugin folder 52 * The path to the plugin file. 53 * 54 * /path/to/wp-content/plugins/{plugin-name}/{plugin-name}.php 55 * 56 * @author Konstantin Obenland 57 * @since 2.0.0 - 30.05.2012 58 * @access protected 59 * 60 * @var string 61 */ 62 protected $plugin_path; 63 64 65 /** 66 * The path to the plugin directory. 54 67 * 55 68 * /path/to/wp-content/plugins/{plugin-name}/ 56 69 * 57 * @author Konstantin Obenland58 * @since 1.2 - 21.04.201159 * @access protected60 * 61 * @var string62 */ 63 protected $plugin_ path;70 * @author Konstantin Obenland 71 * @since 1.2 - 21.04.2011 72 * @access protected 73 * 74 * @var string 75 */ 76 protected $plugin_dir_path; 64 77 65 78 … … 71 84 * Constructor 72 85 * 73 * @author Konstantin Obenland 74 * @since 1.0 - 23.03.2011 75 * @access public 76 * 77 * @param array $args Expects three keys: 'textdomain', 'plugin_path', 'donate_link_id' 78 * 79 * @return Obenland_Wp_Plugins 86 * @author Konstantin Obenland 87 * @since 1.0 - 23.03.2011 88 * @access public 89 * 90 * @param string $plugin_name 91 * @param string $donate_link_id 92 * 93 * @return Obenland_Wp_Plugins 80 94 */ 81 95 public function __construct( $args = array() ) { 82 96 83 97 // Set class properties 84 $this->textdomain = $args['textdomain']; 85 $this->plugin_path = plugin_dir_path( $args['plugin_path'] ); 86 $this->plugin_name = plugin_basename( $args['plugin_path'] ); 98 $this->textdomain = $args['textdomain']; 99 $this->plugin_path = $args['plugin_path']; 100 $this->plugin_dir_path = plugin_dir_path( $args['plugin_path'] ); 101 $this->plugin_name = plugin_basename( $args['plugin_path'] ); 102 103 load_plugin_textdomain( 'obenland-wp', false, $this->textdomain . '/lang' ); 87 104 88 105 $this->set_donate_link( $args['donate_link_id'] ); 89 90 // Add actions and filters 106 $this->hook( 'plugins_loaded', 'parent_plugins_loaded' ); 107 } 108 109 110 /** 111 * Hooks in all the hooks :) 112 * 113 * @author Konstantin Obenland 114 * @since 2.0.0 - 12.04.2012 115 * @access public 116 * 117 * @return void 118 */ 119 public function parent_plugins_loaded() { 91 120 $this->hook( 'plugin_row_meta' ); 92 } 93 94 95 /** 96 * 97 * @author Konstantin Obenland 98 * @since 1.0 - 23.03.2011 99 * @access public 100 * 101 * @param array $plugin_meta 102 * @param string $plugin_file 103 * 104 * @return string 121 if ( ! has_action( 'obenland_side_info_column' ) ) { 122 $this->hook( 'obenland_side_info_column', 'donate_box', 1 ); 123 $this->hook( 'obenland_side_info_column', 'feed_box' ); 124 } 125 } 126 127 128 /** 129 * 130 * @author Konstantin Obenland 131 * @since 1.0 - 23.03.2011 132 * @access public 133 * 134 * @param array $plugin_meta 135 * @param string $plugin_file 136 * 137 * @return string 105 138 */ 106 139 public function plugin_row_meta( $plugin_meta, $plugin_file ) { 107 140 if ( $this->plugin_name == $plugin_file ) { 108 $plugin_meta[] = sprintf('109 <a href="%1$s" target="_blank" title="%2$s">%2$s</a>',141 $plugin_meta[] = sprintf( 142 '<a href="%1$s" target="_blank" title="%2$s">%2$s</a>', 110 143 $this->donate_link, 111 __( 'Donate', $this->textdomain)144 __( 'Donate', 'obenland-wp' ) 112 145 ); 113 146 } … … 116 149 117 150 151 /** 152 * Displays a box with a donate button and call to action links. 153 * 154 * Props Joost de Valk, as this is almost entirely from his awesome WordPress 155 * SEO Plugin. 156 * @see http://plugins.svn.wordpress.org/wordpress-seo/tags/1.1.5/admin/class-config.php 157 * 158 * @author Joost de Valk, Konstantin Obenland 159 * @since 2.0.0 - 31.03.2012 160 * @access public 161 * 162 * @return void 163 */ 164 public function donate_box() { 165 $plugin_data = get_plugin_data( $this->plugin_path ); 166 ?> 167 <div id="formatdiv" class="postbox"> 168 <h3 class="hndle"><span><?php esc_html_e( 'Help spread the word!', 'obenland-wp' ); ?></span></h3> 169 <div class="inside"> 170 <p><strong><?php printf( _x( 'Want to help make this plugin even better? All donations are used to improve %1$s, so donate $20, $50 or $100 now!', 'Plugin Name', 'obenland-wp' ), esc_html($plugin_data['Name']) ); ?></strong></p> 171 <form action="https://www.paypal.com/cgi-bin/webscr" method="post"> 172 <input type="hidden" name="cmd" value="_s-xclick"> 173 <input type="hidden" name="hosted_button_id" value="G65Y5CM3HVRNY"> 174 <input type="image" src="https://www.paypalobjects.com/<?php echo get_locale(); ?>/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal Ñ The safer, easier way to pay online."> 175 <img alt="" border="0" src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" width="1" height="1"> 176 </form> 177 <p><?php _e( 'Or you could:', 'obenland-wp' ); ?></p> 178 <ul> 179 <li><a href="http://wordpress.org/extend/plugins/wp-approve-user/"><?php _e( 'Rate the plugin 5★ on WordPress.org', 'obenland-wp' ); ?></a></li> 180 <li><a href="<?php echo esc_url( $plugin_data['PluginURI'] ); ?>"><?php _e( 'Blog about it & link to the plugin page', 'obenland-wp' ); ?></a></li> 181 </ul> 182 </div> 183 </div> 184 <?php 185 } 186 187 188 /** 189 * Displays a box with feed items and social media links. 190 * 191 * Props Joost de Valk, as this is almost entirely from his awesome WordPress 192 * SEO Plugin. 193 * @see http://plugins.svn.wordpress.org/wordpress-seo/tags/1.1.5/admin/yst_plugin_tools.php 194 * 195 * @author Joost de Valk, Konstantin Obenland 196 * @since 2.0.0 - 31.03.2012 197 * @access public 198 * 199 * @return void 200 */ 201 public function feed_box() { 202 203 include_once( ABSPATH . WPINC . '/feed.php' ); 204 $feed_url = 'http://en.wp.obenland.it/feed/'; 205 $rss = fetch_feed( $feed_url ); 206 207 // Bail if feed doesn't work. 208 if ( is_wp_error( $rss ) ) 209 return; 210 211 $rss_items = $rss->get_items( 0, $rss->get_item_quantity( 5 ) ); 212 213 // If the feed was erroneously. 214 if ( ! $rss_items ) { 215 $md5 = md5( $feed_url ); 216 delete_transient( 'feed_' . $md5 ); 217 delete_transient( 'feed_mod_' . $md5 ); 218 $rss = fetch_feed( $feed_url ); 219 $rss_items = $rss->get_items( 0, $rss->get_item_quantity( 5 ) ); 220 } 221 ?> 222 <div id="formatdiv" class="postbox"> 223 <h3 class="hndle"><span><?php esc_html_e( 'News from Konstantin', 'obenland-wp' ); ?></span></h3> 224 <div class="inside"> 225 <ul> 226 <?php if ( ! $rss_items ) : ?> 227 <li><?php _e( 'No news items, feed might be broken...', 'obenland-wp' ); ?></li> 228 <?php else : 229 foreach ( $rss_items as $item ) : 230 $url = preg_replace( '/#.*/', '#utm_source=wordpress&utm_medium=sidebannerpostbox&utm_term=rssitem&utm_campaign=' . $this->textdomain, $item->get_permalink() ); ?> 231 <li><a class="rsswidget" href="<?php echo esc_url( $url ); ?>"><?php echo esc_html( $item->get_title() ); ?></a></li> 232 <?php endforeach; endif; ?> 233 <li class="twitter"><a href="http://twitter.com/obenland"><?php _e( 'Follow Konstantin on Twitter', 'obenland-wp' ); ?></a></li> 234 <li class="rss"><a href="<?php echo esc_url( $feed_url ); ?>"><?php _e( 'Subscribe via RSS', 'obenland-wp' ); ?></a></li> 235 </ul> 236 </div> 237 </div> 238 <?php 239 } 240 241 118 242 /////////////////////////////////////////////////////////////////////////// 119 243 // METHODS, PROTECTED … … 121 245 122 246 /** 123 * Hooks methods to their WordPress Actions and Filters 247 * Hooks methods to their WordPress Actions and Filters. 124 248 * 125 249 * @example: … … 128 252 * $this->hook( 'omg', 'is_really_tedious', 3 ); 129 253 * 130 * @author Mark Jaquith131 * @see http://sliwww.slideshare.net/markjaquith/creating-and-maintaining-wordpress-plugins132 * @since 1.5 - 12.02.2012133 * @access protected134 * 135 * @param string $hook Action or Filter Hook name136 * 137 * @return booleantrue254 * @author Mark Jaquith 255 * @see http://sliwww.slideshare.net/markjaquith/creating-and-maintaining-wordpress-plugins 256 * @since 1.5 - 12.02.2012 257 * @access protected 258 * 259 * @param string $hook Action or Filter Hook name. 260 * 261 * @return boolean true 138 262 */ 139 263 protected function hook( $hook ) { 140 $priority =10;141 $method =$this->sanitize_method( $hook );142 $args =func_get_args();264 $priority = 10; 265 $method = $this->sanitize_method( $hook ); 266 $args = func_get_args(); 143 267 unset( $args[0] ); // Filter name 144 268 145 269 foreach ( (array) $args as $arg ) { 146 if ( is_int( $arg ) ) { 147 $priority = $arg; 148 } 149 else { 150 $method = $arg; 151 } 270 if ( is_int( $arg ) ) 271 $priority = $arg; 272 else 273 $method = $arg; 152 274 } 153 275 154 276 return add_action( $hook, array( $this, $method ), $priority , 999 ); 155 277 } 156 157 158 /** 159 * Sets the donate link 160 * 161 * @author Konstantin Obenland162 * @since 1.1 - 03.04.2011163 * @access protected164 * 165 * @param string$donate_link_id166 * 167 * @return void278 279 280 /** 281 * Sets the donate link. 282 * 283 * @author Konstantin Obenland 284 * @since 1.1 - 03.04.2011 285 * @access protected 286 * 287 * @param string $donate_link_id 288 * 289 * @return void 168 290 */ 169 291 protected function set_donate_link( $donate_link_id ) { 170 $this->donate_link =add_query_arg( array(171 'cmd' =>'_s-xclick',172 'hosted_button_id' =>$donate_link_id292 $this->donate_link = add_query_arg( array( 293 'cmd' => '_s-xclick', 294 'hosted_button_id' => $donate_link_id 173 295 ), 'https://www.paypal.com/cgi-bin/webscr' ); 174 296 } 175 297 176 177 /**178 * Retrieve option value based on the environment.179 *180 * @author Konstantin Obenland181 * @since 1.4 - 23.12.2011182 * @access protected183 *184 * @param string $option_name Name of option to retrieve. Expected to not be SQL-escaped.185 * @param mixed $default Optional. Default value to return if the option does not exist.186 * @param boolean $use_cache Optional. Whether to use cache. Multisite only. Default true.187 *188 * @return mixed Value set for the option.189 */190 protected function get_option( $option_name, $default = false, $use_cache = true ) {191 192 $options = $this->get_options( $default, $use_cache );193 194 if ( isset($options[$option_name]) ) {195 return $options[$option_name];196 }197 198 return $default;199 }200 201 202 /**203 *204 * @author Konstantin Obenland205 * @since 1.5 - 12.02.2012206 * @access protected207 *208 * @param string $option_name Name of option to retrieve. Expected to not be SQL-escaped.209 * @param mixed $value Option value. Expected to not be SQL-escaped.210 *211 * @return boolen False if value was not updated and true if value was updated.212 */213 protected function set_option( $option_name, $value ) {214 $options = $this->get_options();215 $options[$key] = $value;216 217 if ( is_plugin_active_for_network($this->plugin_name) ) {218 return update_site_option( $this->textdomain, $options );219 }220 221 return update_option( $this->textdomain, $options );222 }223 224 225 298 /////////////////////////////////////////////////////////////////////////// 226 299 // METHODS, PRIVATE … … 228 301 229 302 /** 230 * Retrieve options based on the environment. 231 * 232 * @author Konstantin Obenland 233 * @since 1.5 - 12.02.2012 234 * @access private 235 * 236 * @param mixed $default Optional. Default value to return if the option does not exist. 237 * @param boolean $use_cache Optional. Whether to use cache. Multisite only. Default true. 238 * 239 * @return mixed Value set for the option. 240 */ 241 private function get_options( $default = false, $use_cache = true ) { 242 243 if ( is_plugin_active_for_network($this->plugin_name) ) { 244 $options = get_site_option( $this->textdomain, $default, $use_cache ); 245 } else { 246 $options = get_option( $this->textdomain, $default ); 247 } 248 249 return $options; 250 } 251 252 253 /** 254 * Sanitizes method names 255 * 256 * @author Mark Jaquith 257 * @see http://sliwww.slideshare.net/markjaquith/creating-and-maintaining-wordpress-plugins 258 * @since 1.5 - 12.02.2012 259 * @access private 260 * 261 * @param string $method Method name to be sanitized 262 * 263 * @return string Sanitized method name 303 * Sanitizes method names. 304 * 305 * @author Mark Jaquith 306 * @see http://sliwww.slideshare.net/markjaquith/creating-and-maintaining-wordpress-plugins 307 * @since 1.5 - 12.02.2012 308 * @access private 309 * 310 * @param string $method Method name to be sanitized. 311 * 312 * @return string Sanitized method name 264 313 */ 265 314 private function sanitize_method( $method ) { … … 267 316 } 268 317 269 } // End of class Obenland_Wp_Plugins 318 } // End of class Obenland_Wp_Plugins. 270 319 271 320 -
wp-last-login/trunk/readme.txt
r529901 r700584 1 1 === WP Last Login === 2 Contributors: kobenland2 Contributors: obenland 3 3 Tags: admin, user, login, last login, plugin 4 4 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=K32M878XHREQC 5 Requires at least: 3. 06 Tested up to: 3. 3.17 Stable tag: 1. 1.25 Requires at least: 3.1 6 Tested up to: 3.6 7 Stable tag: 1.2.0 8 8 9 9 Make the last login for each user visibile in the user overview. … … 12 12 13 13 This plugin adds an extra column to the users overview with the date of the last login for each user. 14 Additionally, users can be sorted by the date of their last login. 14 15 15 16 = Translations = … … 19 20 * Arabic 20 21 * Chinese 21 * Français 22 * Deutsch 22 * French 23 23 * English 24 * Español25 * Italian o24 * German 25 * Italian 26 26 * Japanese 27 27 * Nederlands 28 * Pol ski29 * Portugu ês30 * R omân28 * Polish 29 * Portuguese 30 * Rumanian 31 31 * Russian 32 * Spanish 32 33 33 34 … … 50 51 51 52 == Changelog == 53 54 = 1.2.0 = 55 * Users are now sortable by last login! 56 * Updated utility class. 57 * Added Danish translation. Props thomasclausen. 58 52 59 = 1.1.2 = 53 60 * Fixed a bug where content of other custom columns were not displayed. 54 61 55 62 = 1.1.1 = 56 * Updated utility class 63 * Updated utility class. 57 64 58 65 = 1.1.0 = 59 * Made the display of the column filterable 60 * Widened the column a bit to accomodate for large date strings 66 * Made the display of the column filterable. 67 * Widened the column a bit to accomodate for large date strings. 61 68 62 69 = 1.0 = 63 * Initial Release 70 * Initial Release. 64 71 65 72 -
wp-last-login/trunk/uninstall.php
r525795 r700584 1 1 <?php 2 // Don't uninstall unless you absolutely want to!3 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {2 // Don't uninstall unless you absolutely want to! 3 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) 4 4 wp_die( 'WP_UNINSTALL_PLUGIN undefined.' ); 5 }6 5 7 $user_ids = get_users(array(8 'blog_id' =>'',9 'fields' => 'ID'10 ) );6 $user_ids = get_users( array( 7 'blog_id' => '', 8 'fields' => 'ID', 9 ) ); 11 10 12 foreach ( $user_ids as $user_id ) {11 foreach ( $user_ids as $user_id ) 13 12 delete_user_meta( $user_id, 'wp-last-login' ); 14 }15 13 16 14 -
wp-last-login/trunk/wp-last-login.php
r529901 r700584 2 2 /** wp-last-login.php 3 3 * 4 * Plugin Name: WP Last Login5 * Plugin URI: http://en.wp.obenland.it/wp-last-login/?utm_source=wordpress&utm_medium=plugin&utm_campaign=wp-last-login6 * Description: Displays the date of the last login in user lists.7 * Version: 1.1.28 * Author: Konstantin Obenland9 * Author URI: http://en.wp.obenland.it/?utm_source=wordpress&utm_medium=plugin&utm_campaign=wp-last-login4 * Plugin Name: WP Last Login 5 * Plugin URI: http://en.wp.obenland.it/wp-last-login/#utm_source=wordpress&utm_medium=plugin&utm_campaign=wp-last-login 6 * Description: Displays the date of the last login in user lists. 7 * Version: 1.2.0 8 * Author: Konstantin Obenland 9 * Author URI: http://en.wp.obenland.it/#utm_source=wordpress&utm_medium=plugin&utm_campaign=wp-last-login 10 10 * Text Domain: wp-last-login 11 11 * Domain Path: /lang 12 * License: GPLv212 * License: GPLv2 13 13 */ 14 14 15 15 16 if ( ! class_exists( 'Obenland_Wp_Plugins_v15') ) {16 if ( ! class_exists( 'Obenland_Wp_Plugins_v301' ) ) 17 17 require_once( 'obenland-wp-plugins.php' ); 18 } 19 20 21 class Obenland_Wp_Last_Login extends Obenland_Wp_Plugins_v15 { 22 23 18 19 20 class Obenland_Wp_Last_Login extends Obenland_Wp_Plugins_v301 { 21 22 24 23 /////////////////////////////////////////////////////////////////////////// 25 24 // METHODS, PUBLIC 26 25 /////////////////////////////////////////////////////////////////////////// 27 26 28 27 /** 29 28 * Constructor 30 29 * 31 * @author Konstantin Obenland32 * @since 1.0 - 23.01.201233 * @access public34 * 35 * @return Obenland_Wp_Last_Login30 * @author Konstantin Obenland 31 * @since 1.0 - 23.01.2012 32 * @access public 33 * 34 * @return Obenland_Wp_Last_Login 36 35 */ 37 36 public function __construct() { 38 37 39 38 parent::__construct( array( 40 'textdomain' =>'wp-last-login',41 'plugin_path' =>__FILE__,42 'donate_link_id' => 'K32M878XHREQC'43 ) );44 39 'textdomain' => 'wp-last-login', 40 'plugin_path' => __FILE__, 41 'donate_link_id' => 'K32M878XHREQC', 42 ) ); 43 45 44 load_plugin_textdomain( 'wp-last-login', false, 'wp-last-login/lang' ); 46 45 47 46 $this->hook( 'wp_login' ); 48 47 49 48 /** 50 49 * Programmers: … … 56 55 * 57 56 * function prefix_wpll_visibility( $bool ) { 58 * return current_user_can( 'manage_options' ); // Only for Admins57 * return current_user_can( 'manage_options' ); // Only for Admins 59 58 * } 60 59 * add_filter( 'wpll_current_user_can', 'prefix_wpll_visibility' ); … … 62 61 */ 63 62 if ( is_admin() AND apply_filters( 'wpll_current_user_can', true ) ) { 64 65 $this->hook( 'manage_site-users-network_columns', 'add_column', 1 ); 66 $this->hook( 'manage_users_columns', 'add_column', 1 ); 67 $this->hook( 'wpmu_users_columns', 'add_column', 1 ); 68 $this->hook( 'admin_print_styles-users.php', 'column_style' ); 69 $this->hook( 'admin_print_styles-site-users.php', 'column_style' ); 70 $this->hook( 'manage_users_custom_column' ); 63 64 $this->hook( 'manage_site-users-network_columns', 'add_column', 1 ); 65 $this->hook( 'manage_users_columns', 'add_column', 1 ); 66 $this->hook( 'wpmu_users_columns', 'add_column', 1 ); 67 $this->hook( 'admin_print_styles-users.php', 'column_style' ); 68 $this->hook( 'admin_print_styles-site-users.php', 'column_style' ); 69 $this->hook( 'manage_users_custom_column' ); 70 $this->hook( 'manage_users_sortable_columns', 'add_sortable' ); 71 $this->hook( 'manage_users-network_sortable_columns', 'add_sortable' ); 72 $this->hook( 'request' ); 71 73 } 72 74 } 73 75 74 76 75 77 /** 76 78 * Update the login timestamp 77 79 * 78 * @author Konstantin Obenland 79 * @since 1.0 - 23.01.2012 80 * @access public 81 * 82 * @param string $user_login The user's login name 83 * 84 * @return void 85 */ 86 public function wp_login( $user_login ) { 87 $user = get_user_by( 'login', $user_login ); 80 * @author Konstantin Obenland 81 * @since 1.0 - 23.01.2012 82 * @access public 83 * 84 * @param string $user_login The user's login name 85 * 86 * @return void 87 */ 88 public function wp_login( $user_login, $user ) { 88 89 update_user_meta( $user->ID, $this->textdomain, time() ); 89 90 } 90 91 91 92 92 93 /** 93 94 * Adds the last login column to the network admin user list 94 95 * 95 * @author Konstantin Obenland96 * @since 1.0 - 23.01.201297 * @access public98 * 99 * @param array $colsThe default columns100 * 101 * @return array96 * @author Konstantin Obenland 97 * @since 1.0 - 23.01.2012 98 * @access public 99 * 100 * @param array $cols The default columns 101 * 102 * @return array 102 103 */ 103 104 public function add_column( $cols ) { 104 $cols[ $this->textdomain] =__( 'Last Login', 'wp-last-login' );105 $cols[ $this->textdomain ] = __( 'Last Login', 'wp-last-login' ); 105 106 return $cols; 106 }107 108 107 } 108 109 109 110 /** 110 111 * Adds the last login column to the network admin user list 111 112 * 112 * @author Konstantin Obenland113 * @since 1.0 - 23.01.2012114 * @access public115 * 116 * @param string $valueValue of the custom column117 * @param string $column_nameThe name of the column118 * @param int $user_idThe user's id119 * 120 * @return string113 * @author Konstantin Obenland 114 * @since 1.0 - 23.01.2012 115 * @access public 116 * 117 * @param string $value Value of the custom column 118 * @param string $column_name The name of the column 119 * @param int $user_id The user's id 120 * 121 * @return string 121 122 */ 122 123 public function manage_users_custom_column( $value, $column_name, $user_id ) { 123 124 124 125 if ( $this->textdomain == $column_name ) { 125 $last_login = get_user_meta( $user_id, $this->textdomain, true ); 126 126 $value = __( 'Never.', 'wp-last-login' ); 127 $last_login = (int) get_user_meta( $user_id, $this->textdomain, true ); 128 127 129 if ( $last_login ) { 128 $format = apply_filters( 'wpll_date_format', get_option('date_format') );129 returndate_i18n( $format, $last_login );130 $format = apply_filters( 'wpll_date_format', get_option( 'date_format' ) ); 131 $value = date_i18n( $format, $last_login ); 130 132 } 131 132 return __( 'Never.', 'wp-last-login' );133 133 } 134 134 135 135 return $value; 136 136 } 137 138 137 138 139 /** 140 * Register the column as sortable 141 * 142 * @author Konstantin Obenland 143 * @since 1.2.0 - 11.12.2012 144 * @access public 145 * 146 * @param array $columns 147 * 148 * @return array 149 */ 150 public function add_sortable( $columns ) { 151 $columns[ $this->textdomain ] = $this->textdomain; 152 153 return $columns; 154 } 155 156 157 /** 158 * Handle ordering by last login 159 * 160 * @author Silviu-Cristian Burca 161 * @since 1.2.0 - 11.12.2012 162 * @access public 163 * 164 * @param array $vars Request arguments 165 * 166 * @return array 167 */ 168 public function request( $vars ) { 169 if ( isset( $vars['orderby'] ) && $this->textdomain == $vars['orderby'] ) { 170 $vars = array_merge( $vars, array( 171 'meta_key' => $this->textdomain, 172 'orderby' => 'meta_value_num', 173 ) ); 174 } 175 176 return $vars; 177 } 178 179 139 180 /** 140 181 * Defines the width of the column 141 182 * 142 * @author Konstantin Obenland143 * @since 1.0 - 23.01.2012144 * @access public145 * 146 * @return void183 * @author Konstantin Obenland 184 * @since 1.0 - 23.01.2012 185 * @access public 186 * 187 * @return void 147 188 */ 148 189 public function column_style() { 149 190 ?> 150 191 <style type="text/css"> 151 .column-wp-last-login { width: 9%; }192 .column-wp-last-login { width: 12%; } 152 193 </style> 153 194 <?php 154 195 } 155 196 156 } // End of class Obenland_Wp_Last_Login197 } // End of class Obenland_Wp_Last_Login. 157 198 158 199
Note: See TracChangeset
for help on using the changeset viewer.