Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
How to show users' discussions count through Vanilla Statistics dashboard.
Prosper
✭✭
How can users' discussions count through Vanilla Statistics be shown on the dashboard just like the users' comment count?
I have tried adding <td><?php echo number_format($User->CountComments); ?></td>
but erroneously showed discussion counts to be zeros.
Tagged:
0
Comments
Where did you try adding this?
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
@hgtonight
Sorry for my mistake, the correct code I tried adding is
<td><?php echo number_format($User->CountDiscussions); ?></td>
on /plugins/VanillaStats/views/dashboardsummaries.php but got all zeros users' discussion counts on the dashboard.Probably not a good idea to change staff plugins that come with core, unless they are broken.
but you need to know a few things. you can't show data that you don't have. You need to retrieve it first if you want to show it.
I haven't tested nor do I suggest you do it, but it couldn't possibly work what you want if the data is not retrieved first and handed to the view. .
see this UserData is set here.
https://github.com/vanilla/vanilla/blob/Vanilla_2.2.1/plugins/VanillaStats/class.vanillastats.plugin.php#L181
notice there is not a CountDiscussions selected from the User table above. if you want it you need to select it in the setData. change the ->select('u.UserID, u.Name') to include what ever user column you want in the class.vanillastats.plugin.php
so it can be read here in the summaries
notice the for each for the userdata here:
https://github.com/vanilla/vanilla/blob/Vanilla_2.2.1/plugins/VanillaStats/views/dashboardsummaries.php#L35
Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.
@River - thank you for your comment. I am not exactly a developer. What code should I modify, remove or add to achieve my aim of showing the discussions statistic for each user on the dashboard? Can a new plugin do it?
I was hesitant to answer you in the post, because you would get the wrong impression, that I was going to solve your problem. I was basically just showing you how it could not possibly work just with your change. You would need to think out the logic, if you want something based on user discussion count for a specific time period. if you just want total Discussion count for a user you can use an existing plugin. If you just care about total Discussion count for a user you can pull it from User Table.
The logic for selecting probably needs to come from the Discussion table if you are selecting based on a time period.
Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.
@River - I want to select discussion counts for each user based on a time period not total discussion just like the comments are selected based on time period on the bashboard. Thanks for you comments anyway.
That graph is generated by Vanilla Inc.'s servers. You can still modify it, but it would take a lot of effort and reverse engineering.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
@hgtonight - how about a new plugin that can generate discussion and comment counts for users based on selected time period?
Sounds like a great idea; I can't wait to see it
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Yes it is a great idea. Unfortunately, I am not a developer. Please can someone work on this plugin?
Become one. Read a sql tutorial. Select the discussions created based on insertion date and sort by user.
You should be able to figure out a sql statement to do this via .
http://www.sqlcourse.com/
http://www.w3schools.com/sql/
You have just been given permission to enrich your mind. Never say no, and don't say you can't do it. put your mind to it and prosper.
http://www.w3schools.com/sql/sql_where.asp
get a copy of phpmyadmin working and you can determine columns from tables and run sql statements. you can run select statements without altering your database (backup database if you are altering).
Pragmatism is all I have to offer. Avoiding the sidelines and providing centerline pro-tips.
@Prosper We'll be here if you need help.
This is a great sentiment.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.