Pull email and name from Flamingo plugin's database using meta_key

2.8k Views Asked by At

I am trying to pull the name and email from the database and show on the front end of my website. I tried many scripts and looked on the flamingo forum as well. But couldnt find a solution.

All the data is saved in one of the wp_postmeta. How do I differentiate flemingo postmeta as there are multiple postmetas? and how do I pull in just flemingo _field_fullname and _from_email ? Here is a database dump

INSERT INTO `wp_postmeta` (`meta_id`, `post_id`, `meta_key`, `meta_value`) VALUES
(5874, 1438, '_field_fullname', 'Jason'),
(5875, 1438, '_field_phone', '04112343'),
(5876, 1438, '_field_email', '[email protected]'),

Thanks heaps in advance.

https://wordpress.org/plugins/flamingo/

1

There are 1 best solutions below

0
Ben On

I made a dashboard widget to show latest emails which might help

//Add custom dashboard widget

function my_custom_dashboard_widgets() {
 wp_add_dashboard_widget('my_show_latest_emails', 'Latest Emails', 
'my_show_latest_emails');
}
add_action('wp_dashboard_setup', 'my_custom_dashboard_widgets');


//function to get emails
function my_show_latest_emails() {

echo '<div id="activity-widget">';

$args = array(
    'numberposts' => 10,
    'offset' => 0,
    'category' => 0,
    'orderby' => 'post_date',
    'order' => 'DESC',
    'include' => '',
    'exclude' => '',
    'meta_key' => '',
    'meta_value' =>'',
    'post_type' => 'flamingo_inbound',
    'post_status' => 'publish',
    'suppress_filters' => true
);

$recent_emails = wp_get_recent_posts( $args, ARRAY_A );

if($recent_emails)
{
    echo '<table><thead><th>Date</th><th>Email</th></thead><tbody>';
    foreach($recent_emails as $email){
        echo '<tr>';
        echo '<td>' . $email->post_date . '</td>';
        echo '<td>' . $email->post_title . '</td>';
        echo '</tr>';

    }
    echo '</tbody></table>';
}

if ( !$recent_emails) {
    echo '<div class="no-activity">';
    echo '<p class="smiley"></p>';
    echo '<p>' . __( 'No activity yet!' ) . '</p>';
    echo '</div>';
}

echo '</div>';
}