I want to add a column for number of posts to a user view so I looked to see what was provided by User Stats to Views and I see:

User Stats: Statistic name
The unique statistic name
User Stats: Value
Statistic value

It seems like "value" is the one that I want since "name" just prints either "login_count" or "post_count" where "value" prints the actual number. But there seems to be no way to tell it which one I want and so I get one row for "login_count" and one row for "post_count". Am I missing something?

Thanks,

Michelle

Comments

liam mcdermott’s picture

Sorry for not replying to this sooner.

How does the Views integration work?

Badly! I didn't really implement this very well, it will be re-written at some point (though I'm concentrating on other modules at the moment).

You use the Statistic value as the field, then use Statistic name as a filter, so you only get the values you want.

Really there should be one Views field per-statistic, that would make a lot more sense. :)

michelle’s picture

Status: Active » Fixed

Hmm... So I guess there's no way to get both the login count and the number of posts on the same row. Yeah, one field per stat would be good. :) This isn't a super high priority for me but, if I happen to get to it before you do, I'll post a patch. I'll mark this fixed for now since the question is answered.

Thanks,

Michelle

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

twistedindustries’s picture

Category: support » bug
Status: Closed (fixed) » Active

I would like to point out that I followed the instructions above and that worked great. But when I add more users via user import they are filtered out. Additionally if I remove the statistic name filter my missing users come back and are listed only once with a zero where all other users are listed twice like described originally. Any fix for this?

I was going to open a new bug report for this but it seemed easier to describe here in this issue.

liam mcdermott’s picture

Category: bug » support
Status: Active » Closed (fixed)

I was going to open a new bug report for this but it seemed easier to describe here in this issue.

Ah, you should have done that. This support request is only about User Stats' Views integration being really weird and whacky, your bug report is about it being broken, completely separate issues! :)

Now we're sending e-mails to Michelle on an issue she doesn't care about and I'm going to get confused about which bugs I've fixed and which I haven't.

If you wouldn't mind, please copy and paste your comment into a new issue, think up a clever title and I'll have a look at it. Thanks!

drupalfan2’s picture

Status: Closed (fixed) » Active

Still the same problem:

How can I show user stats value in a view without a patch? Can you correct this in dev version?

liam mcdermott’s picture

Title: How does the Views integration work? » Views integration should provide one field per statistic
Category: support » bug

How can I show user stats value in a view without a patch?

You don't need a patch.

Can you correct this in dev version?

Strictly speaking, there's nothing to correct. The View integration sucks but does work, if you follow the instructions in #1. I know it's confusing, sorry. :)

Since I do intend to change this so it makes sense, instead of being really esoteric, am changing this to a bug report.

michelle’s picture

That would be great. I never did get this to work without having duplicate entries and ended up using something else in that spot. I would like to be able to use this in the future, though.

Thanks,

Michelle

liam mcdermott’s picture

I never did get this to work without having duplicate entries and ended up using something else in that spot.

In that case, sorry for my previous post, I was wrong. It sucks and doesn't work! :)

michelle’s picture

Well, I wasn't able to get it to work. That doesn't mean it's broken; I could have been doing it wrong. :)

At any rate, a more robust field would be much appreciated once you have the time for it. I'm planning on doing the members landing page and would like to be able to make use of this integration.

Michelle

tim.plunkett’s picture

Subscribe.

Drake’s picture

I set filter User Stats: Statistic name = post_count and now I get only one field returining the value of user posts.

Stan.Ezersky’s picture

Subscribe

jeffschuler’s picture

subscribe

drupalfan2’s picture

Priority: Normal » Critical
Status: Active » Needs work

In current dev version this problem is still not solved. Why?
This is not a great thing.

How can it be solved per patch?

michelle’s picture

Priority: Critical » Normal
Status: Needs work » Active

Settle down. Goodness. Remember that maintainers are volunteers. Maybe he's been busy. Maybe he doesn't know how to fix it. If it's critical to you, you could always offer a bounty or hire someone to fix it. Otherwise be patient.

Michelle

liam mcdermott’s picture

In current dev version this problem is still not solved. Why?

Sorry I haven't had time to fix this, I have started but am also busy with other work.

Unfortunately, bumping issues up to critical and being rude isn't going to make me less busy. And, as Michelle pointed out, I'm just a volunteer. :(

lavamind’s picture

Status: Active » Needs review
StatusFileSize
new2.75 KB

Here's a patch that might help. Instead of 'name' and 'value' view fields, you can use a kind of table alias to get the data for one type of statistic, even if it's in a single table.

Please review!

jeffschuler’s picture

Thanks lavamind!
This patch is working well for me for displaying Post Count.

YK85’s picture

subscribing

liam mcdermott’s picture

Status: Needs review » Needs work

This is similar to what I'd like to do, but for all fields. The idea is to loop through all the field names, building the Views array automatically.

The problem with the approach in this patch is it doesn't allow for dynamically added, new stats (like those gathered via our hook in user_stats_get_stats() for example).

Anyone wanting this feature OMGNOW!1!11one should use this patch though. Just don't build too many views based on it, because when I finally commit a permanent fix it may break them. :)

sp09’s picture

Drake's solution worked perfectly for me :)

joachim’s picture

> The idea is to loop through all the field names, building the Views array automatically.

Wouldn't the better fix to be to normalize the database table so you have one field per value and one row per user? I'm not sure why you need the current key/value schema, as every user statistic seems to be one-to-one with a user.

TripleEmcoder’s picture

Are there actually any modules that add additional user_stats dynamically and require the schema to be the way it is?

markwk’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
StatusFileSize
new2.95 KB

Here's the previous patch update to apply to D7 Branch. I think this is the correct way for this to function. Filtered by seems messy and unnecessary considering what most folks will be doint.

imoreno’s picture

Hi,
Thank you for your patch.
While this patch does provide the number of posts field, it doesn't display anything in the view results. i suspect this patch misses something, it should display my field title at least..... but it doesn't display anything.

could you please double check that this patch was ported to D7 correctly?

BR
Itzhak

imoreno’s picture

update,
It does work for me, just the title is missing.

I had to reset the post counter, than run cron X times to gather all the information about the users, and now it is working as expected - it displaying the correct number of post.

THX!
Itzhak

drupalfan81’s picture

Hi guys,

thanks for the awesome module, but as the original poster, I would like to get more out of the views. Has there been any progress or way to work around this?

Currently, I am able to display the user's post_count by adding that to a filter and then add the statistic value to as a field. But as mentioned above, there is no way to add another value such as login_count. I would like to have a view to display all my users in a table with columns showing their last login, their post count, their login count, etc. All in one table that I can sort on and filter.

Any idea how I can do this?

Thanks!

drupalfan81’s picture

Issue summary: View changes

Oh btw, just to share, what I have done for now, is just expose the filter so that I can change the statistic name to change it on the fly to see the other values I want to check out. But again, I can only look at one at a time...which is just a bummer.