[horde] Clearing portal layout for a user

Kevin M. Myer kevin_myer at iu13.org
Fri Sep 9 17:38:23 PDT 2005


Quoting "Kevin M. Myer" <kevin_myer at iu13.org>:

> Very possible... Look in horde/scripts/remove_prefs.php.  Should help 
> with the
> first and second request..
>
> Kevin

And, in case you are only interested in deleting the prefs for a single user,
try the patch below.  If it would be useful, I'll clean it up and make 
the user
be an optional input.  For your layout issue, with my patch below:

Apply the patch.
Edit the remove_prefs.php script and change the $live variable to true.
When prompted:
pref_scope: layout
pref_name: portal_layout
horde user: the name of the user with the problem

Index: remove_prefs.php
===================================================================
RCS file: /repository/horde/scripts/remove_prefs.php,v
retrieving revision 1.6
diff -u -r1.6 remove_prefs.php
--- remove_prefs.php    24 Aug 2005 13:25:38 -0000      1.6
+++ remove_prefs.php    10 Sep 2005 00:31:55 -0000
@@ -44,6 +44,7 @@

$scope = $cli->prompt(_("Enter value for pref_scope:"));
$name = $cli->prompt(_("Enter value for pref_name:"));
+$user = $cli->prompt(_("Enter value for horde user:"));

/* Open the database. */
$db = &DB::connect($conf['sql']);
@@ -52,8 +53,8 @@
}

if ($live) {
-    $sql = 'DELETE FROM horde_prefs WHERE pref_scope = ? AND pref_name = ?';
-    $values = array($scope, $name);
+    $sql = 'DELETE FROM horde_prefs WHERE pref_scope = ? AND pref_name 
= ? AND
pref_uid = ?';
+    $values = array($scope, $name, $user);
     $result = $db->getAll($sql, $values);
     if (is_a($result, 'PEAR_Error')) {
         var_dump($result);
@@ -63,8 +64,8 @@
         $cli->writeln(sprintf(_("Preferences \"%s\" deleted in scope 
\"%s\"."),
$name, $scope));
     }
} else {
-    $sql = 'SELECT * FROM horde_prefs WHERE pref_scope = ? AND 
pref_name = ?';
-    $values = array($scope, $name);
+    $sql = 'SELECT * FROM horde_prefs WHERE pref_scope = ? AND pref_name = ?
AND pref_uid = ?';
+    $values = array($scope, $name, $user);
     $result = $db->getAll($sql, $values);
     if (empty($result)) {
         $cli->writeln(sprintf(_("No preference \"%s\" found in scope 
\"%s\"."),
$name, $scope));

Kevin

-- 
Kevin M. Myer
Senior Systems Administrator
Lancaster-Lebanon Intermediate Unit 13  http://www.iu13.org




More information about the horde mailing list