Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I'm using D6 and I like to have a view that shows all user profile fields. The situation now is, that you have to tic all fields that you like to show. I'm using OG profiles and the user is able to add profile fields to it's group. In addition to that, I need a view that get all fields that are belonging to a group (automatic).

What is the starting point for me? Found that .. http://techblog.zabuchy.net/2010/non-database-field-in-custom-drupal-views-2/

But how to start?

pseudo code:

get all field belonging to a group (arg(1)) and disp

share|improve this question

1 Answer 1

This is probably done better in a preprocess function in a theme instead. However if you want to do it you ned to create a handler, something like this:

class og_group_handler_field extends views_handler_field {
  function render() {
    $og = arg(1);
    $output
    // Load the group and add to $output what needs to be displayed
   return $output;
 }
 function query() {
   // Make sure we don't add anything to the queue.
  }
}

and the add the handler to a table like nodes

function module_views_data_alter(&$data) {
  $data['node']['og_all_group_fields_from_arg_1'] = array(
    'field' => array(
      'title' => 'title',
      'help' => 'Help Text',
      'handler' => 'og_group_handler_field',
    ),
  );
}

For Drupal 6 you also need to register the handler, the link you posted illustrates how this is done.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.