php-google-contacts-v3-api
php-google-contacts-v3-api copied to clipboard
Title not coming during create Contact
Hi
Got this issue suddenly (earlier it was working fine without any changes).
While creating new Contact, title/full name is not reflected. Any idea how to solve this?
Thanks
Sorted, someone has already patched from Dec 2 pull request.
Change create method in ContactFactory.php $title = $doc->createElement('gd:name'); $title->setAttribute('fullName', $name); $entry->appendChild($title);
try
`$cat = $doc->createElement('atom:category');
$cat->setAttribute('scheme', 'http://schemas.google.com/g/2005#kind');
$cat->setAttribute('term', 'http://schemas.google.com/contact/2008#contact');
$entry->appendChild($cat);
$expl_fullname = explode(" ", $name);
if(isset($expl_fullname[0])){
$first_name = $expl_fullname[0];
}else{
$first_name = "";
}
if(isset($expl_fullname[1])){
$second_name = $expl_fullname[1];
}else{
$second_name = "";
}
$title = $doc->createElement('title', $name);
$entry->appendChild($title);
$gdname = $doc->createElement('gd:name');
$entry->appendChild($gdname);
$gdname = $doc->createElement('gd:name');
$entry->appendChild($gdname);
$givenName = $doc->createElement('gd:givenName', $first_name);
$familyName = $doc->createElement('gd:familyName', $second_name);
$fullName = $doc->createElement('gd:fullName', $name);
$gdname->appendChild($givenName);
$gdname->appendChild($familyName);
$gdname->appendChild($fullName);
$email = $doc->createElement('gd:email');
$email->setAttribute('rel', 'http://schemas.google.com/g/2005#work');
$email->setAttribute('primary', "true");
$email->setAttribute('address', $emailAddress);
$email->setAttribute('displayName', $name);
$entry->appendChild($email);`