This seems like a good add - on to roundcube. While we are on the topics of identities, could it be implemented that the email field is either auto populated with some info like email address or these fields are made hidden (in addition to auto populated with the email address) so that the user cannot edit the email address?

Nipun.

On 1/15/07, Jim Pingle <lists@pingle.org> wrote:
I posted this in the forums, and didn't get much of a response, so I thought
I'd try my luck here.

Some time ago, the ability for new users to be presented with the "Edit
Identity" screen after their first login was requested. (Ticket #1291605,
http://trac.roundcube.net/trac.cgi/ticket/1291605 )

Attached is a patch that should add this feature in. This was patched
against SVN rev 459, but it may work on older revisions. I'm sure there is
room for improvement.

NB: This feature is controlled by an additional setting in config/main.inc.php :

$rcmail_config['new_user_edit_identity'] = TRUE;

I suppose you could display a "welcome" message on the edit identities
screen if they are a new user also, but that would require additional
localization / translation, among other changes.

Jim
P.S. RE: Developer Guidelines, should boolean variables be in all caps
(TRUE/FALSE) or lower case (true/false)? It seems to goes back and forth a
lot in the code, so I wasn't sure.


Index: config/main.inc.php.dist
===================================================================
--- config/main.inc.php.dist    (revision 459)
+++ config/main.inc.php.dist    (working copy)
@@ -31,6 +31,10 @@
// set to false if only registered users can use this service
$rcmail_config['auto_create_user'] = TRUE;

+// present the user with an "edit identity" screen upon first login
+// This is only useful if auto_create_user is also set to true.
+$rcmail_config['new_user_edit_identity'] = TRUE;
+
// the mail host chosen to perform the log-in
// leave blank to show a textbox at login, give a list of hosts
// to display a pulldown menu or set one host as string.
Index: program/include/main.inc
===================================================================
--- program/include/main.inc    (revision 459)
+++ program/include/main.inc    (working copy)
@@ -548,6 +548,8 @@
   else if ($CONFIG['auto_create_user'])
     {
     $user_id = rcmail_create_user($user, $host);
+    if ($CONFIG['new_user_edit_identity'])
+      $_SESSION['new_user'] = TRUE;
     }

   if ($user_id)
Index: index.php
===================================================================
--- index.php   (revision 459)
+++ index.php    (working copy)
@@ -177,6 +177,24 @@
               get_input_value('_pass', RCUBE_INPUT_POST, true, 'ISO-8859-1'), $host))
     {
     // send redirect
+    if (isset($_SESSION['new_user']) && $_SESSION['new_user'] === TRUE)
+      {
+      // Get identity id
+      $sql_result = $DB->query("SELECT identity_id
+                                FROM   ".get_table_name('identities')."
+                                WHERE user_id=?
+                                AND    del<>1
+                                LIMIT 1",
+                               $_SESSION['user_id']);
+
+      // If we can find an identity, redirect to the edit screen.
+      if ($DB->num_rows($sql_result) && ($sql_arr = $DB->fetch_assoc($sql_result)))
+        {
+        $identity_id = $sql_arr['identity_id'];
+        if (!empty($identity_id) && ($identity_id > 0))
+          $COMM_PATH = "./?_task=settings&_action=edit-identity&_iid=" . $identity_id;
+        }
+      }
     header("Location: $COMM_PATH");
     exit;
     }