We should add pagination to the pending relationships page to prevent it from getting super long and to keep it consistent with the relationships pages. A configurable number of results per page would be desirable to make the page more flexible.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

prfctns6@gmail.com’s picture

Status: Active » Needs review
FileSize
5.54 KB

Attached is a patch that adds pagination to the pending relationships page. Two queries are performed, one for pending sent requests and one for pending received requests, and each are paged independently. The code uses the same user_relationships_relationships_per_page variable that controls the number of relationships to be shown on the relationships page(s).

prfctns6@gmail.com’s picture

FileSize
5.45 KB

Previous patch had a stupid mistake in setting the page title. D'oh!

sprsquish’s picture

Status: Needs review » Needs work

The diff was based on version 1.6 of the _theme file. Most recent version is 1.8 and all changes were rejected by CVS. Please resubmit diffed to the most recent version.

sprsquish’s picture

ack.. scratch that. I was looking at the wrong file

sprsquish’s picture

Status: Needs work » Closed (fixed)

Patched.

I changed the code a lot; cleaned it up to make it easier to read, removed user_load.

The location and user of user_load would have created a potentially huge performance hit. It would have sent a DB request for every relationship request, loaded the user, then called the user hook for all modules probably creating another large set of DB requests. Since we really only need the data from the user table I joined that table to the query and faked the functionality of the user object within the relationship object. This means cutting the number of DB hits down to exactly two.

prfctns6@gmail.com’s picture

Sweet - didn't know you could pass to theme_user an object was returned by user_load. Thanks for fixing that!