I found myself needing to display User profile panel variants based on whether user has a profile node of a specific type - or not. I wrote a panels access plugin that allows this to be done.

The patch is attached below.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cafuego’s picture

FileSize
2.41 KB

Ran into some interesting issues. Updated patch with lighter API call attached.

If you want to display the content profile node form in a Panel, you will need to make sure the drupal_goto() call in content_profile_nodeapi() will not run. Preparing the node form in the Panel context triggers the nodeapi('prepare') hook and causes non-admin users to be redirected to the profile node edit page instead of the Panel.

A very quick hack-around to make this work on the user profile panel template is to replace:

drupal_goto('node/'. $nid .'/edit', 'destination=user/'. $node->uid);

with

if (arg(0) != 'user')
  drupal_goto('node/'. $nid .'/edit', 'destination=user/'. $node->uid);

on line 376 of content_profile.module.