Redirect to profile

Categories

Component ID

1783544

Component name

Redirect to profile

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body

mymodule.info---------------------------

; $Id$
name = Redirect to profile
description = redirect to profile page.
core = 6.x
version = 6.x-1.0

mymodule.module------------------

/**
* Implementation of modulename_preprocess_node()
*
* Redirect from content profile node to user page.
*
*/
function mymodule_preprocess_node(&$variables) {
  $node = $variables['node'];
  switch ($node->type) {
    case 'profile':
      if (arg(0) == 'node' && arg(1) == $node->nid && arg(2) == "") {
      // If we are postitive we are on node/N where N is the NID of a profile
      // node, then redirect to the user profile page instead.
      drupal_goto("user/$node->uid");
    }
  }
}

Thanks:
Mtoag Technologies
mtoag.com