Author |
|
dikodhiko Newbie
Joined: 24 February 2016 Location: Indonesia
Online Status: Offline Posts: 0
|
Posted: 15 March 2016 at 9:17pm | IP Logged
|
|
|
Hi Everyone,
anyone now how to insert contact for everyone from database?
i have trying to to insert contact from table awm_addr_book,
if i using webmail pro all contact can be place on my account.
but if i trying to use webmail lite no one contact place on my account.
any solution using wb lite?
thanks.
|
Back to Top |
|
|
rsantellan Newbie
Joined: 14 October 2015
Online Status: Offline Posts: 11
|
Posted: 15 March 2016 at 9:22pm | IP Logged
|
|
|
You can use this: http://www.afterlogic.com/aurora/docs/api/class-CApiContactsManager.html#_createContact
Or this: http://www.afterlogic.com/wiki/Add_contacts_from_external_address_books_%28WebMail_Plugins%29?WM=Lite
Both works like a charm!
|
Back to Top |
|
|
dikodhiko Newbie
Joined: 24 February 2016 Location: Indonesia
Online Status: Offline Posts: 0
|
Posted: 15 March 2016 at 10:17pm | IP Logged
|
|
|
rsantellan wrote:
You can use this: http://www.afterlogic.com/aurora/docs/api/class-CApiContactsManager.html#_createContact
Or this: http://www.afterlogic.com/wiki/Add_contacts_from_external_address_books_%28WebMail_Plugins%29?WM=Lite
Both works like a charm! |
|
|
i have try to use this :
http://www.afterlogic.com/wiki/Add_contacts_from_external_address_books_%28W
ebMail_Plugins%29?WM=Lite
but i dont know to how to connect to my database bellow this command :
// Your custom php logic
can u give me example code you use? :(
|
Back to Top |
|
|
rsantellan Newbie
Joined: 14 October 2015
Online Status: Offline Posts: 11
|
Posted: 15 March 2016 at 10:21pm | IP Logged
|
|
|
Code:
if ($oAccount)
{
// Your custom php logic
$pdo = CApi::GetPDO();
$sql = 'select c.name, ce.contact_id, ce.email, ce.tipo from contactos_emails ce inner join contactos c on c.id = ce.contact_id where ce.email like :email';
$stmt = $pdo->prepare($sql);
$stmt->execute(array('email' => '%'.$sSearch.'%'));
while($row = $stmt->fetch()) {
$oContac tItem = new CContactListItem();
$oContac tItem->Id = 0;
$oContac tItem->IdStr = '';
$oContac tItem->Name = $row['name'].' ('.$row['tipo'].')';
$oContac tItem->Email = $row['email'];
$oContac tItem->UseFriendlyName = true;
$oContac tItem->Global = true;
$oContac tItem->ReadOnly = true;
$oContac tItem->ItsMe = $oContactItem->Email === $oAccount->Email;
$aList[] = $oContactItem;
}
}
|
|
|
Hope it helps!!
Regards.
Rodrigo
|
Back to Top |
|
|
dikodhiko Newbie
Joined: 24 February 2016 Location: Indonesia
Online Status: Offline Posts: 0
|
Posted: 15 March 2016 at 11:16pm | IP Logged
|
|
|
rsantellan wrote:
Code:
if ($oAccount)
{
// Your custom php logic
$pdo = CApi::GetPDO();
$sql = 'select c.name, ce.contact_id, ce.email, ce.tipo from contactos_emails ce inner join contactos c on c.id = ce.contact_id where ce.email like :email';
$stmt = $pdo->prepare($sql);
$stmt->execute(array('email' => '%'.$sSearch.'%'));
while($row = $stmt->fetch()) {
$o Contac tItem = new CContactListItem();
$o Contac tItem->Id = 0;
$o Contac tItem->IdStr = '';
$o Contac tItem->Name = $row['name'].' ('.$row['tipo'].')';
$o Contac tItem->Email = $row['email'];
$o Contac tItem->UseFriendlyName = true;
$o Contac tItem->Global = true;
$o Contac tItem->ReadOnly = true;
$o Contac tItem->ItsMe = $oContactItem->Email === $oAccount->Email;
$aList[] = $oContactItem;
}
}
|
|
|
Hope it helps!!
Regards.
Rodrigo |
|
|
Very thanks for that buddy,
are u using windwos server and sql db?
im using centos 7 and mysql db. :)
thanks,
you are awesome.
|
Back to Top |
|
|