function test_get_contact_by_email() { $this->Rt_Contact->add_contact('sherlock holmes'); $this->Rt_Contact->add_contact('John Watson'); $posts = get_posts(array('post_type' => rtbiz_get_contact_post_type())); $this->assertEquals(2, sizeof($posts)); update_post_meta($posts[1]->ID, Rt_Entity::$meta_key_prefix . Rt_Contact::$primary_email_key, '*****@*****.**'); $contact = rtbiz_get_contact_by_email('*****@*****.**'); $this->assertEquals('sherlock holmes', $contact[0]->post_title); }
function rtbiz_get_contact_edit_link($email) { $post = rtbiz_get_contact_by_email($email); if (!empty($post)) { return get_edit_post_link($post[0]->ID); } else { return '#'; } }