Ticket #14 (new enhancement)
Allow a variable number of items per page
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | interface | Version: | |
| Keywords: | has-patch, needs-review | Cc: | joostdevalk |
Description (last modified by nbachiyski) (diff)
GlotPress should let the user decide how many items to display per page.
For example: 5-20-50-100 etc...
Attachments
Change History
comment:2
nbachiyski — 20 months ago
- Priority changed from major to normal
- Milestone set to Future Release
comment:3
joostdevalk — 4 months ago
I came up with a patch for this today as the default 15 annoyed the heck out of me and a lot of people. Attached patch adds a /profile page where people can set how many items they want displayed on a page, currently stored in a cookie.
comment:4
joostdevalk — 4 months ago
Biggest issue I have with the patch myself is that it's stored in a cookie. In WP core I'd use a user_meta, I didn't see an API for that in GP yet (even though there is a gp_usermeta table), but I think that'd be the way to go. If we had that we could also store a default sort.
comment:6
nbachiyski — 4 months ago
See GP_User::get_meta() and its friends.
comment:7
joostdevalk — 4 months ago
Ok found that indeed, couple of issues that needed fixing to get this to work:
- get_meta, set_meta and delete_meta all assumed $this->id was filled, when it wasn't in this case, so switched them over to first using the current method of GP_User.
- gp_update_meta always returned false when $global wasn't set, which it isn't when called from GP_User, so I removed that check.
- GP_Thing's sql_limit_for_paging method first correctly set its internal $per_page variable to then use $this->per_page for the query, fixed.
- GP_Translation now checks whether there's user setting per_page and uses that value, otherwise it reverts to its default.
joostdevalk — 4 months ago
-
attachment
glotpress-profile-2.patch
added
version 3, adding in sort options
comment:9
joostdevalk — 4 months ago
Just found a bug in pagination, tracking down, don't commit patch yet.
comment:10
joostdevalk — 4 months ago
Pagination issue found and fixed, actually fixed it by implementing the $per_page fix cleaner and earlier, before getting the translations.
comment:11
joostdevalk — 4 months ago
This last patch adds a redirect for non-logged in users to the login page when they try to open the /profile page.
