Index: usernode.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/usernode/usernode.module,v retrieving revision 1.12.2.22 diff -u -r1.12.2.22 usernode.module --- usernode.module 26 Nov 2007 20:26:30 -0000 1.12.2.22 +++ usernode.module 7 Feb 2008 15:35:25 -0000 @@ -161,6 +161,16 @@ 'title' => t('My usernode'), 'access' => $user->uid && user_access('access content'), 'type' => MENU_SUGGESTED_ITEM); + + $items[] = array( + 'path' => 'admin/settings/usernode', + 'title' => t('Usernode'), + 'description' => t('Select the default publishing status for usernode nodes.'), + 'callback' => 'drupal_get_form', + 'callback arguments' => array('usernode_admin_settings'), + 'access' => user_access('administer nodes'), + 'type' => MENU_NORMAL_ITEM + ); return $items; } @@ -197,6 +207,23 @@ } /** + * @return array + */ +function usernode_admin_settings() { + $form = array(); + + $form['usernode_default_status'] = array( + '#type' => 'radios', + '#title' => t('Default published status'), + '#default_value' => variable_get('usernode_default_status', 0), + '#options' => array(t("Sync with users' active/blocked status"), t("Use content type's configuration default")), + '#description' => t("Syncing with the users' status will unpublish their corresponding usernode when the user is blocked and publish the usernode when the user is re-activated. Using the content type default sets the published status on usernode creation according to the !usernode_settings.", array('!usernode_settings' => l(t('usernode content type settings'), 'admin/settings/content-types/usernode'))), + ); + + return system_settings_form($form); +} + +/** * Create an associated node. Called by hook_user(). */ function usernode_create_node($user) { @@ -234,10 +261,12 @@ if (isset($node->user)) { $node->uid = $node->user->uid; } - //unpublish the usernode if the user is blocked - $node_options = variable_get('node_options_'. USERNODE_CONTENT_TYPE, array('status', 'promote')); - if (in_array('status', $node_options)) { - $node->status = $node->user->status; + if (variable_get('usernode_default_status', false) == false) { + //unpublish the usernode if the user is blocked + $node_options = variable_get('node_options_'. USERNODE_CONTENT_TYPE, array('status', 'promote')); + if (in_array('status', $node_options)) { + $node->status = $node->user->status; + } } }