plugins/SpecialUserPrefs.php
changeset 541 acb7e23b6ffa
parent 536 218a627eb53e
child 555 ac4c6a7f01d8
--- a/plugins/SpecialUserPrefs.php	Sat Apr 26 17:25:28 2008 -0400
+++ b/plugins/SpecialUserPrefs.php	Sun May 04 21:57:48 2008 -0400
@@ -542,7 +542,25 @@
         $session->user_extra['user_hobbies'] = $hobbies;
         $session->user_extra['email_public'] = intval($email_public);
         
-        $q = $db->sql_query('UPDATE '.table_prefix."users SET real_name='$real_name', user_timezone = $tz_local WHERE user_id=$session->user_id;");
+        // user title
+        $user_title_col = '';
+        if ( $session->get_permissions('custom_user_title') && isset($_POST['user_title']) )
+        {
+          $user_title = trim($_POST['user_title']);
+          if ( empty($user_title) )
+          {
+            $colval = 'NULL';
+            $session->user_title = null;
+          }
+          else
+          {
+            $colval = "'" . $db->escape($user_title) . "'";
+            $session->user_title = $user_title;
+          }
+          $user_title_col = ", user_title = $colval";
+        }
+        
+        $q = $db->sql_query('UPDATE '.table_prefix."users SET real_name='$real_name', user_timezone = $tz_local{$user_title_col} WHERE user_id=$session->user_id;");
         if ( !$q )
           $db->_die();
         
@@ -580,6 +598,8 @@
           $db->free_result();
         }
         
+        generate_ranks_cache();
+        
         echo '<div class="info-box" style="margin: 0 0 10px 0;">' . $lang->get('usercp_publicinfo_msg_save_success') . '</div>';
       }
       
@@ -644,6 +664,21 @@
             <td class="row2"><?php echo $lang->get('usercp_publicinfo_field_timezone'); ?><br /><small><?php echo $lang->get('usercp_publicinfo_field_timezone_hint'); ?></small></td>
             <td class="row1"><?php echo $tz_select; ?></td>
           </tr>
+          <?php
+          if ( $session->get_permissions('custom_user_title') ):
+          ?>
+            <tr>
+              <td class="row2">
+                <?php echo $lang->get('usercp_publicinfo_field_usertitle_title'); ?><br />
+                <small><?php echo $lang->get('usercp_publicinfo_field_usertitle_hint'); ?></small>
+              </td>
+              <td class="row1">
+                <input type="text" name="user_title" value="<?php echo htmlspecialchars($session->user_title); ?>" />
+              </td>
+            </tr>
+          <?php
+          endif;
+          ?>
           <tr>
             <th class="subhead" colspan="2">
               <?php echo $lang->get('usercp_publicinfo_th_im'); ?>