0

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

1 Answer 1

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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