You are here

referral_forward.module in User Referral 7

File

referral_forward/referral_forward.module
View source
<?php

/**
 * Implements hook_node_view_alter().
 */
function referral_forward_node_view_alter(&$build) {
  global $user;
  if (isset($build['links']['forward']) && $user->uid) {

    // set the forward link path to include the logged in user's referral link.
    $path_to_node = $build['links']['forward']['#links']['forward_link']['query']['path'];
    $build['links']['forward']['#links']['forward_link']['query']['path'] = 'referral/' . _referral_uid2ref($user->uid) . '/' . $path_to_node;
  }
}

Functions