When refreshing under http://localhost/admin/config/mostpopular/refresh
And after adding OS Similar Groups, when I tried to access configure block on OS Similar Groups,
I am getting the following error:

Fatal error: Call to undefined method SelectQuery::field() in C:\wamp\www\drupal-7.12\sites\all\modules\mostpopular\modules\mostpopular_drupal\mostpopular_drupal.module on line 66

Comments

sathyanext’s picture

Status: Needs work » Active
albertczyk’s picture

Same issue. I'm looking at the module, and it seems it's using some outdated interface of SelectQuery object. So far, I've tried to update it this way, but this only changes the error to "Warning: Attempt to assign property of non-object en mostpopular_refresh() (línea 1062 de /var/www/vhosts/mysite/sites/all/modules/mostpopular/mostpopular.module)." BTW, mostpopular.module has only 145 lines...

Still working on it...

+++ /var/www/vhosts/mysite/sites/all/modules/mostpopular/modules/mostpopular_drupal/mostpopular_drupal.module   2012-04-20 11:14:40.593666693 +0200
@@ -63,14 +63,14 @@
 
   // If we are looking at a single day, get the day stats
   if ($span <= 60 * 60 * 24) {
-    $query->field('c', 'daycount', 'count');
+    $query->addField('c', 'daycount', 'count');
     $query
       ->condition('c.daycount', 0, '>')
       ->orderBy('c.daycount', 'DESC');
   }
   // Otherwise, get the overall stats for nodes created since the last run.
   else {
-    $query->field('c', 'totalcount', 'count');
+    $query->addField('c', 'totalcount', 'count');
     $query
       ->condition('n.created', $ts, '>=')
       ->condition('c.totalcount', 0, '>')
@@ -142,4 +142,4 @@
  */
 function mostpopular_drupal_next_run($service, $span, $last_run) {
   return time();
albertczyk’s picture

StatusFileSize
new1.42 KB

I think I've fixed it. Additionally, mostpopular_drupal_refresh_viewed() was returning an array of arrays, while it should be an array of objects. Here goes the patch.

albertczyk’s picture

StatusFileSize
new1.46 KB

A new version of the patch, I've just changed the variable name.

sathyanext’s picture

Thank you very much for the patch:)
Let me try with this.

albertczyk’s picture

Assigned: Unassigned » albertczyk
Status: Active » Patch (to be ported)

You're welcome...
I'm rather new as a contributor to the issue management system of drupal.org, but I think that it won't hurt if I assign the bug to myself and change the status. Yes, for sure that it's written somewhere, but I don't have time right now to read the instructions.

markie’s picture

Assigned: albertczyk » Unassigned
Status: Patch (to be ported) » Needs work

Patch failed at line 42. Also please review the naming conventions for the patches. I'll see if I can manually update this information.

albertczyk’s picture

Status: Needs work » Needs review
StatusFileSize
new1.53 KB

OK, sorry! I've prepared a new patch and this one is well tested.

markie’s picture

Status: Needs review » Fixed

Thanks for taking care of that. Patch has been applied and pushed to the dev build. Please give it a try (may take 24 hours till build is complete)

Status: Fixed » Closed (fixed)

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