__( 'Yearbook'), 'singular_name' => __( 'Entry'), 'menu_name' => __( 'Yearbook'), 'name_admin_bar' => __( 'Yearbook'), 'add_new' => __( 'Add Entry'), 'add_new_item' => __( 'Add New Entry'), 'edit_item' => __( 'Edit Entry'), 'new_item' => __( 'New Entry' ), 'view_item' => __( 'View Entry'), 'search_items' => __( 'Search Yearbook'), 'not_found' => __( 'No entries found'), 'not_found_in_trash' => __( 'No entries found in trash'), 'all_items' => __( 'All Entries'), /* Labels for hierarchical post types only. */ 'parent_item' => __( 'Parent Entry'), 'parent_item_colon' => __( 'Parent Entry:'), /* Custom archive label. Must filter 'post_type_archive_title' to use. */ 'archive_title' => __( 'Yearbook') ); register_post_type('yearbook', array( 'labels' => $labels, 'public' => true, 'show_ui' => true, 'has_archive' => true, 'show_in_nav_menus' => true, 'rewrite' => array('slug' => 'yearbook'), 'hierarchical' => true, 'supports' => array('title','editor','thumbnail','revisions','author'), ) ); $labels = array( 'name' => _x( 'Travel Categories', 'taxonomy general name' ), 'singular_name' => _x( 'Travel Category', 'taxonomy singular name' ), 'search_items' => __( 'Search Travel Categories' ), 'popular_items' => __( 'Popular Travel Categories' ), 'all_items' => __( 'All Travel Categories' ), 'parent_item' => null, 'parent_item_colon' => null, 'edit_item' => __( 'Edit Travel Category' ), 'update_item' => __( 'Update Travel Category' ), 'add_new_item' => __( 'Add New Travel Category' ), 'new_item_name' => __( 'New Travel Category Name' ), 'separate_items_with_commas' => __( 'Separate Travel Categories with commas' ), 'add_or_remove_items' => __( 'Add or remove Travel Category' ), 'choose_from_most_used' => __( 'Choose from the most used Travel Category' ), 'not_found' => __( 'No Travel Categories found.' ), 'menu_name' => __( 'Travel Categories' )); $args = array( 'hierarchical' => true, 'labels' => $labels, 'public' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'travel_categories' ) ); register_taxonomy('travel_categories','yearbook',$args); $labels = array( 'name' => _x( 'Regions', 'taxonomy general name' ), 'singular_name' => _x( 'Region', 'taxonomy singular name' ), 'search_items' => __( 'Search Region' ), 'popular_items' => __( 'Popular Region' ), 'all_items' => __( 'All Regions' ), 'parent_item' => null, 'parent_item_colon' => null, 'edit_item' => __( 'Edit Region' ), 'update_item' => __( 'Update Region' ), 'add_new_item' => __( 'Add New Region' ), 'new_item_name' => __( 'New Region Name' ), 'separate_items_with_commas' => __( 'Separate Region with commas' ), 'add_or_remove_items' => __( 'Add or remove Region' ), 'choose_from_most_used' => __( 'Choose from the most used Region' ), 'not_found' => __( 'No Region found.' ), 'menu_name' => __( 'Region' )); $args = array( 'hierarchical' => true, 'labels' => $labels, 'public' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'region' ) ); register_taxonomy('region','yearbook',$args); $labels = array( 'name' => _x( 'Skills', 'taxonomy general name' ), 'singular_name' => _x( 'Skill', 'taxonomy singular name' ), 'search_items' => __( 'Search skills' ), 'popular_items' => __( 'Popular skills' ), 'all_items' => __( 'All skills' ), 'parent_item' => null, 'parent_item_colon' => null, 'edit_item' => __( 'Edit skills' ), 'update_item' => __( 'Update skills' ), 'add_new_item' => __( 'Add New skills' ), 'new_item_name' => __( 'New skills Name' ), 'separate_items_with_commas' => __( 'Separate skills with commas' ), 'add_or_remove_items' => __( 'Add or remove skills' ), 'choose_from_most_used' => __( 'Choose from the most used skills' ), 'not_found' => __( 'No skills found.' ), 'menu_name' => __( 'Skills' )); $args = array( 'hierarchical' => true, 'labels' => $labels, 'public' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'skills' ) ); register_taxonomy('skills','yearbook',$args); $labels = array( 'name' => _x( 'Local experts', 'taxonomy general name' ), 'singular_name' => _x( 'Local experts', 'taxonomy singular name' ), 'search_items' => __( 'Search local_experts' ), 'popular_items' => __( 'Popular local_experts' ), 'all_items' => __( 'All local_experts' ), 'parent_item' => null, 'parent_item_colon' => null, 'edit_item' => __( 'Edit local_experts' ), 'update_item' => __( 'Update local_experts' ), 'add_new_item' => __( 'Add New local_experts' ), 'new_item_name' => __( 'New local_experts Name' ), 'separate_items_with_commas' => __( 'Separate local_experts with commas' ), 'add_or_remove_items' => __( 'Add or remove local_experts' ), 'choose_from_most_used' => __( 'Choose from the most used local_experts' ), 'not_found' => __( 'No local_experts found.' ), 'menu_name' => __( 'Local Experts' )); $args = array( 'hierarchical' => true, 'labels' => $labels, 'public' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'local_experts' ) ); register_taxonomy('local_experts','yearbook',$args); $labels = array( 'name' => _x( 'Roles', 'taxonomy general name' ), 'singular_name' => _x( 'Roles', 'taxonomy singular name' ), 'search_items' => __( 'Search Roles' ), 'popular_items' => __( 'Popular Roles' ), 'all_items' => __( 'All Roles' ), 'parent_item' => null, 'parent_item_colon' => null, 'edit_item' => __( 'Edit Roles' ), 'update_item' => __( 'Update Roles' ), 'add_new_item' => __( 'Add New Roles' ), 'new_item_name' => __( 'New Roles Name' ), 'separate_items_with_commas' => __( 'Separate Roles with commas' ), 'add_or_remove_items' => __( 'Add or remove Roles' ), 'choose_from_most_used' => __( 'Choose from the most used Roles' ), 'not_found' => __( 'No Roles found.' ), 'menu_name' => __( 'Roles' )); $args = array( 'hierarchical' => true, 'labels' => $labels, 'public' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'roles' ) ); register_taxonomy('roles','yearbook',$args); register_taxonomy('yearbook_category', 'user', array( 'public' =>true, 'hierarchical' => true, 'labels' =>array( 'name' =>'Yearbook Categories', 'singular_name' =>'Yearbook Category', 'menu_name' =>'Yearbook Categories', 'search_items' =>'Search Yearbook Categories', 'popular_items' =>'Popular Yearbook Categories', 'all_items' =>'All Yearbook Categories', 'edit_item' =>'Edit Yearbook Category', 'update_item' =>'Update Yearbook Category', 'add_new_item' =>'Add New Yearbook Category', 'new_item_name' =>'New Yearbook Category Name', 'separate_items_with_commas'=>'Separate yearbook categories with commas', 'add_or_remove_items' =>'Add or remove yearbook categoriess', 'choose_from_most_used' =>'Choose from the most popular yearbook categories', ), 'rewrite' =>array( 'with_front' =>true, 'slug' =>'author/yearbook_category', ), 'capabilities' => array( 'manage_terms' =>'edit_users', 'edit_terms' =>'edit_users', 'delete_terms' =>'edit_users', 'assign_terms' =>'read', ), )); function add_taxonomy_filters() { global $typenow; // an array of all the taxonomyies you want to display. Use the taxonomy name or slug $taxonomies = array('travel_categories','region','roles','skills','local_experts'); // must set this to the post type you want the filter(s) displayed on if( $typenow == 'yearbook' ){ foreach ($taxonomies as $tax_slug) { $tax_obj = get_taxonomy($tax_slug); $tax_name = $tax_obj->labels->name; $terms = get_terms($tax_slug); if(count($terms) > 0) { echo ""; } } echo ""; } } add_action( 'pre_get_posts', 'wpse45436_posts_filter' ); function wpse45436_posts_filter( $query ){ global $pagenow; $type = 'yearbook'; if (isset($_GET['post_type'])) { $type = $_GET['post_type']; } if ( 'yearbook' == $type && is_admin() && $pagenow=='edit.php' && isset($_GET['auditdate']) && $_GET['auditdate'] != '') { $nextyear = $_GET['auditdate']+1; $query->set('meta_key','auditdate'); $query->set('meta_value',array(strtotime($_GET['auditdate'].'-01-01'),strtotime($nextyear.'-01-01'))); $query->set('meta_compare','BETWEEN'); $query->set('meta_type','numeric'); } } add_action( 'restrict_manage_posts', 'add_taxonomy_filters' ); add_filter( 'manage_taxonomies_for_yearbook_columns', 'yearbook_columns' ); function yearbook_columns( $taxonomies ) { $taxonomies[] = 'travel_categories'; $taxonomies[] = 'roles'; $taxonomies[] = 'region'; $taxonomies[] = 'skills'; $taxonomies[] = 'local_experts'; return $taxonomies; } add_filter('manage_users_columns', 'add_user_id_column'); function add_user_id_column($columns) { $columns['user_id'] = 'Yearbook'; $columns['pr_contacts'] = 'PR / Contacts'; return $columns; } add_action('manage_users_custom_column', 'show_user_id_column_content', 10, 3); function show_user_id_column_content($value, $column_name, $user_id) { $user = get_userdata( $user_id ); if ( 'user_id' == $column_name ){ if(get_user_meta( $user_id, '_person_id', TRUE)){ $columndata = 'Edit Yearbook Entry
'; } $ycats = wp_get_object_terms( $user_id, 'yearbook_category' ); if(count($ycats) > 0){ $columndata .= "Categories:
"; foreach($ycats as $ycat1){ if($ycat1->parent){ $ycat2 = get_term($ycat1->parent,'yearbook_category'); if($ycat2->parent){ $ycat3 = get_term($ycat2->parent,'yearbook_category'); $columndata .= "".$ycat3->name ."
–"; } $columndata .= $ycat2->name ."
—"; } $columndata .= $ycat1->name."
"; } } $columndata .= 'View Profile'; return $columndata; } if ( 'pr_contacts' == $column_name ){ $columndata =""; if(get_user_meta( $user_id, 'contactrel', TRUE)){ $theuser = get_user_by('id',get_user_meta( $user_id, 'contactrel', TRUE)); $columndata .= 'For : '.$theuser->user_login. '
'; } if(get_user_meta( $user_id, 'prcontact', TRUE) && get_user_meta( $user_id, 'prcompany', TRUE)){ $theprcontact = get_user_by('id',get_user_meta( $user_id, 'prcontact', TRUE)); $theprcompany = get_user_by('id',get_user_meta( $user_id, 'prcompany', TRUE)); $columndata .= 'PR : '.$theprcontact->display_name. ' @ '.$theprcompany->display_name.''; } if( get_user_meta( $user_id, 'prcompany', TRUE) && !get_user_meta( $user_id, 'prcontact', TRUE)){ $theprcompany = get_user_by('id',get_user_meta( $user_id, 'prcompany', TRUE)); $columndata .= 'PR : '.$theprcompany->display_name.''; } return $columndata; } return $value; } add_filter('post_row_actions','my_action_child', 10, 2); function my_action_child($actions, $post){ //check for your post type if ($post->post_type =="yearbook"){ $actions['parent_id'] = 'User Profile'; } return $actions; } add_action( 'add_meta_boxes', 'yearbook_meta_box' ); function yearbook_meta_box() { add_meta_box( 'yearbook_tax' ,'Yearbook information', 'meta_box_taxonomy', 'yearbook' ,'side' ,'high' ); add_meta_box( 'yearbook_moderation' ,'Member Status and Moderation', 'meta_box_memstat', 'yearbook' ,'normal' ,'high' ); add_meta_box( 'yearbook_extra' ,'Awards and Publications', 'meta_box_awards_pubs', 'yearbook' ,'normal' ,'high' ); add_meta_box( 'yearbook_extra2' ,'Joomla data ( to be removed )', 'meta_box_awards_joomla', 'yearbook' ,'normal' ,'high' ); } function meta_box_memstat(){ global $post;?>

ID, 'approved',true) == "Yes"){?>checked>
ID, 'objections',true) == "Yes"){?>checked>


ID, 'membership_qual',true) == "Yes"){?>checked>
ID, 'bgtw_member',true);?>
ID, 'yearbook',true) == "Yes"){?>checked>

This is the raw data from the previous site, just here to confirm that the import worked correctly for all values.

ID,'cb_mb_frequentcontributor',true);?> ID,'cb_mb_frequentcontributordates',true);?> ID,'cb_mb_occasionalcontributor',true);?> ID,'cb_mb_occasionalcontributordates',true);?> ID,'cb_mb_recentpubssole',true);?> ID,'cb_mb_recentpubsupdate',true);?> ID,'cb_mb_awards',true);?>ID,'_awards'); if(is_array($awards) && count($awards) > 0){?>
0){ $i = 0; foreach($awards[0] as $award){ ?>
ID,'_publications'); if(is_array($publications) && count($publications) > 0){?>
0){ $i = 0; foreach($publications[0] as $publication){ ?>
(new id: )
ID, 'professional_roles', TRUE). '" style="width:100%;" />';?> '; echo get_post_meta($post->ID, 'specialist_knowledge', TRUE); echo ''; ?> '; echo get_post_meta($post->ID, 'languages', TRUE); echo ''; ?> ID, 'trips', TRUE). '" style="width:100%;" />';?>

View Yearbook Page / Edit User Details
About Yourself#','#

About the user

#'); $buffer=preg_replace($titles,'

Password

',$buffer,1); $biotable='#

Password

.+?#s'; $buffer=preg_replace($biotable,'

Password

',$buffer,1); return $buffer; } //function profile_admin_buffer_start() { ob_start("remove_plain_bio"); } //function profile_admin_buffer_end() { ob_end_flush(); } //add_action('admin_head', 'profile_admin_buffer_start'); //add_action('admin_footer', 'profile_admin_buffer_end'); add_filter( 'wp_insert_post_data', 'nonmembers_draft', 99, 2 ); function nonmembers_draft( $data, $postarr ) { if (!wp_verify_nonce($postarr['_inline_edit'], 'inlineeditnonce')){ if($postarr['post_type'] == "yearbook" ) { $thismembership = get_post_meta($postarr['ID'],'bgtw_member',true); if($thismembership == "Non-Member" || !$thismembership){ if($_GET['action'] != "trash"){ $data['post_status'] = 'draft'; } }else{ $data['post_status'] = 'publish'; $userid = get_post_meta($postarr['ID'],'_user_id',true); //$userid = $yearbookmeta['_user_id'][0]; $user = get_userdata($userid); $user->add_role("bbp_participant"); } } } return $data; } add_action('save_post', 'save_custom'); function save_custom($post_id) { if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return $post_id; if ( !current_user_can( 'edit_post', $post_id ) ) return; if (wp_verify_nonce($_POST['_inline_edit'], 'inlineeditnonce')) return; if(isset($_POST['professional_roles'])){ update_post_meta($post_id,'professional_roles', $_POST['professional_roles']); } if(isset($_POST['languages'])){ update_post_meta($post_id,'languages', $_POST['languages']); } if(isset($_POST['specialist_knowledge'])){ update_post_meta($post_id,'specialist_knowledge', $_POST['specialist_knowledge']); } if(isset($_POST['trips'])){ update_post_meta($post_id,'trips', $_POST['trips']); } if(isset($_POST['yearbook'])){ //update user not yearbook post $userupdate = get_post_meta( $post_id, '_user_id', TRUE); update_user_meta($userupdate, 'readyyearbook','Yes' ); update_post_meta($post_id,'yearbook', $_POST['yearbook']); }else{ delete_user_meta($userupdate, 'readyyearbook'); delete_post_meta($post_id,'yearbook'); } if(isset($_POST['bgtw_member'])){ $thismembership = $_POST['bgtw_member']; update_post_meta($post_id,'bgtw_member', $thismembership); if($thismembership == "Non-Member" || !$thismembership){ $poststatus = "draft"; }else{ $poststatus = "publish"; } //$poststatus = "publish"; // unhook this function so it doesn't loop infinitely remove_action( 'save_post', 'save_custom' ); // update the post, which calls save_post again wp_update_post( array( 'ID' => $post_id, 'post_status' => $poststatus ) ); add_action( 'save_post', 'save_custom' ); }else{ delete_post_meta($post_id,'bgtw_member'); if ( ! wp_is_post_revision( $post_id ) ){ //$setpoststate = wp_update_post(array('ID' => $post_id, 'post_status' => 'draft')); } } if(strlen($_POST['auditdate']) > 0 && $_POST['auditdate'] != get_post_meta($post_id,'auditdate',true)){ global $current_user; get_currentuserinfo(); update_post_meta($post_id,'auditor',$current_user->user_login); $message = "Please login to the members area to view your current audit status and membership:\n\n"; $message .= home_url()."/members/?audit=status\n\n"; $userupdate = get_post_meta($_POST['post_ID'], '_user_id', TRUE); $memberemail =get_user_by('id',$userupdate); $memberemail = $memberemail->user_email; wp_mail($memberemail,sprintf(__('[%s] Your BGTW membership has been audited'), get_option('blogname') ),$message,'From: "BGTW" <'.get_option('admin_email').'>'); delete_post_meta($post_id,'readyaudit'); } $memstats = array("interview","approved","advertised","objections","objections_comments","cardsent","invoicedate","invoicepaid","membership_qual","auditdate","readyaudit"); foreach($memstats as $stat){ if(isset($_POST[$stat])){ if($stat == "auditdate"){ update_post_meta($post_id,$stat,strtotime($_POST[$stat])); }else{ update_post_meta($post_id,$stat,sanitize_text_field($_POST[$stat])); } }else{ delete_post_meta($post_id,$stat); } } } function modify_contact_methods($profile_fields) { // Add new fields $profile_fields['skype'] = 'Skype Username'; $profile_fields['blog'] = 'Personal Blog'; $profile_fields['birthday'] = 'Birthday'; $profile_fields['phone'] = 'Phone'; $profile_fields['mobile'] = 'Mobile'; $profile_fields['fax'] = 'Fax'; $profile_fields['address'] = 'Address'; $profile_fields['city'] = 'City'; $profile_fields['county'] = 'County'; $profile_fields['country'] = 'Country'; $profile_fields['alt_country'] = 'Alt Country'; $profile_fields['postcode'] = 'Postcode'; $profile_fields['alt_address'] = 'Alternate Address'; return $profile_fields; } add_filter('user_contactmethods', 'modify_contact_methods'); } static function get_email_key() { return apply_filters( 'person_email_key', '_email' ); } static function profile_update($user_id,$old_user_data=false) { global $wpdb; $is_new_person = false; $user = get_userdata($user_id); $user_email = ($old_user_data ? $old_user_data->user_email : $user->user_email); $email_key = self::get_email_key(); if(strlen($user_email) > 0 && filter_var(sanitize_text_field($user_email), FILTER_VALIDATE_EMAIL)){ $listid = ""; //remove from other lists // $knewsid = $wpdb->get_var( "SELECT id FROM wp_knewsusers where email = '".$user_email."'" ); $query="delete from wp_knewsuserslists WHERE id_user = '".$knewsid."' and id_list != 8"; $results = $wpdb->query( $query ); switch($user->roles[0]){ case "contributor": $listid = 1; break; case "contact": $listid = 2; break; case "pr": $listid = 3; break; case "pr_contact": $listid = 4; break; case "administrator": $listid = 5; break; case "editor": $listid = 6; break; case "draft-contact": $listid = 7; break; case "subscriber": $listid = 9; break; } if($listid){ do_action('callknews', $user_email,$listid, 'en', 'en_US',array('1'=>$user->user_firstname,'2'=>$user->user_lastname),TRUE); }} if(!in_array("pr_contact",$user->roles) && !in_array("pr",$user->roles) && !in_array("contact",$user->roles) && !in_array("customer",$user->roles)){ if(in_array("subscriber",$user->roles)){ $post_status = "draft"; }else{ $post_status = "publish"; } //$post_status = "publish"; $person_id = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='%s' AND meta_value='%s'",'wordpress_user_login',$user->user_login)); if (!is_numeric($person_id)) { //$person_id = $wpdb->get_var($wpdb->prepare("SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='%s' AND meta_value='%s'",$email_key,$user_email)); } if (!is_numeric($person_id)) { $person_id = $is_new_person = wp_insert_post(array( 'post_type' => 'yearbook', 'post_status' => $post_status, // Maybe this should be pending or draft? 'post_title' => $user->display_name, 'post_name' => $user->user_login, 'post_author' => $user_id, 'post_date' => $user->user_registered, 'post_date_gmt' => $user->user_registered )); } update_user_meta($user_id,'_person_id',$person_id); $lastname = get_user_meta($user_id,'last_name',true); update_post_meta($person_id,'_last_name',$lastname); update_post_meta($person_id,'wordpress_user_login',$user->user_login); update_post_meta($person_id,'_user_id',$user_id); if ($is_new_person || ($old_user_data && $user->user_email!=$old_user_data->user_email)) { update_post_meta($person_id,$email_key,$user->user_email); } } } static function wp_insert_post($person_id,$person) { if ($person->post_type=='yearbook') { // $email = get_post_meta($person_id,self::get_email_key(),true); $associateduser = get_post_meta($person_id,'wordpress_user_login',true); if($associateduser){ $user = get_user_by('login',$associateduser); if ($user) { // Associate the user IF there is an user with the same username update_user_meta($user->ID,'_person_id',$person_id); update_post_meta($person_id,'_user_id',$user->ID); } else { delete_post_meta($person_id,'_user_id'); } } // if (filter_var($email, FILTER_VALIDATE_EMAIL) && !$associateduser) { // $user = get_user_by('email',$email); //if ($user) { // Associate the user IF there is an user with the same email address // update_user_meta($user->ID,'_person_id',$person_id); // update_post_meta($person_id,'_user_id',$user->ID); // } else { // delete_post_meta($person_id,'_user_id'); // } // } } } static function get_user_id($person_id) { return get_user_meta($user_id,'_user_id',true); } static function get_user($person_id) { $user_id = self::get_user_id($person_id); return get_userdata($user_id); } static function get_person_id($user_id) { return get_user_meta($user_id,'_person_id',true); } static function get_person($user_id) { $person_id = self::get_person_id($user_id); return get_post($person_id); } static function author_link($permalink, $user_id) { $author_id = get_user_meta($user_id,'_person_id',true); if ($author_id) // If an associate is found, use it $permalink = get_post_permalink($author_id); return $permalink; } } /****** Add Thumbnails in Manage Posts/Pages List ******/ if ( !function_exists('AddThumbColumn') && function_exists('add_theme_support') ) { // for post and page add_theme_support('post-thumbnails', array( 'post', 'page' ) ); function AddThumbColumn($cols) { $cols['thumbnail'] = __('Thumbnail','purepress'); return $cols; } function AddThumbValue($column_name, $post_id) { $width = (int) 60; $height = (int) 60; if ( 'thumbnail' == $column_name ) { // thumbnail of WP 2.9 $thumbnail_id = get_post_meta( $post_id, '_thumbnail_id', true ); // image from gallery $attachments = get_children( array('post_parent' => $post_id, 'post_type' => 'attachment', 'post_mime_type' => 'image') ); if ($thumbnail_id) $thumb = wp_get_attachment_image( $thumbnail_id, array($width, $height), true ); elseif ($attachments) { foreach ( $attachments as $attachment_id => $attachment ) { $thumb = wp_get_attachment_image( $attachment_id, array($width, $height), true ); } } if ( isset($thumb) && $thumb ) { echo $thumb; } else { echo __('None','purepress'); } } } // for posts add_filter( 'manage_posts_columns', 'AddThumbColumn' ); add_action( 'manage_posts_custom_column', 'AddThumbValue', 10, 2 ); // for pages add_filter( 'manage_pages_columns', 'AddThumbColumn' ); add_action( 'manage_pages_custom_column', 'AddThumbValue', 10, 2 ); } function Auditcolumn($cols) { $cols['audit'] = __('Audit','auditit'); return $cols; } // for pages function AuditValue($column_name, $post_id) { if($column_name == "audit"){ $auditdate = get_post_meta($post_id,'auditdate',true); $readyaudit = get_post_meta($post_id,'readyaudit',true); $sinceaudit = time()-$auditdate; if(strlen($auditdate) < 1){?>
 Not Audited
94672800){ ?>
 01/01/1970
 01/01/1970
94672800){ ?>
 Ready for audit

Yearbook, PR and contact relationships

ID, '_person_id',true)) > 0){?>
ID, 'prcompany',true);?> View PR Company
ID,'prcontact',true); ?> View PR Contact
If no PR contacts are listed, make sure a PR company is selected and saved above.
ID, 'contactrel',true); $founduser = get_user_by('id', $contactrel);?> View Contact
Type the exact username of the related company or contact

