We need to provide a block to display a user's top x friends (ideally configurable).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

prfctns6@gmail.com’s picture

Title: create top friends block » Created blocks for viewing users' relationships
FileSize
11.32 KB

Attached is a patch that creates a number of blocks which display relationships.

There are 2 classes of blocks: "My <relationships>" blocks display the relationships of the user who is viewing the site; "User <relationships>" blocks display the relationships of the user whose profile is being viewed. For each of the 2 classes of blocks, there is one block for each defined relationship type, and one block which displays all relationships. So if there are n relationship types defined, there are 2*(n+1) blocks defined.

In this first implementation, the "User <relationships>" blocks are hardcoded to only display on nodes of type 'usernode'. Future plans are to allow the administrator to configure which node types the "User <relationships>" blocks should display on.

All of the blocks have the following configuration options:

  • How many relationships to display in the block
  • If a user has more than that number of relationships to be displayed, which ones should be displayed:
    • Newest relationships (most recently updated)
    • Oldest relationships (least recently updated)
    • Random selection
prfctns6@gmail.com’s picture

Status: Active » Needs review
prfctns6@gmail.com’s picture

Title: Created blocks for viewing users' relationships » Bug in selecting relationships for block
FileSize
11.41 KB

In the patch I submitted yesterday, the blocks contained all relationships, not just those that are approved. Attached is a new complete patch, with that portion of the code fixed.

Zahor’s picture

The "My (relationship_name)" block displays all relationships for me on each block - so every block has everyone even though the relationships are different.

sprsquish’s picture

JB can you request CVS access so I can give you commit rights to maintain the blocks plugin?

Tanks :o)

AjK’s picture

CVS application approved, added to project. Have a good day folks!

prfctns6@gmail.com’s picture

Zahor:

Can you tell me something about your configuration?

  1. How have you configured the blocks: how many relationships per block are you displaying, and which ones?
  2. What relationship types do you have defined?
  3. How many relationships of each type do you actually have?

Also, in blocks other than the "My Relationships" block (which is supposed to have all relationships), what do you see for each relationship: just the user name, or the user name and the name of the relationship?

Thanks.

prfctns6@gmail.com’s picture

Status: Needs review » Postponed (maintainer needs more info)
prfctns6@gmail.com’s picture

Status: Postponed (maintainer needs more info) » Fixed

Checked in the 1.0 version of the block code. This code does not address Zahor's issue, as I need more info from Zahor before I can debug.

Possible enhancements for future versions:

  • Clean up the way configuration settings are stored. Those variable names sure are ugly.
  • Expand the types of pages that the User Relationships blocks appear on. Currently hardcoded to pages of type 'usernode'.
  • Change the theme functions so that if a block has no relationships, the block doesn't appear at all. Currently you'll always get a title for the block, even if it's empty.
prfctns6@gmail.com’s picture

Status: Fixed » Closed (fixed)