'; } add_action('admin_head', 'stats_function'); } add_option("alex_user_counter_settings", "We have NUMBER_OF_USERS users and counting!"); //menu stuff add_action('admin_menu', 'alex_counter_menu'); function alex_counter_menu(){ add_options_page( 'User Counter Settings', 'User Counter Settings', 'manage_options', 'alex-user-counter', 'alex_user_counter_function'); } //shortcode stuff add_shortcode( 'alex_user_counter', 'alex_counter_widget_function' ); //widget stuff function alex_counter_widget_function() { global $wpdb; $wpdb->get_results( "SELECT * FROM $wpdb->users" ); $number = number_format($wpdb->num_rows); $text = get_option("alex_user_counter_settings"); $text = str_replace("NUMBER_OF_USERS" , $number, $text); echo '

' . $text . '

'; } register_sidebar_widget('Alex User Counter Widget', 'alex_counter_widget_function'); function alex_user_counter_function(){ echo '
'; if(isset($_REQUEST['user_count_info'])){ update_option("alex_user_counter_settings", $_REQUEST['user_count_info']); echo 'Settings Updated!'; } echo '

Paste [alex_user_counter] where you want the number of users to show up in posts or pages.

'; echo '

Paste "NUMBER_OF_USERS" without quotes wherever you want the number of users in the form below.

'; echo '
'; echo '

What do you want it to say?

'; echo '

'; echo '

'; echo '
'; echo 'Please visit my site http://www.strangebutfunny.net/'; echo '
'; } ?>