Paging doesn't quite work on the 'Subscribers' list (admin/people/simplenews), all pages just display the first page.

I can fix it by editing includes/simplenews.admin.inc file in simplenews module directory (simplenews/includes/simplenews.admin.inc)

Edit line 164 and 1106 to:
->limit(0)

Comments

Mantalo Conseil’s picture

Hello,

It makes me a 500 error when I alter includes/simplenews.admin.inc as you wrote ...

Karsa’s picture

Could you detail this further?
Any errors in the webserver (apache) log? Are you certain you didn't put any syntax errors in your code?

harald_’s picture

This Code can't work.

limit / orderByHeader be called before PagerDefault / TableSort Object exists.

Btw: Can not reproduce your Problem under 7.x-2.x-dev BUT had something similar problem with 7.x-1.1 in connection with simplenews_relname module.

gilsbert’s picture

Hi.

I also confirm that the issue happens with 7.x-1.1 in connection with simplenews_realname (7.x-1.1 alone doesn't have this issue).
Perhaps this post should be redirected to simplenews_realname project?

Here https://drupal.org/node/2201387 you can read what is happening with the SQL statement when the issue's scenario (7.x-1.1 plus simplenews_realname) is present at the site.

I did not test 7.x-2.x.

Regards,
Gilsberty

kolyapatrik’s picture

This is the soultion

Open includes/simplenews.admin.inc file in simplenews module directory (simplenews/includes/simplenews.admin.inc)

Edit line 164 and 1106 to:
->limit(0)

kolyapatrik’s picture

Issue summary: View changes
Status: Needs work » Needs review
areynolds’s picture

Can confirm that this fixes my issue.

polmaresma’s picture

#5 solves the problem on my setup too.
Thank's

mattf100’s picture

I also confirm that the issue happens with 7.x-1.1 in connection with simplenews_realname.

I changed the code as per #5, but now I see the following error on the page (doesn't matter if first or second page):

Warning: Invalid argument supplied for foreach() in simplenews_subscription_list_form() (line 1115 of .../sites/all/modules/simplenews/includes/simplenews.admin.inc).

jking1224’s picture

I also confirm that the issue happens with 7.x-1.1 in connection with simplenews_realname (7.x-1.1 alone doesn't have this issue).

I think the problem to be fixed is in file: simplenews_realname.module inside function simplenews_realname_form_alter()
But I don't know enough about Drupal code to deal with it. I fiddled around about line 90 or so, and got partially right result, but couldn't fix it.

egarbeil’s picture

I ran into this issue too - the codefix above will fix the problem. Also, disabling and uninstalling the simplenews realname module fixes it if that is an option. We had 2 clients and tried both options. It works both ways.

The ideal would be to incorporate the fix into the realname module.

mp’s picture

"solution" #5 "works" BUT i get also the same error like #9

Warning: Invalid argument supplied for foreach() in simplenews_subscription_list_form() (line 1113 of [PATH2WEBSITE]/sites/all/modules/simplenews/includes/simplenews.admin.inc).

gnepfedrukka’s picture

The Problem is that the wrong pager element will be used, and not the first one.

Open simplenews_realname.module file in simplenews realname module directory (simplenews_realname/simplenews_realname.module)

Around line 109 change:
$result = $query->fields('sn', array('snid', 'activated', 'mail', 'uid', 'language'))
->fields('sr', array('realname'))
->limit(30)
->orderByHeader($header)
->execute();
to
$result = $query->fields('sn', array('snid', 'activated', 'mail', 'uid', 'language'))
->fields('sr', array('realname'))
->limit(30)
->element(0)
->orderByHeader($header)
->execute();

jking1224’s picture

I confirm #13 works for me.
Simplenews 7.x-1.1 realname 7.x-1.0-alpha2
added that single line of code.
Thanks gnepfedrukka.