Urgent help with bbPress count
-
I’m trying to display user count and total topics created and replies by all users in my web site header but I could not
Please help me out
I will like to display it like this
Our (1000)users have created (100)topics with (100)replies
-
thanks for your post.
Without knowing your level of coding or otherwise, it’s hard to know how much help you want.
This code gives a shortcode and function to do that
add_shortcode ('kiki-stats' , 'kiki_show_stats' ) ; function kiki_show_stats() { $user_count = count_users(); $users = $user_count['total_users'] ; $topic_count = wp_count_posts('topic'); $topics = $topic_count->publish; $reply_count = wp_count_posts('reply'); $replies = $reply_count->publish ; $text = 'Our '.$users.' users have created '.$topics. ' topics with '.$replies.' replies.' ; echo $text ; }Put this in your child theme’s function file – or use
https://en-gb.ww.wp.xz.cn/plugins/code-snippets/then in a postm page or widget put
[kiki-stats]and see that it works
if using in code just call the function
kiki_show_stats() ;if none of that makes sense, come back
I’m using it in code
Is this right?
<?php kiki_show_stats(); ?>yep that should work
Thanks it worked is there a way I can apply css tag to it
God bless u for helping me out, I have been trying to display the count but was unable to thanks for the help
yes just change this line
$text = 'Our '.$users.' users have created '.$topics. ' topics with '.$replies.' replies.' ;to
$text = '<div class="my-style">Our '.$users.' users have created '.$topics. ' topics with '.$replies.' replies.</div>' ;and change the word my-style to whatever name you want
I got it thanks alot I can I ask for another help
you can always ask……. 🙂 🙂
Thanks
So first
Is there a way I can display
Total user online currently and guest a + time spent online on front-page.phpLike this
Members Online:
user 1,user 2 user 3, user 4, user 5,user 6,user 7,user 8,user 9, user 10
(3552 Members and 8030 Guests online in last 5 minutes!)And also in single-topic page I will like to display
Total user user viewing this
For example :
User viewing this topic :user 1,user 2 user 3, user 4, user 5,user 6,user 7,user 8,user 9, user 10 (total user viewing this (100) + 023 guest)hmmm….far from easy due to some basics
WordPress can only log user activity – ie when a user does something within the site. The major issue with this is that a user shutting down a tab on their browser does nothing on the WordPress site so users can appear on line when they are not.
There are plugins that do achieve total users on line, but again the stats are not particularly accurate. eg
https://ww.wp.xz.cn/plugins/wp-useronline/
as for users viewing a particular topic, that would need customised code beyond any free help, and will give you a false impression – having a topic open in a tab does not mean a user is actually doing anything – they may well be watching TV in another room
I really understand thanks for the help and fast response
I have been trying to customize the author image in single-topic, like this one currently that’s WordPress is using border-radius to make the author image circle I couldn’t figure mine out all author image are in square form in my site
put this in the custom css tab of my plugin
#bbpress-forums div.bbp-forum-author img.avatar, #bbpress-forums div.bbp-reply-author img.avatar, #bbpress-forums div.bbp-topic-author img.avatar { border-radius: 50%; } #bbpress-forums #bbp-single-user-details #bbp-user-avatar img.avatar { border-radius: 50%; }Thanks alot
How can i get bbpress user full name
sorry, can you post this in the bbpress forum as it relates to bbpress rather than my plugin
The topic ‘Urgent help with bbPress count’ is closed to new replies.