Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function makeVcard2( $id ) {
- if( function_exists( 'get_users' ) ) {
- global $wpdb;
- // Arguments for get_users
- $args = array(
- 'blog_id' => $GLOBALS['blog_id'],
- 'fields' => 'all'
- );
- // Query users with args
- $blogusers = get_users( $args );
- // Loop
- if( $blogusers ) {
- foreach ( $blogusers as $user ) {
- // Get userdata
- if( function_exists( 'get_userdata' ) )
- $userdata[] = get_userdata( $user->ID );
- }
- }
- var_dump( $userdata );
- if( $userdata ) {
- $v_type = 'company';
- $v_first = $userdata->first_name;
- $v_last = $userdata->last_name;
- $v_company = get_bloginfo( 'name' ) . " " . get_bloginfo( 'description' );
- $v_title = $userdata->tagline;
- $v_email = $userdata->user_email;
- $v_web = get_bloginfo('url');
- $v_street = $userdata->address;
- $v_city = $userdata->city;
- $v_state = $userdata->state;
- $v_zip = $userdata->postalcode;
- $v_country = 'USA';
- $v_phone = $userdata->phone;
- $v_fax = $userdata->fax;
- }
- $v_middle = 'Joseph';
- $v_nick = 'Tommy Salami';
- $v_note = 'This is a note';
- $vt = ( $v_type == 'company' ) ? 'WORK' : 'HOME';
- $fn = ( $v_type == 'company' ) ? 'FN:' . $v_company . '\r' : 'FN:' . $v_first . ' ' . $v_middle . ' ' . $v_last . '\r';
- $vcard_content = 'BEGIN:VCARD\r';
- $vcard_content .= 'VERSION:3.0\r';
- $vcard_content .= 'N:'.$v_last.';'.$v_first.';'.$v_middle.';;\r';
- $vcard_content .= $fn;
- $vcard_content .= 'NICKNAME:'.$v_nick.'\r';
- $vcard_content .= 'ORG:'.$v_company.';\r';
- $vcard_content .= 'TITLE:'.$v_title.'\r';
- $vcard_content .= 'EMAIL;type=INTERNET;type='.$vt.';type=pref:'.$v_email.'\r';
- $vcard_content .= 'TEL;type='.$vt.';type=pref:'.$v_phone.'\r';
- $vcard_content .= 'TEL;type=CELL:'.$v_cell.'\r';
- $vcard_content .= 'TEL;type='.$vt.';type=FAX:'.$v_fax.'\r';
- $vcard_content .= 'item1.ADR;type='.$vt.';type=pref:;;'.$v_street.';'.$v_city.';'.$v_state.';'.$v_zip.';'.$v_country.'\r';
- $vcard_content .= 'item1.X-ABADR:us\r';
- $vcard_content .= 'item2.URL;type=pref:'.$v_web.'\r';
- $vcard_content .= 'item2.X-ABLabel:_$!<HomePage>!\$\_\r';
- $vcard_content .= 'NOTE:'.$v_note.'\r';
- if ($v_type=='company') { $vcard_content .= 'X-ABShowAs:COMPANY\r'; }
- $vcard_content .= 'END:VCARD';
- return $vcard_content;
- }
- ?>
Add Comment
Please, Sign In to add comment