A listing of Work Log entries
“;
$poseol = strpos($mystring, PHP_EOL, $pos);
if ( $poseol === false) {
//echo ‘SA — eol not found
‘;
} else {
//echo “SA — eol was found at $poseol
“;
$starter = $pos+strlen($findme)+6; // the offset is 6 because a > shows up as >
$resul = substr($mystring, $starter, $poseol-$starter);
//echo “SA — the result is —$resul—
“;
}
}
return $resul;
}
global $wpdb;
$poststable = $wpdb->prefix . “posts”;
$postmetatable = $wpdb->prefix . “postmeta”;
$result = $wpdb->get_results ( ”
SELECT *
FROM $wpdb->posts p
WHERE p.post_type = ‘feedback’ and post_status = ‘publish’
order by p.post_date
” );
// inner join $wpdb->postmeta m on p.ID = m.post_id
$aresult = array();
if (! $result) {
$Error = $wpdb->print_error();
die(“The following error was found: $Error”);
} else {
foreach ( $result as $page )
{
echo $page->ID.’ ‘.$page->post_title.’ ‘.$page->meta_key.’
‘;
$content = $page->post_content;
//$uc = unserialize($content);
echo $content;
//print_r($uc);
echo ‘
——————raw data ————
‘;
//SELECT meta_value FROM `wp_udwkt4_postmeta` WHERE post_id = ‘1037’ and meta_key = ‘_feedback_extra_fields’
$pmetass = “SELECT meta_value FROM `wp_udwkt4_postmeta` WHERE post_id = ‘$page->ID’ and meta_key = ‘_feedback_extra_fields'”;
$pmetaem = “SELECT meta_value FROM `wp_udwkt4_postmeta` WHERE post_id = ‘$page->ID’ and meta_key = ‘_feedback_email'”;
$pmetaakis = “SELECT meta_value FROM `wp_udwkt4_postmeta` WHERE post_id = ‘$page->ID’ and meta_key = ‘_feedback_akismet_values'”;
//echo ‘pmetass
‘.$pmetass.’
‘;
//echo ‘pmetaem
‘.$pmetaem.’
‘;
$pmeta = $wpdb->get_var($pmetass);
//$pmetae = $wpdb->get_var($pmetaem);
//$pmetaa = $wpdb->get_var($pmetaakis);
//echo ‘pmeta
‘.$pmeta.’
—————————-
‘;
//echo ‘pmetae
‘.$pmetae.’
—————————-
‘;
//echo ‘pmetaa
‘.$pmetaa.’
—————————-
‘;
$extraf = unserialize($pmeta);
//$feede = unserialize($pmetae);
$thename = shittyarray($content, ‘[1_Leader Name]’);
$theemail = shittyarray($content, ‘[2_Leader Email]’);
$thedesc = shittyarray($content, ‘[3_Project Description]’);
$thecount = shittyarray($content, ‘[4_Count of people attending]’);
$thegroup = shittyarray($content, ‘[5_Total hours for the group]’);
if ($thegroup === ‘not found’ ) { $thegroup = shittyarray($content, ‘[5_Total hours for the group.]’); }
$thehours = $extraf[‘9_Total hours for the group.’];
if ($thehours === ‘not found’ ) { $thehours = shittyarray($content, ‘[5_Total hours for the group]’); }
if ($thehours === ‘not found’ or $thehours == “” ) { $thehours = $thegroup; }
$thedate = $extraf[’10_Project Date’];
echo ‘Leader Name: ‘.$thename.’
‘;
echo ‘Leader Email: ‘.$theemail.’
‘;
echo ‘Project Description: ‘.$thedesc.’
‘;
echo ‘Count of People Attending: ‘.$thecount.’
‘;
echo ‘Total Hours for the Group: ‘.$thegroup.’
‘;
echo ‘Project Date: ‘.shittyarray($content, ‘[6_Project Date]’).’
‘;
echo ‘Attendee list: ‘.shittyarray($content, ‘[7_Attendee list]’).’
‘;
echo ‘Count of people attending: ‘.$extraf[‘8_Count of people attending’].’
‘;
echo ‘Total Hours for the group: ‘.$thehours.’
‘;
echo ‘Project Date: ‘.$thedate.’
‘;
echo ‘Attendees: ‘.$extraf[’11_Attendee list’].’
‘;
$aresult[$page->ID][“Name”] = $thename;
$aresult[$page->ID][“Email”] = $theemail;
$aresult[$page->ID][“Desc”] = $thedesc;
$aresult[$page->ID][“metakey”] = $page->meta_key;
$aresult[$page->ID][“Count”] = $thecount;
$aresult[$page->ID][“Hours”] = $thehours;
$aresult[$page->ID][“Date”] = $thedate;
echo ‘——————one feedback—————–
‘;
}
}
//END of result loop
echo ‘——————thearray aresult—————–
‘;
echo ‘
Leader | Work Done | Participants | Hours | Date |
---|---|---|---|---|
‘ . $row[‘Name’] . ‘ | ‘ . $row[‘Desc’] . ‘ | ‘ . $row[‘Count’] . ‘ | ‘ . $row[‘Hours’] . ‘ | ‘ . $row[‘Date’] . ‘ |
‘;
?>