php-google-contacts-v3-api icon indicating copy to clipboard operation
php-google-contacts-v3-api copied to clipboard

Title not coming during create Contact

Open m4mum opened this issue 6 years ago • 3 comments

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

m4mum avatar Dec 07 '18 06:12 m4mum

Sorted, someone has already patched from Dec 2 pull request.

m4mum avatar Dec 07 '18 08:12 m4mum

Change create method in ContactFactory.php $title = $doc->createElement('gd:name'); $title->setAttribute('fullName', $name); $entry->appendChild($title);

andersoncostasr avatar Feb 07 '19 01:02 andersoncostasr

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);`

tigsdev avatar Jan 27 '20 20:01 tigsdev