user_profile.inc
Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008 function panels_user_profile_panels_content_types() {
00009 $items['user_profile'] = array(
00010 'title' => t('User profile'),
00011 'content_types' => 'panels_admin_content_types_user_profile',
00012 'single' => TRUE,
00013 'render callback' => 'panels_content_user_profile',
00014 'title callback' => 'panels_admin_title_user_profile',
00015 );
00016 return $items;
00017 }
00018
00019
00020
00021
00022
00023 function panels_content_user_profile($conf, $panel_args, $context) {
00024 $account = isset($context->data) ? drupal_clone($context->data) : NULL;
00025 $block = new stdClass();
00026 $block->module = 'term-list';
00027
00028 if ($account === FALSE || ($account->access == 0 && !user_access('administer users'))) {
00029 return drupal_not_found();
00030 }
00031
00032 $fields = array();
00033 foreach (module_list() as $module) {
00034 if ($data = module_invoke($module, 'user', 'view', '', $account)) {
00035 foreach ($data as $category => $items) {
00036 foreach ($items as $key => $item) {
00037 $item['class'] = "$module-". $item['class'];
00038 $fields[$category][$key] = $item;
00039 }
00040 }
00041 }
00042 }
00043
00044
00045
00046
00047 foreach (module_implements('profile_alter') as $module) {
00048 $function = $module .'_profile_alter';
00049 $function($account, $fields);
00050 }
00051
00052 $block->title = check_plain($account->name);
00053 $block->content = theme('user_profile', $account, $fields);
00054
00055 return $block;
00056 }
00057
00058
00059
00060
00061 function panels_admin_content_types_user_profile() {
00062 return array(
00063 'description' => array(
00064 'title' => t('User profile'),
00065 'icon' => 'icon_user.png',
00066 'path' => panels_get_path('content_types/user'),
00067 'description' => t('The profile of a user.'),
00068 'required context' => new panels_required_context(t('User'), 'user'),
00069 'category' => array(t('User context'), -9),
00070 ),
00071 );
00072 }
00073
00074
00075
00076
00077 function panels_admin_title_user_profile($conf, $context) {
00078 return t('"@s" user profile', array('@s' => $context->identifier));
00079 }
00080