ID, 'readyyearbook',true) == "Yes"){ ?>checked />
ID, 'viewyearbook',true) == "Yes"){ ?>checked />
Delete member profile association:
Edit member profile
ID, 'viewaddress',true) == "Yes"){ ?>checked />
ID, 'viewphone',true) == "Yes"){ ?>checked />
ID, 'viewemail',true) == "Yes"){ ?>checked />
ID, 'enhanced',true) == "Yes"){ ?>checked />
0){ update_user_meta( $user_id, 'prcompany', $_POST['prcompany'] ); }else{ delete_user_meta( $user_id, 'prcompany'); } if(strlen($_POST['prcontact']) > 0){ update_user_meta( $user_id, 'prcontact', $_POST['prcontact'] ); }else{ delete_user_meta( $user_id, 'prcontact'); } if(strlen($_POST['jobtitle']) > 0){ update_user_meta( $user_id, 'jobtitle', $_POST['jobtitle'] ); }else{ delete_user_meta( $user_id, 'jobtitle'); } if(strlen($_POST['readyyearbook']) > 0){ update_user_meta( $user_id, 'readyyearbook', $_POST['readyyearbook']); }else{ delete_user_meta( $user_id, 'readyyearbook'); } if(strlen($_POST['viewaddress']) > 0){ update_user_meta( $user_id, 'viewaddress', $_POST['viewaddress'] ); }else{ delete_user_meta( $user_id, 'viewaddress'); } if(strlen($_POST['_person_id_del']) > 0){ delete_user_meta( $user_id, '_person_id'); } if(strlen($_POST['viewyearbook']) > 0 && isset($_POST['viewyearbook'])){ update_user_meta( $user_id, 'viewyearbook', $_POST['viewyearbook']); }else{ delete_user_meta( $user_id, 'viewyearbook'); } if(strlen($_POST['enhanced']) > 0){ update_user_meta( $user_id, 'enhanced', $_POST['enhanced']); }else{ delete_user_meta( $user_id, 'enhanced'); } if(strlen($_POST['readyyearbook']) > 0){ update_user_meta( $user_id, 'readyyearbook', $_POST['readyyearbook']); }else{ delete_user_meta( $user_id, 'readyyearbook'); } if(strlen($_POST['viewphone']) > 0){ update_user_meta( $user_id, 'viewphone', $_POST['viewphone'] ); }else{ delete_user_meta( $user_id, 'viewphone'); } if(strlen($_POST['viewemail']) > 0){ update_user_meta( $user_id, 'viewemail', $_POST['viewemail'] ); }else{ delete_user_meta( $user_id, 'viewemail'); } if(strlen($_POST['contactrel']) > 0){ $founduser = get_user_by('login',trim($_POST['contactrel'])); if($founduser){ update_user_meta( $user_id, 'contactrel', $founduser->ID ); }else{ delete_user_meta( $user_id, 'contactrel'); } }else{ delete_user_meta( $user_id, 'contactrel'); } } show_admin_bar( false ); remove_action("admin_color_scheme_picker", "admin_color_scheme_picker"); function my_register_user_taxonomy() { register_taxonomy( 'profession', 'user', array( 'public' => true, 'labels' => array( 'name' => __( 'Professions' ), 'singular_name' => __( 'Profession' ), 'menu_name' => __( 'Professions' ), 'search_items' => __( 'Search Professions' ), 'popular_items' => __( 'Popular Professions' ), 'all_items' => __( 'All Professions' ), 'edit_item' => __( 'Edit Profession' ), 'update_item' => __( 'Update Profession' ), 'add_new_item' => __( 'Add New Profession' ), 'new_item_name' => __( 'New Profession Name' ), 'separate_items_with_commas' => __( 'Separate professions with commas' ), 'add_or_remove_items' => __( 'Add or remove professions' ), 'choose_from_most_used' => __( 'Choose from the most popular professions' ), ), 'rewrite' => array( 'with_front' => true, 'slug' => 'author/profession' // Use 'author' (default WP user slug). ), 'capabilities' => array( 'manage_terms' => 'edit_users', // Using 'edit_users' cap to keep this simple. 'edit_terms' => 'edit_users', 'delete_terms' => 'edit_users', 'assign_terms' => 'read', ), 'update_count_callback' => 'my_update_profession_count' // Use a custom function to update the count. ) ); } function fb_change_mce_options($initArray) { // Comma separated string od extendes tags // Command separated string of extended elements // $ext = 'a[src|id|name|class|style|href|target|rel|alt],embed[src|id|name|class|style],img[src|id|name|class|style],pre[id|name|class|style],iframe[align|longdesc|name|width|height|frameborder|scrolling|marginheight|marginwidth|src],dl[id|name|class|style|rel|alt],dt[id|name|class|style|rel|alt],caption[*]'; $ext = '*[*]'; if ( isset( $initArray['extended_valid_elements'] ) ) { $initArray['extended_valid_elements'] .= ',' . $ext; } else { $initArray['extended_valid_elements'] = $ext; } return $initArray; } add_filter('tiny_mce_before_init', 'fb_change_mce_options'); add_action( 'admin_enqueue_scripts', 'enqueue_date_picker' ); function enqueue_date_picker(){ wp_enqueue_script( 'field-date-js', get_template_directory_uri().'/javascripts/Field_Date.js', array('jquery', 'jquery-ui-core', 'jquery-ui-datepicker'), time(), true ); wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css'); } add_action( 'admin_menu', 'register_my_custom_menu_page' ); function register_my_custom_menu_page(){ add_menu_page( 'custom menu title', 'Menus', 'manage_options', 'nav-menus.php', '', get_template_directory_uri().'/images/menus.png', 25); } // Custom WordPress Login Logo function login_css() { wp_enqueue_style( 'login_css', get_template_directory_uri() . '/css/login.css' ); } add_action('login_head', 'login_css'); function loginpage_custom_link() { return home_url(); } add_filter('login_headerurl','loginpage_custom_link'); function change_title_on_logo() { return ''; } add_filter('login_headertitle', 'change_title_on_logo'); /* Add message above login form */ function wpsd_add_login_message() { return '

If you had a login for BGTW prior to 2014, you will need to reset your password to re-activate your account!

'; } add_filter('login_message', 'wpsd_add_login_message'); class RRHE { // Register the column - Registered function registerdate($columns) { $columns['registerdate'] = __('Registered', 'registerdate'); return $columns; } // Display the column content public static function registerdate_columns( $value, $column_name, $user_id ) { if ( 'registerdate' != $column_name ) return $value; $user = get_userdata( $user_id ); $registered = strtotime(get_date_from_gmt($user->user_registered)); $registerdate = ''. date_i18n(get_option('date_format'), $registered ) .'
'. date_i18n(get_option('time_format'), $registered ) .'
' ; return $registerdate; } public static function registerdate_column_sortable($columns) { $custom = array( // meta column id => sortby value used in query 'registerdate' => 'registered', ); return wp_parse_args($custom, $columns); } function registerdate_column_orderby( $vars ) { if ( isset( $vars['orderby'] ) && 'registerdate' == $vars['orderby'] ) { $vars = array_merge( $vars, array( 'meta_key' => 'registerdate', 'orderby' => 'meta_value' ) ); } return $vars; } } // Actions add_filter( 'manage_users_columns', array('RRHE','registerdate')); add_action( 'manage_users_custom_column', array('RRHE','registerdate_columns'), 10, 3); add_filter( 'manage_users_sortable_columns', array('RRHE','registerdate_column_sortable') ); add_filter( 'request', array('RRHE','registerdate_column_orderby') ); //disable standard profile edit for all but admin function stop_access_profile() { if(is_admin() && ! defined( 'DOING_AJAX' ) ){ if(!current_user_can( 'manage_options' ) && !current_user_can('editor')){ header("Location: ".home_url()."/members/"); exit; } } if(IS_PROFILE_PAGE === true) { if(!current_user_can( 'manage_options' )){ global $current_user; get_currentuserinfo(); header("Location: ".home_url()."/members/edit-profile/"); exit; } } } add_action( 'admin_init', 'stop_access_profile' ); // Redefine user notification function if ( !function_exists('wp_new_user_notification') ) { function wp_new_user_notification( $user_id, $plaintext_pass = '' ) { $user = new WP_User( $user_id ); $user_login = stripslashes( $user->user_login ); $user_email = stripslashes( $user->user_email ); $mainrole = $user->roles[0]; $message = sprintf( __('New user registration on %s:'), get_option('blogname') ) . "\r\n\r\n"; if($mainrole == "draft-contact"){ $message .= "This user is currently a 'DRAFT-CONTACT' meaning they will not appear in the yearbook listings, to activate or edit there profile go here:\n"; $message .= home_url()."/members/edit-profile/?useredit=".$user_login."\n\n"; }elseif($mainrole == "subscriber"){ $message .= "This user is a 'MEMBERSHIP APPLICANT (Subscriber)', to audit there application and track there membership go here:\n"; $message .= admin_url()."post.php?post=".get_user_meta($user->ID,'_person_id',true)."&action=edit"."\n\n"; $message .= "Or go here to edit and view there profile:\n\n"; $message .= home_url()."/members/edit-profile/?useredit=".$user_login."\n\n"; }elseif($mainrole == "contributor"){ $message .= "This user is a 'ACTIVE MEMBER (Contributor)', to audit there application and track there membership go here:\n"; $message .= admin_url()."post.php?post=".get_user_meta($user->ID,'_person_id',true)."&action=edit"."\n\n"; $message .= "Or go here to edit and view there profile:\n\n"; $message .= home_url()."/members/edit-profile/?useredit=".$user_login."\n\n"; }elseif($mainrole == "pr_contact"){ $prcompany = get_user_by('id',get_user_meta($user->ID,'prcompany',true)); $message .= "This user is a 'PR CONTACT' associated with '".$prcompany->display_name."', to edit there profile go here:\n"; $message .= home_url()."/members/edit-profile/?useredit=".$user_login."\n\n"; $message .= "To edit the 'PR COMPANY' they are associated with go here:\n"; $message .= home_url()."/members/edit-profile/?useredit=".$prcompany->user_login."\n\n"; }else{ $message .= "This user is a '".strtoupper($mainrole)."' to edit there profile go here:\n"; $message .= home_url()."/members/edit-profile/?useredit=".$user_login."\n\n"; $contactrel = get_user_by('id',get_user_meta($user->ID,'contactrel',true)); if($contactrel){ $message .= "To edit the 'CONTACT' they are associated with go here:\n\n"; $message .= home_url()."/members/edit-profile/?useredit=".$contactrel->user_login."\n\n"; } } $message .= sprintf( __('Username: %s'), $user_login ) . "\r\n\r\n"; $message .= sprintf( __('E-mail: %s'), $user_email ) . "\r\n"; wp_mail( get_option('admin_email'), sprintf(__('[%s] New User Registration'), get_option('blogname') ), $message ); if ( empty( $plaintext_pass ) ) return; if($mainrole == "draft-contact"){ $message = sprintf( __("Welcome to %s! "), get_option('blogname')) . "\r\n\r\n"; $message .= "Thank you for your completing our form to be listed in our Yearbook. Your details will be checked by our moderators and you'll be notified once your profile is live on our site.\n\n"; $message .= "In the meantime if you would like to update your application with additional information please feel free to do so by logging into the website using the following login details:\n\n"; $message .= sprintf( __('Username: %s'), $user_login ) . "\r\n"; $message .= sprintf( __('Password: %s'), $plaintext_pass ) . "\r\n\r\n"; $message .= "Thanks,"."\n\n"; $message .= "BGTW"; }elseif($mainrole == "subscriber"){ $message = sprintf( __("Welcome to %s! "), get_option('blogname')) . "\r\n\r\n"; $message .= "Thank you for your completing the application form and your interest in joining the Guild. Your application has been sent to the Membership Secretary who will be in touch shortly to clarify any points on your application or to let you know if you qualify for an interview. If you have any questions please feel free to contact the Membership Secretary via email on membership_secretary@bgtw.org\n\n"; $message .= "In the meantime if you would like to update your application with additional information please feel free to do so by logging into the website using the following login details:\n\n"; $message .= sprintf( __('Username: %s'), $user_login ) . "\r\n"; $message .= sprintf( __('Password: %s'), $plaintext_pass ) . "\r\n\r\n"; $message .= "Thanks,"."\n\n"; $message .= "BGTW"; }else{ $message = sprintf( __("Welcome to %s! "), get_option('blogname')) . "\r\n\r\n"; $message = "You can now login to the members area to update your profile on the site and in our yearbook:"."\n"; $message .= home_url() . "\r\n\n"; $message .= sprintf( __('Username: %s'), $user_login ) . "\r\n"; $message .= sprintf( __('Password: %s'), $plaintext_pass ) . "\r\n\r\n"; $message .= sprintf( __('If you have any problems, please contact us %s.'), get_option('admin_email') ) . "\r\n\r\n"; $message .= "Thanks,"."\n\n"; $message .= "BGTW"; } wp_mail( $user_email, 'Your new username and password for the British Guild of Travel Writers Website', $message ); //wp_mail( //$user_email, //sprintf( __('[%s] Your username and password'), get_option('blogname') ), //$message //); } } // Disable support for comments and trackbacks in post types function df_disable_comments_post_types_support() { $post_types = get_post_types(); foreach ($post_types as $post_type) { if(post_type_supports($post_type, 'comments')) { remove_post_type_support($post_type, 'comments'); remove_post_type_support($post_type, 'trackbacks'); } } } add_action('admin_init', 'df_disable_comments_post_types_support'); // Close comments on the front-end function df_disable_comments_status() { return false; } add_filter('comments_open', 'df_disable_comments_status', 20, 2); add_filter('pings_open', 'df_disable_comments_status', 20, 2); // Hide existing comments function df_disable_comments_hide_existing_comments($comments) { $comments = array(); return $comments; } add_filter('comments_array', 'df_disable_comments_hide_existing_comments', 10, 2); // Remove comments page in menu function df_disable_comments_admin_menu() { remove_menu_page('edit-comments.php'); global $current_user; get_currentuserinfo(); if(!current_user_can( 'manage_options' )){ remove_menu_page('themes.php'); remove_menu_page('plugins.php'); } } add_action('admin_menu', 'df_disable_comments_admin_menu'); // Redirect any user trying to access comments page function df_disable_comments_admin_menu_redirect() { global $pagenow; if ($pagenow === 'edit-comments.php') { wp_redirect(admin_url()); exit; } } add_action('admin_init', 'df_disable_comments_admin_menu_redirect'); // Remove comments metabox from dashboard function df_disable_comments_dashboard() { remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal'); } add_action('admin_init', 'df_disable_comments_dashboard'); // Remove comments links from admin bar function df_disable_comments_admin_bar() { if (is_admin_bar_showing()) { remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60); } } add_action('init', 'df_disable_comments_admin_bar'); function remove_admin_bar_links() { global $wp_admin_bar; $wp_admin_bar->remove_menu('updates'); // Remove the updates link $wp_admin_bar->remove_menu('comments'); // Remove the comments link } add_action( 'wp_before_admin_bar_render', 'remove_admin_bar_links' ); function add_jquery_data() { global $parent_file; if ( isset( $_GET['user_id'] ) && $parent_file == 'users.php' || isset( $_GET['user_id'] ) && $parent_file == 'profile.php') { ?> .inside p.hide-if-no-js a img.attachment-post-thumbnail { width: 230px!important;} '; } function no_redirect_guess_404_permalink( $header ){ global $wp_query; if( is_404() && $wp_query->query_vars['post_type'] == "yearbook" ) unset( $wp_query->query_vars['name'] ); return $header; } add_filter( 'status_header', 'no_redirect_guess_404_permalink' ); yearbook::on_load(); } ?>