[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Phpgroupware-users] Deleting addressbook contact of one user
From: |
Dave Hall |
Subject: |
Re: [Phpgroupware-users] Deleting addressbook contact of one user |
Date: |
Mon, 02 Aug 2004 20:10:23 +1000 |
Hi Massimiliano,
a php script which does something like the one below should do the
trick. read the notes below.
<?php
$GLOBALS['phpgw_info']['flags']['current_app'] = 'addressbook';
include('../header.inc.php');
if($GLOBALS['phpgw_info']['apps']['admin'])
{
$contacts->delete_all(intval($_GET['user_id']));
echo 'All entries for ' . $GET['user_id'] .' deleted';
}
else
{
echo 'You are not an admin user - go away!';
}
?>
NOTES:
* This script is untested, and provided as an example only.
* If you use non cookie based sessions then you will need to copy the
session information into the url
* Save the script as
/path/to/phpgroupware/addressbook/delete_contacts.php
* Call the script using
http://server/phpgroupware/addressbook/delete_contacts.php?user_id=100
after logging in as admin.
* if it breaks you get to keep both pieces ;)
Cheers
Dave
On Mon, 2004-08-02 at 18:58, Massimiliano Mirra wrote:
> ...or "migration woes".
>
> Users are importing several contacts from Outlook CSV at once before
> realizing that the result is less than optimal. So I had to put
> together some SQL for cleanup, that deletes all contact owned by a
> certain account_id (e.g. `100'):
>
> create temporary table ids
> select contact_id from phpgw_contact
> where owner=100 and contact_type_id=1;
>
> delete from phpgw_contact_person
> using ids, phpgw_contact_person
> where ids.contact_id = phpgw_contact_person.person_id;
>
> [...do the same for phpgw_contact_addr, phpgw_contact_comm,
> phpgw_contact_note, phpgw_contact_others...]
>
> delete from phpgw_contact
> using ids, phpgw_contact
> where ids.contact_id = phpgw_contact.contact_id;
>
> drop table ids;
>
> I'm not very familiar with phpgw db schema, did I miss anything?
>
> Massimiliano (bard)
>
>
> _______________________________________________
> Phpgroupware-users mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/phpgroupware-users
--
Dave Hall (aka skwashd)
API Coordinator
phpGroupWare