Hello
Great module
What i like is a List of participants with Avatar (user picture)
Can this be done in the current module
Can we prepare a view
I tried making a view, but i could not find any proper filter
Pls suggest
Thanks in Advance
Ajay

Comments

pounard’s picture

This can be done in two ways:
1) Make the main participant list view (the one you can see on node's menu_local_task) themable;
2) Code the proper views module stuffs to do it.

I'll try to do this as soon as I can (I can't promise anything I have a lot of work these days).

If you think you can do it yourselft, no problem, please try and post a patch :)

pounard’s picture

the function which display participant list is themable. If you can modify your theme, then you should override it with something like this:

function MYTHEME_og_event_participants_list($nid, $participants = array(), $title = NULL) {
  $content = '<table class="og-picture-grid">';
  $count = 0;
  $column_count = 4;
  $total = count($participants);
  $node = node_load($nid);
  // Does our current user can edit the subscributions ?
  $user_can_edit = og_event_user_can_edit($node);
  $roles_enabled = og_event_is_role_enabled($node);

  foreach ($participants as $uid => $role) {
  	$user = user_load(array('uid' => $uid));

  	$classes = 'og-picture-grid-item';
    if ($count < $column_count) {
      $classes .= ' first';
    }

    $item = '';
    if ($count % $column_count == 0) { 
      $content .= '<tr>'; 
    }
    $picture = theme('user_picture', $user);
    $name = theme('username', $user);
    $group_role = $user->is_admin ? t('admin') : '&nbsp;';
    $content .= "<td class=\"$classes\">$picture<div class=\"og-name\">$name</div>";
    if ($roles_enabled && ! empty($role)) {
      $content .= "<div class=\"og-event-role\">(".check_plain($role).")</div>";
    }
    if ($user_can_edit) {
      $content .= "[".l('X', 'node/'.$node->nid.'/unregister-event/'.$uid).']';
    }
    $content .= "</td>\n";

    $count++;
    if ($count % $column_count == 0 || $count == $total) {
      $content .= '</tr>';
    }
  }
  $content .= '</table>';
  
  if ($content) {
    return $content;
  }
}

This one works perfectly (I did it using the grid display of og module, you should rename HTML elements classes), using the last module release (not a developement version, so no surprises).

Test it and give me a feedback please.

iajay’s picture

Hello pounard
I m trying the above code
Will let u know
Regards
Ajay

iajay’s picture

Hello pounard
This works great
I will get back to you, if i find anything
Thanks once again
Ajay

pounard’s picture

Status: Active » Closed (fixed)

Issue closed because snippet seems to be working.