User Relationship Blocks

Last updated on
30 April 2025

The blocks plugin provides a number of blocks admins can use throughout their sites.

The "User Relationships: Actions" block provides a list of relationship options that are valid between the current user and the author of the current node. This is the block to use if you're using usernode or user profiles. It provides the same functionality the normal user page would contain.

The general rule for the blocks is that "My Relationships" are all blocks that display relationship information for the currently logged in user. While "User Relationships" displays relationship information for the author of the currently viewed node.

Developers

This module provides a single hook that passes in identifying information about the block. Depending on the
$op passed in it will expect different information back.

  hook_user_relationship_blocks($op, $block_type, $rtid, $extra);

  $op       | expected return
  ---------------------------------------------------------------------------------
  display   | A user object. It's a way for developers to display relationship information on non-standard pages. If nothing
            | is sent back the module will check if arg(0) matches "user" or "node" and pull the account information from that.

  
  $block_type   | description
  ---------------------------------------------------------------------------------
  UR_BLOCK_MY   | the block relates to the currently logged in user
  UR_BLOCK_USER | the block relates to a specified user (normally the author of the current node)
  pending       | pending relationship requests, normally for the currently logged in user
  actions       | relationships and actions between the currently logged in user and normally the author of the current node


  $rtid
  ---------------------------------------------------------------------------------
  Either UR_BLOCK_ALL_TYPES for any relationship type or an rtid corresponding to a specific relationship type
  I use "normally" because those values can be overridden by the hook


  $extra
  ---------------------------------------------------------------------------------
  Any extra data about the block. Currently this is only used to specify which side of a one-way relationship should be shown.
  It will be either "you_to_them" or "them_to_you" where "you" means the currently logged in user and "them" means the specified
  user.

Help improve this page

Page status: Not set

You can: