? LICENSE.txt ? user_titles_6_port_2.patch ? user_titles_6_port_3.patch Index: README.txt =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/user_titles/README.txt,v retrieving revision 1.4 diff -u -p -r1.4 README.txt --- README.txt 19 Nov 2007 00:51:51 -0000 1.4 +++ README.txt 11 Nov 2008 06:23:00 -0000 @@ -3,37 +3,8 @@ because you need to modify your theme in you like. The function you need to call to get the data is -user_titles_get_user_title(). You may call this function either in -your template.php or in your node.tpl.php and/or your comment.tpl.php. It -is recommended that you place this in your template.php. - -In template.php, in the function _phptemplate_variables, place this -piece of code under case 'node': and a similar one under case 'comment' (see -below): - - if (module_exists('user_titles')) { - $vars['user_title'] = user_titles_get_user_title($vars['node']->uid); - } - -Note that $vars may be named something else, such as $variables in your -implementation. Note the variable in the function definition. - -If you do not have a _phptemplate_variables() in your template.php -file, you may create one: - -function _phptemplate_variables($hook, $vars = array()) { - switch ($hook) { - case 'node': - if (module_exists('user_titles')) { - $vars['user_title'] = user_titles_get_user_title($vars['node']->uid); - } - case 'comment': - if (module_exists('user_titles')) { - $vars['user_title'] = user_titles_get_user_title($vars['comment']->uid); - } - } - return $vars; -} +user_titles_get_user_title(). This module will automatically populate the +$user_title variable into your nodes and comments. In your node.tpl.php and/or your comment.tpl.php, choose where you would like the user title to appear, and place this code: @@ -42,11 +13,6 @@ the user title to appear, and place this
-There are other places you may wish a user title to appear, such as the user -profile page. Please see the drupal.org theming handbook for more information -on theming those; the additions you make will be materially the same as -these. - NOTE: The settings UI for this currently requires javascript and doesn't degrade. -Patches welcome. +Patches welcome. \ No newline at end of file Index: user_titles.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/user_titles/user_titles.info,v retrieving revision 1.2 diff -u -p -r1.2 user_titles.info --- user_titles.info 20 Jul 2007 18:18:45 -0000 1.2 +++ user_titles.info 11 Nov 2008 06:23:01 -0000 @@ -1,4 +1,7 @@ -; $Id: user_titles.info,v 1.2 2007/07/20 18:18:45 merlinofchaos Exp $ +; $Id$ name = "User titles" -description = "Allow users to have titles based upon how many posts they have." \ No newline at end of file +description = "Allow users to have titles based upon how many posts they have." +version = "6.x-0.1" +core = "6.x" + Index: user_titles.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/user_titles/user_titles.install,v retrieving revision 1.3 diff -u -p -r1.3 user_titles.install --- user_titles.install 27 Jul 2007 00:19:56 -0000 1.3 +++ user_titles.install 11 Nov 2008 06:23:01 -0000 @@ -1,37 +1,29 @@ array( + 'tid' => array('type' => 'int', 'not null' => TRUE, 'disp-width' => '10'), + 'title' => array('type' => 'varchar', 'length' => '255', 'not null' => TRUE), + 'value' => array('type' => 'int', 'not null' => TRUE, 'disp-width' => '10')), + 'primary key' => array('tid'), + ); + + $schema['user_titles_posts'] = array( + 'fields' => array( + 'uid' => array('type' => 'int', 'not null' => TRUE, 'disp-width' => '10'), + 'posts' => array('type' => 'int', 'not null' => FALSE, 'disp-width' => '11')), + 'primary key' => array('uid'), + ); + + return $schema; } -function user_titles_update_1() { - $ret = array(); - $ret[] = update_sql("RENAME TABLE {user_titles} TO {user_titles_posts}"); - $ret[] = update_sql(" - CREATE TABLE {user_titles} ( - tid int(10) NOT NULL PRIMARY KEY, - title varchar(255) NOT NULL, - value int(10) NOT NULL - ) /*!40100 DEFAULT CHARACTER SET utf8 */ - "); - - return $ret; +function user_titles_install() { + drupal_install_schema('user_titles'); } function user_titles_uninstall() { - db_query("DROP TABLE {user_titles}"); - db_query("DROP TABLE {user_titles_posts}"); + drupal_uninstall_schema('user_titles'); } Index: user_titles.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/user_titles/user_titles.module,v retrieving revision 1.13 diff -u -p -r1.13 user_titles.module --- user_titles.module 19 Nov 2007 00:46:36 -0000 1.13 +++ user_titles.module 11 Nov 2008 06:23:01 -0000 @@ -1,5 +1,5 @@ t('User titles'), - 'description' => t('Configure user titles and number of posts required'), - 'path' => 'admin/user/user-titles', - 'callback' => 'drupal_get_form', - 'callback arguments' => array('user_titles_settings_form'), - 'access' => user_access('administer user titles'), - 'type' => MENU_NORMAL_ITEM, - ); - return $items; - } +function user_titles_menu() { + $items['admin/user/user-titles'] = array( + 'title' => 'User titles', + 'description' => 'Configure user titles and number of posts required', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('user_titles_settings_form'), + 'access arguments' => array('administer user titles'), + ); + return $items; } /** @@ -69,7 +65,8 @@ function user_titles_settings_form() { // Build the form bit so we can get the actual number of titles already in // the form, which may have been changed thanks to javascript. - $form['num_titles'] = form_builder('user_titles_settings_form', $form['num_titles']); + $form_state = array(); + $form['num_titles'] = form_builder('user_titles_settings_form', $form['num_titles'], $form_state); $actual_titles = $form['num_titles']['#value']; $form['titles'] = array('#tree' => TRUE); @@ -116,6 +113,14 @@ function user_titles_settings_form() { return $form; } +function user_titles_theme() { + return array( + 'user_titles_settings_form' => array( + 'arguments' => array('form' => NULL), + ), + ); +} + /** * Theme the user title settings form. * @@ -137,7 +142,7 @@ function theme_user_titles_settings_form $output = '