0) { $nodes = nodefamily_warning_build_list($children, $type); if (count($nodes['todo']) > 0) { drupal_set_message(theme('nodefamily_warning', $nodes, $type)); } } } } } /** * Helper for nodeapi. Builds the message * We return not only the unfullfileld nodes, but -for use in the theme * function- also the nodes that are already done. */ function nodefamily_warning_build_list($children, $type) { global $user; $nodes = array( 'todo' => array(), 'done' => array(), ); foreach ($children as $child) { if (node_access('create', $child) && !nodefamily_content_type_is_max($child, $user->uid)) { $profile = new stdClass(); $profile->type = $child; $profile->title = node_get_name($child); $nodes['todo'][] = $profile; } } $user_node = node_load(array('type' => $type, 'uid' => $user->uid)); if ($user_node->nid) { foreach (nodefamily_relation_load_by_type($user_node) as $type_group) { $nodes['done'][] = $type_group; } } return $nodes; } /** * Helper for nodeapi. Themes the message. * @param $nodes, an array with nodes wich are either fulfilled or not. */ function theme_nodefamily_warning($nodes, $type) { //Theme Tip: This is a nice place to set your personal niftynesses, like merge in the already finished ($nodes['done']) wich checkmarks next to them. foreach ($nodes['todo'] as $node) { $attributes = array( 'title' => t('Create a new %type', array('%type' => node_get_name($node->type))), ); $items[] = l($node->title, 'node/add/'. $node->type, $attributes); } $message = t('You have not yet finished your %type. You still need to fill in a part of your profile.', array('%type' => node_get_name($type))); $title = t('You must still create:'); $message .= theme('item_list', $items, $title); return $message; }