User photo plugin (optional). Author: Debashish Chakrabarty Author URI: http://www.debashish.com Min WP Version: 2.7 */ //----------------------------------------------------------------------------- ?> ID, $authordata->user_nicename ); $options = get_option('authorprofile_widget'); // get options echo $before_widget; echo $before_title . $options['title'] . $after_title; echo '
'._e('Title'); echo ''; echo '
'; echo ''._e('"Website" text'); echo ''; echo '
'; echo ''._e('"More articles by author" text'); echo ''; echo '
'; echo ''._e('Author profile character limit'); echo ''; echo '
'; echo ''._e('"Read full profile" text'); echo ''; echo '
'; echo 'Note: To display custom photos with User Profiles, please install/activate the User photo plugin and upload the photo from profile page.
'; echo ''; } // activate and deactivate plugin function authorprofile_activate() { // options, default values $options = array( 'widget' => array( 'title' => 'Author Spotlight', 'moretext' => 'More posts by the Author »', 'readfulltext' => 'Read Full', 'websitetext' => 'Website: ', 'charlimit' => 1000 ) ); // register option add_option( 'authorprofile_widget', $options['widget'] ); // activated return; } function authorprofile_deactivate() { // unregister option delete_option('authorprofile_widget'); // deactivated return; } // initialization function authorprofile_init() { // register widget $class['classname'] = 'authorprofile_widget'; wp_register_sidebar_widget('post_author_profile', __('Author Spotlight'), 'authorprofile_widget', $class); wp_register_widget_control('post_author_profile', __('Author Spotlight'), 'authorprofile_widget_control', 'width=200&height=200'); // initialization done return; } function snippet($text, $length=1000, $tail="...") { $text = trim($text); $txtl = strlen($text); if($txtl > $length) { for($i=1;$text[$length-$i]!=" ";$i++) { if($i == $length) { return substr($text,0,$length) . $tail; } } $text = substr($text,0,$length-$i+1) . $tail; } return $text; } // actions add_action( 'activate_'.plugin_basename(__FILE__), 'authorprofile_activate' ); add_action( 'deactivate_'.plugin_basename(__FILE__), 'authorprofile_deactivate' ); add_action( 'init', 'authorprofile_init'); ?>