Use QR Code plugin to create vcards as a QR Code

3 posts by 3 authors in: Forums > CMS Builder
Last Post: October 11, 2013   (RSS)

By Mikey - August 17, 2013

I'm trying to create a vcard powered by the QR Code plugin, but can seem to get this figured out and I'm not even sure if it's possible to make this work. Below is my code I've got worked up so far. Anyone have any suggestions on how to get this working?

<?php
  // load viewer library
  $libraryPath = 'cmsAdmin/lib/viewer_functions.php';
  $dirsToCheck = array('','../','../../','../../../', '../../../../', '../../../../../');
  foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
  if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }
?>
<?php
  echo qrCode(array(
    'type'                            =>'BEGIN:VCARD',
    'VERSION:3.0',
    'N:Firstname;Lastname;Surname'    => $memberRecord['first_name'] . "," . $memberRecord['last_name'] . "," . $memberRecord['surname'],
    'FN:Displayname'                => $memberRecord['first_name'] . "," . $memberRecord['last_name'],
    'ORG:'                            => $memberRecord['business_name'],
    'TITLE:'                        => $memberRecord['business_title'],
    'ROLE:'                            => $memberRecord['business_category'],
    'URL:'                            => urlencode(thisPageUrl()),
    'EMAIL:'                        => $memberRecord['email'],
    'TEL;TYPE=work'                    => $memberRecord['phone'],
    'TEL;TYPE=cell'                    => $memberRecord['mobile_phone'],
    'TEL;TYPE=fax'                    => $memberRecord['fax'],
    'ADR;TYPE=work:'                => $memberRecord['work_address'],
    'ADR;TYPE=postal:'                => $memberRecord['po_box_address'],
    'GEO:'                            => $memberRecord['latitude'] . "," . $memberRecord['Longitude'],
    'BDAY:'                            => $memberRecord['birth_day'],
    'END:VCARD'
  ));
?>

Thanks, Zick

By gregThomas - August 19, 2013

Hi Zick,

Unfortunately it isn't possible to create a vcard using the QR code plugin without a lot of modification to the plugin itself. What about using the contact option that is built into the plugin? This uses the mecard format instead, but contains similar data. 

We could modify the current plugin to allow you to create a vcard fairly easily. If you send an e-mail to consulting@interactivetools.com we can give you an estimate of the cost.

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com