I could be missing something simple, but I'm pulling my hair out over this one. I have a simple user view with the uid and username fields -- no filters, no arguments, nothing. Just that.
No matter what I do, it only returns 10 users in the drop down for the userreference field. The view works fine in the the default preview, or as a block or a page, just not in the userreference field. I'm using views3 (current dev) and "user pager" is set to "all items".
If i do a dpm($result) on line 770 of userreference.module it returns 10 items. I tried setting the page (through the views ui) to 'specified number of items' and specifying a large number, as well as 'paged' with a large number and $result is always 10 items.
Also, the if I select a role based userreference field it works fine and displays all the appropriate users (more than 10, less than 10, whatever).
I know I can hard code the options with php, but that's a maintenance nightmare going forward.
Any suggestions on where else to look would be greatly appreciated.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | noderef_userref_limit_bug-1065128-15.patch | 1.17 KB | WorldFallz |
Comments
Comment #1
WorldFallz commentedafter much searching i did find #263936: Items per page not affecting list of nodes in referncednodes field -- but
$result = $view->execute_display($display, $view_args);is present in userreference.module so that's not it.Comment #2
WorldFallz commentedalso found #956964: Calling a view in code doesn't respect the $view->pager['use_pager'] flag -- but adding
$view->pre_execute($display, $view_args);makes no diff either.Comment #3
eriknewby commentedI have this exact same issue. Have a user reference field using a view which lists a group of users with a certain role. The view preview shows well over 40 users, while the user reference field on the form only shows 10 users no matter what.
This may have something to do with Views 6.x-3.x-dev which is what I upgraded to from Views2 stable recently. But that's only a guess.
Comment #4
WorldFallz commentedI did some more testing and it's definitely related to views 3. With views 2 both the view and the userreference field display with the proper amount of items. With views 3, the view works but the user reference field only displays 10 items no matter how many items are displayed.
I'm still combing through the code looking for where the problem might be, but any suggestions on where to look would be greatly appreciated.
Comment #5
WorldFallz commentedok, for some reason I decided to try it with nodereference fields and they have the same problem. I probably didn't notice it because all my nodereference fields use the content type checkboxes not views.
I also noticed when viewing the view previews (which work), the $view->query->pager object is 'views_plugin_pager_none' and when using devel to see the view object on the content type with the reference field it is 'views_plugin_pager_some.'
My guess is
$view->display_handler->set_option('items_per_page', $limit);(which appears in both node and user reference field modules) is no longer the way to set this option in views3.Comment #6
WorldFallz commentedI figured out a temporary fix-- not sure if this the 'correct' way, but it works.
In usereference.module or nodereference.module, just change
$view->display_handler->set_option('items_per_page', $limit);to$view->set_items_per_page($limit);Comment #7
WorldFallz commentedfyi, found that method here: #679622: changing items per page in embedded view
Comment #8
Vertex commentedgot same problem...
Thank you very much!
This patch works!
Comment #9
kevinob11 commentedAny chance we can get this committed??? Works great for me!
Comment #10
kristen pol#6 is confirmed by me. I found the bug and tried the same change before finding this issue. I'm using views3.
Kristen
Comment #11
darksnake747 commentedIts hacky... I wish there was a better resolution for this. Here is what I did to avoid changing CCK and/or Views.
Before looking for an issue on the matter I did a little testing on the widgets, and found that with the autocomplete (while still only returning 10 max options) does check all of the views options. So if you can just change the widget, it fixes the problem... though in practice a textbox is never really a good trade off for checkboxes... but for my case, I THINK it will be fine. To clarify, the reason this works is the other methods seem to just stop after returning 10 items (due to the limit / paging) but with the autocomplete it narrows what those options can be. So for example if you have an alphabetical list with 7 items for each letter, you would have been getting only your As and some Bs, but with autocomplete if you type T then it skips those and begins pulling from matches on that letter. The only set back I see right now is that it seems to use the CONTAINS setting and not the STARTS WITH... but again, for my needs, this is fine. I hope they fix this though.
-cheers-
Comment #12
g76 commentedsubscribe
Comment #13
Anonymous (not verified) commented#6 worked for me too. thanks a lot
Comment #14
noel.rivas commented#6 works fine for me
subscribe
Comment #15
WorldFallz commentedok, lets post a patch and get some maintainer review....
Comment #16
WorldFallz commentedrolled the patch against the 2.x branch, but it should apply to both.
Comment #17
cjback commented#6 worked for me too
Comment #18
bkno commentedPatch in #16 works for me in D6 with Views3dev.
Thank you WorldFallz!
Comment #19
mostou commentedPatch in #15 works for me with Views 6.x-3.0-rc2 and CCK 6.x-3.0-alpha3
Comment #20
PaulMagrath commentedPatch in #15 works for me with Views 6.x-3.0-rc3 and CCK 6.x-2.9.
Comment #21
kristen polSeveral folks said the patches work, but no one had changed the status so I'm doing that now.
Kristen
Comment #22
PaulMagrath commentedPatch in #15 works for me with Views 6.x-3.0 and CCK 6.x-3.x-dev (2012-Jan-12).
Comment #23
garbo commentedI can confirm that patch #15 works for me too!
Views 6.x-3.0 and CCK 6.x-3.0-alpha3 (2011-mrt-17)
Comment #24
rjbrown99 commentedThis is a duplicate of #998494: Node Reference field always displaying 10 results when using the Advanced View option. [views-6.x-3.x], and #28 on that issue has a patch that works with both views 2.x and 3.x.