I reinstalled WordPress 5.2.3… by going to updates and clicking re-install…
still does not work.
So let me share what I’m doing, maybe that is affecting it.
I created a mu-plugin.
TO listen for a webhook that gets posted from another site.
That webhook wants a 200 ok returned to it, so I did it like this, at the end of when I finish what I need to do with the data in the webhook, I run this function: leaveOkFine();
the code of which is below:
function leaveOkFine() {
eval(header("HTTP/1.1 200 OK"));
exit;
}
I have it eval in case other stuff already ran, so that there are no other headers and it will just print the header 200 ok and exit.
this is the last thing though, I don’t run it until after I process stuff.
I have it right now, echo printing data and it does work, I see data process until it hits that, and then it stops right where it is supposed to.
So how can I tell if wp files are being loaded?
Is there something I can add in the code that is getting executed to see if wp is loaded?
I run this code, in part:
if($_REQUEST['somekey'] == "webhookvalue") {
// webhook is POSTING data... take over...
$_cfirstname = $_REQUEST['customer']['first_name'];
$_lfirstname = $_REQUEST['customer']['last_name'];
$_cemail = $_REQUEST['customer']['email'];
$_cip = $_REQUEST['customer']['ip_address'];
$_addyline1 = $_REQUEST['customer']['address']['line1'];
$_addyline2 = $_REQUEST['customer']['address']['line2'];
$_addycity = $_REQUEST['customer']['address']['city'];
$_addystate = $_REQUEST['customer']['address']['state'];
$_addycountry = $_REQUEST['customer']['address']['country'];
$_addyzip = $_REQUEST['customer']['address']['zip'];
echo "Visitor First Name is: " . $_cfirstname . "<br />\n";
echo "Visitor Last Name is: " . $_lfirstname . "<br />\n";
echo "Visitor EMail is: " . $_cemail . "<br />\n";
echo "Visitor IP is: " . $_cip . "<br />\n";
echo "line1 is: " . $_addyline1 . "<br />\n";
echo "line2 is: " . $_addyline2 . "<br />\n";
echo "city is: " . $_addycity . "<br />\n";
echo "state is: " . $_addystate . "<br />\n";
echo "country is: " . $_addycountry . "<br />\n";
echo "zip is: " . $_addyzip . "<br />\n";
echo "Checking for email...<br />";
$_userloginemail = $_cemail;
$_muser = get_user_by( 'email', $_userloginemail );
if($_muser->ID) {
echo 'User is ' . $_muser->user_login . "( " . $_muser->ID . " )" . " - " . $_muser->first_name . ' ' . $_muser->last_name;
echo "<br />";
…
That all works.
but, did wordpress load the files it uses before this? or does it do it AFTER, and I preempt it by doing the eval and printing the header with 200 ok…?
Is that way that ‘get_userdata’ function is saying it does not exist?
If it is preempting it, then is there a way to call it without it printing headers, so I can print the header with 200 ok for the response?
Thanks,
-Richard