You are here

function _privatemsg_service_simplify_user in Privatemsg 6.2

Simplify the thread author object.

Simplified means that every property that is not in the 'privatemsg_service_thread_author_fields' variable will be removed.

Parameters

$user: A user object that needs to be simplified.

Return value

Thread with simplified user object.

2 calls to _privatemsg_service_simplify_user()
_privatemsg_service_enhance_participants in privatemsg_service/privatemsg_service.module
Collect additional information about messages participants.
_privatemsg_service_process_thread in privatemsg_service/privatemsg_service.module
Enhance messages and simplify author objects for a thread.

File

privatemsg_service/privatemsg_service.module, line 195
Link general privatemsg module functionalities to services module.

Code

function _privatemsg_service_simplify_user($user) {

  // Determine what fields should be included with the user object.
  $fields = variable_get('privatemsg_service_thread_author_fields', array(
    'uid',
    'name',
  ));
  $simple_author = new stdClass();
  foreach ($fields as $field) {
    $simple_author->{$field} = $user->{$field};
  }
  return $simple_author;
}