Add elements to the statistics area
Quote from Asgaros on December 29, 2016, 11:59 amThe asgarosforum_statistics_custom_element hook allows you to add custom elements to your statistics area.
You want to add a new element which shows you the number of forums? Simply add the following code to your themes functions.php file:
function my_custom_statistics_element() { global $asgarosforum; $data = $asgarosforum->db->get_var("SELECT COUNT(id) FROM {$asgarosforum->tables->forums}"); AsgarosForumStatistics::renderStatisticsElement('Forums', $data, 'dashicons-editor-justify'); } add_action('asgarosforum_statistics_custom_element', 'my_custom_statistics_element');
The asgarosforum_statistics_custom_element hook allows you to add custom elements to your statistics area.
You want to add a new element which shows you the number of forums? Simply add the following code to your themes functions.php file:
function my_custom_statistics_element() { global $asgarosforum; $data = $asgarosforum->db->get_var("SELECT COUNT(id) FROM {$asgarosforum->tables->forums}"); AsgarosForumStatistics::renderStatisticsElement('Forums', $data, 'dashicons-editor-justify'); } add_action('asgarosforum_statistics_custom_element', 'my_custom_statistics_element');
Quote from hillbillybonez on December 30, 2016, 2:44 amgoing to try this soon, Any way to add a whos on line to it?
going to try this soon, Any way to add a whos on line to it?
Quote from Yworld on December 30, 2016, 7:36 amQuote from hillbillybonez on December 30, 2016, 2:44 amgoing to try this soon, Any way to add a whos on line to it?
Install the plugin – WP-UserOnline
- option
add_action('asgarosforum_statistics_custom_element', 'my_function_footer', 10, 1); function my_function_footer() { echo 'your code'; }Examples here https://wordpress.org/plugins/wp-useronline/faq/
2. option
Install the plugin – amr shortcode any widget and WP-UserOnline
add_action('asgarosforum_statistics_custom_element', 'my_function_footer', 10, 1); function my_function_footer() { echo '<div class="af-topic-icons">'.do_shortcode('[do_widget id=useronline-4]').'</div>'; }[do_widget id=useronline-4] – replace
Quote from hillbillybonez on December 30, 2016, 2:44 amgoing to try this soon, Any way to add a whos on line to it?
Install the plugin – WP-UserOnline
- option
add_action('asgarosforum_statistics_custom_element', 'my_function_footer', 10, 1); function my_function_footer() { echo 'your code'; }
Examples here https://wordpress.org/plugins/wp-useronline/faq/
2. option
Install the plugin – amr shortcode any widget and WP-UserOnline
add_action('asgarosforum_statistics_custom_element', 'my_function_footer', 10, 1); function my_function_footer() { echo '<div class="af-topic-icons">'.do_shortcode('[do_widget id=useronline-4]').'</div>'; }
[do_widget id=useronline-4] – replace
Quote from hillbillybonez on December 30, 2016, 12:58 pmsweet thanks very much
sweet thanks very much
Quote from Apos37 on October 14, 2019, 10:00 pmHow can I remove the number of Users and replace it with the number of the current user’s Unread Messages?
Also, how can I remove the Newest Member?
How can I remove the number of Users and replace it with the number of the current user’s Unread Messages?
Also, how can I remove the Newest Member?
Quote from Asgaros on October 16, 2019, 7:22 pmHello @gogrw
Counting the unread-messages requires to iterate over all existing topics/posts and filter them based on access-settings like permissions and usergroups which requires a lot of custom-code. Because this is performance-heavy logic, I don’t suggest you to add this to your homepage.
Regarding the newest member I will add an option for it to the next update to hide it.
Hello @gogrw
Counting the unread-messages requires to iterate over all existing topics/posts and filter them based on access-settings like permissions and usergroups which requires a lot of custom-code. Because this is performance-heavy logic, I don’t suggest you to add this to your homepage.
Regarding the newest member I will add an option for it to the next update to hide it.