function content_profile_user in Content Profile 6
Implementation of hook_user().
File
- ./
content_profile.module, line 284
Code
function content_profile_user($op, &$edit, &$account, $category = NULL) {
global $user;
switch ($op) {
case 'categories':
$data = array();
foreach (content_profile_get_types('names', 'edit_tab', 'sub') as $type => $type_name) {
$data[] = array(
'name' => $type,
'title' => drupal_ucfirst($type_name),
'weight' => content_profile_get_settings($type, 'weight') + 1,
);
}
return $data;
case 'view':
$account->content['content_profile'] = content_profile_show_profiles($account->uid);
break;
case 'delete':
// Retrieve all profile nodes (in any language) for this user by issueing an SQL query.
if ($types = content_profile_get_types()) {
$condition = array_fill(0, count($types), "type = '%s'");
$arguments = array_merge(array_keys($types), array(
$account->uid,
));
$result = db_query("SELECT * FROM {node} WHERE (" . implode(' OR ', $condition) . ") AND uid = %d", $arguments);
while ($node = db_fetch_object($result)) {
_content_profile_node_delete($node);
}
}
break;
}
}