Hi,

I was wondering if this module is compatible with Views 3?
I'm looking to move over and find many major contrib modules have added compatibility.

Thanks!

Comments

robby.smith’s picture

Copy and pasting the threads where other contrib modules added compatibility (list was compiled by someone else)
CCK - http://drupal.org/node/670344
Flag - http://drupal.org/node/673508
Content Profile - http://drupal.org/node/670092
Better Exposed Filters - http://drupal.org/node/641964
Project - http://drupal.org/node/716656
Project Issue Tracking - http://drupal.org/node/716658
Hierarchical Select - http://drupal.org/node/729858
Date - http://drupal.org/node/698522

liam mcdermott’s picture

Category: support » bug

Thanks for raising this, I haven't done any work on Views 3 compatibility, yet. Do you know if the API is stable?

robby.smith’s picture

Hi Liam,

I have been using Views 3 a lot recently and haven't had much issues with those modules listed above and with others. There is a Views 6.x-3.0-alpha3 already released and the dev version is actively updated (I'm using dev at the moment). I'm not familiar with programming so not sure about your question about API being stable (sorry!). From reading through the other contrib modules that added compatibility, it seemed like some minor stuff like the function to save the options in the settings for relationships and filters etc. needed a change.

I find the User Stats module to be great as it adds the much needed user statistics and the views integration allows the info to be used as filters in displaying users on a site.

Thank you!

kwinters’s picture

"API is stable?" = "will they change the names of functions and break all my hard work?"

Since it's on Alpha 3, the answer is: maybe, but probably not.

robby.smith’s picture

I see I see, they probably won't change as there are many modules depending on Views and the views team is very good about keeping things under control =)

YK85’s picture

subscribing

rburgundy’s picture

Hi,

I don't see these in views 3:
days registered;
join date;
days since last login;
days since last post;
post count;
login count;
user online/offline;
IP address;

I only see these as fields
User Stats: Statistic name
User Stats: Value

And filters
User Stats: Statistic name

Im using view type: User

Thank you very much

rburgundy’s picture

any update? thanks so much

SeanBannister’s picture

@rburgundy I noticed you mentioned that you only see:

User Stats: Statistic name
User Stats: Value

in Views 3. Can you check what you see in Views 2 as I only see these two options in Views 2. I'm also interested in a Views 3 version. But the reason I found this post was for an unrelated reason, looking for "days registered" in views.

rburgundy’s picture

Hi SeanBannister,

I'm not sure as I only use Views 3. But from your explanation it is the same problem in Views 2?

I wonder how to get these fields:
days registered;
join date;
days since last login;
days since last post;
post count;
login count;
user online/offline;
IP address;

rburgundy’s picture

I found out the below information from testing..very confusing stuff(!)

login count = User Stats: Value <= wish this was better named
days since last login; = User: Last login or User: Last access" with Date format as 'time ago'
user online/offline; = User: Is online

still can't find:
days registered;
join date;

SeanBannister’s picture

Priority: Normal » Major

@rburgundy: I ended up solving my problem, turns out Views calls it "User: Created date". Can't believe I missed it.

SeanBannister’s picture

Priority: Major » Normal

opps

chuckbar77’s picture

+1 subscribing

Bilmar’s picture

#910596: Views Cannot Sort by "Is Online" looks to also be a Views 3 compatibility issue.
subscribing

liam mcdermott’s picture

I am itching to get working on this, but am lacking time at the moment. I'll make time if someone can make a patch, however.

chuckbar77’s picture

marked #910596: Views Cannot Sort by "Is Online" a duplicate of here
hope someone with programming skills can help us out with this one =)

Amy_M’s picture

Subscribing

chuckbar77’s picture

Kindly bumping.

fadgadget’s picture

subscribing

broncomania’s picture

subscribing

ChrisValentine’s picture

I too am wanting this module to work (better) with Views 3. I want to add a block to a users' page to display all of the following:

Last login date (I have that working)
Date of last posting (or number of days ago)
Number of posts
Number of logins

I make use of "User Stats: Value" in the fields of the view but the number I get back appears meaningless. If I apply a Filter the block vanishes.

I also tried creating this just in a custom Block with the PHP filter enabled and example code snippets from the aPaddedCell site but that just resulted in the "UID is not a number error":

Post count: <?php print user_stats_get_stats('post_count', $node->uid); ?>

reysharks’s picture

Hey guys,

i've modified the file: views_handler_filter_is_online.inc for working with views 3. All i need is filtering online/offline users so this works only for the view filter but it can be useful.


/**
 * @file
 * User Stats is user online sort handler.
 */

/**
 * Is user online sort handler.
 */
class views_handler_filter_is_online extends views_handler_filter_boolean_operator {
  function query() {
    $this->ensure_my_table();
    $join = new views_join;
    $join->construct('sessions', $this->table_alias, 'uid', 'uid', array());
    $session = $this->query->ensure_table('sessions', NULL, $join);
    // We have to make sure this field is in the query, and Views knows to
    // create GROUP BY's.
    $sql_field_part = "IF((" . REQUEST_TIME . " - MAX($session.timestamp)) < " . variable_get('user_block_seconds_online', 900) . ", 1, 0)";
    $this->query->add_field(NULL, $sql_field_part, $this->table_alias . '_' . $this->field, array('aggregate' => TRUE));
	
	$sql_field = $this->table_alias . '_' . $this->field;

    $this->query->distinct = TRUE;
    if ($this->value == 1) {
      // Is online.
      $sql_value = 1;
    }
    else {
      // Is offline
      $sql_value = 0;
    }

    $this->query->add_having($this->options['group'],$sql_field, $sql_value);
  }

  /**
   * Override default True/False options.
   */
  function get_value_options() {
    $this->value_options = array(
      1 => t('Online'),
      0 => t('Offline'),
    );
  }
}