|
@@ -27,6 +27,33 @@ if (!class_exists("plug_wookook")) {
|
|
add_role("suspenderet-abonnent", "Suspenderet abonnent", array('read' => true, 'level_0' => false));
|
|
add_role("suspenderet-abonnent", "Suspenderet abonnent", array('read' => true, 'level_0' => false));
|
|
add_role("betalende-abonnent", "Betalende abonnent", array('read' => true, 'level_0' => true));
|
|
add_role("betalende-abonnent", "Betalende abonnent", array('read' => true, 'level_0' => true));
|
|
|
|
|
|
|
|
+ add_action('manage_users_custom_column', array(&$this, 'imel_custom_column_userfield'), 15, 3);
|
|
|
|
+ add_filter('manage_users_columns', array(&$this, 'imel_column_userfield'), 15, 1);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function imel_column_userfield($defaults) {
|
|
|
|
+
|
|
|
|
+ $defaults['abostatus'] = __('Abo Status', 'id-column');
|
|
|
|
+ $defaults['aboproduct'] = __('Abo Product', 'id-column');
|
|
|
|
+ return $defaults;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function imel_custom_column_userfield($value, $column_name, $id) {
|
|
|
|
+ if ($column_name == 'aboproduct') {
|
|
|
|
+
|
|
|
|
+ $burl = get_option($this->pluginname . "_woohook_baseurl_order");
|
|
|
|
+ $pid = get_user_meta($id, 'abo_prod', true);
|
|
|
|
+
|
|
|
|
+ $s = '<a href="' . $burl . '' . $pid . '">' . $pid . '</a>';
|
|
|
|
+ return $s;
|
|
|
|
+ }
|
|
|
|
+ if ($column_name == 'abostatus') {
|
|
|
|
+ $s = get_user_meta($id, 'abo_status', true);
|
|
|
|
+ $s .= " " . get_user_meta($id, 'abo_statuscode', true);
|
|
|
|
+ return $s;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
function xx__update_custom_roles() {
|
|
function xx__update_custom_roles() {
|
|
@@ -40,6 +67,13 @@ if (!class_exists("plug_wookook")) {
|
|
function header() {
|
|
function header() {
|
|
|
|
|
|
if (isset($_REQUEST['woohook'])) {
|
|
if (isset($_REQUEST['woohook'])) {
|
|
|
|
+ $hh = apache_request_headers();
|
|
|
|
+ if (isset($hh["X-WC-Webhook-Source"])) {
|
|
|
|
+ $shopurl = $hh["X-WC-Webhook-Source"];
|
|
|
|
+ } else {
|
|
|
|
+ $shopurl = null;
|
|
|
|
+ }
|
|
|
|
+
|
|
$thecode = get_option($this->pluginname . "_wookook_code", false);
|
|
$thecode = get_option($this->pluginname . "_wookook_code", false);
|
|
$exitrole = trim(get_option($this->pluginname . "_wookook_exitrole", false));
|
|
$exitrole = trim(get_option($this->pluginname . "_wookook_exitrole", false));
|
|
|
|
|
|
@@ -73,6 +107,7 @@ if (!class_exists("plug_wookook")) {
|
|
if (isset($itemroles["" . $line['product_id']])) {
|
|
if (isset($itemroles["" . $line['product_id']])) {
|
|
$found = true;
|
|
$found = true;
|
|
$therole = $itemroles["" . $line['product_id']];
|
|
$therole = $itemroles["" . $line['product_id']];
|
|
|
|
+ $theproduct = $line['product_id'];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -131,9 +166,10 @@ if (!class_exists("plug_wookook")) {
|
|
|
|
|
|
update_user_meta($user_id, 'abo_status', "ACTIVE");
|
|
update_user_meta($user_id, 'abo_status', "ACTIVE");
|
|
update_user_meta($user_id, 'abo_statuscode', $order['id']);
|
|
update_user_meta($user_id, 'abo_statuscode', $order['id']);
|
|
|
|
+ update_user_meta($user_id, 'abo_prod', $theproduct);
|
|
|
|
|
|
wp_send_new_user_notifications($user_id, 'both');
|
|
wp_send_new_user_notifications($user_id, 'both');
|
|
- $resu[] = "CREATED: " . $order['status'] . " $active $user_id or $user_email exists role > '$xrole'";
|
|
|
|
|
|
+ $resu[] = "CREATED: " . $order['status'] . " $active :: $theproduct :: $user_id or $user_email exists role > '$xrole'";
|
|
|
|
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -146,8 +182,9 @@ if (!class_exists("plug_wookook")) {
|
|
|
|
|
|
update_user_meta($user_id, 'abo_status', $active ? "ACTIVE" : "SUSPENDED");
|
|
update_user_meta($user_id, 'abo_status', $active ? "ACTIVE" : "SUSPENDED");
|
|
update_user_meta($user_id, 'abo_statuscode', $order['id']);
|
|
update_user_meta($user_id, 'abo_statuscode', $order['id']);
|
|
|
|
+ update_user_meta($user_id, 'abo_prod', $theproduct);
|
|
|
|
|
|
- $resu[] = "UPDATED: " . $order['status'] . " $active $user_id or $user_email exists role > '$xrole'";
|
|
|
|
|
|
+ $resu[] = "UPDATED: " . $order['status'] . " $active :: $theproduct :: $user_id or $user_email exists role > '$xrole'";
|
|
}
|
|
}
|
|
$aemail = get_bloginfo('admin_email');
|
|
$aemail = get_bloginfo('admin_email');
|
|
$rr = wp_mail($aemail, 'CCR ' . count($resu) . " : " . getenv('HOSTNAME') . " : " . $_SERVER['REMOTE_ADDR'] . " : " . $_SERVER['SERVER_ADDR'] . " : " . $_SERVER['SERVER_NAME'] . " " . date("U"), "::" . print_r($resu, true));
|
|
$rr = wp_mail($aemail, 'CCR ' . count($resu) . " : " . getenv('HOSTNAME') . " : " . $_SERVER['REMOTE_ADDR'] . " : " . $_SERVER['SERVER_ADDR'] . " : " . $_SERVER['SERVER_NAME'] . " " . date("U"), "::" . print_r($resu, true));
|
|
@@ -176,11 +213,21 @@ if (!class_exists("plug_wookook")) {
|
|
|
|
|
|
update_option($pre . '_item_roles', $_POST[$pre . '_item_roles']);
|
|
update_option($pre . '_item_roles', $_POST[$pre . '_item_roles']);
|
|
|
|
|
|
|
|
+ update_option($pre . '_baseurl_product', $_POST[$pre . '_baseurl_product']);
|
|
|
|
+ update_option($pre . '_baseurl_order', $_POST[$pre . '_baseurl_order']);
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
function admin_line($pre) {
|
|
function admin_line($pre) {
|
|
|
|
|
|
?>
|
|
?>
|
|
|
|
+<?php echo (__("Shop baseurl products:", "dagsopt")) ?><br>
|
|
|
|
+ <input name="<?php echo ($pre . '_baseurl_product'); ?>" value="<?php echo (stripcslashes(get_option($pre . "_baseurl_product"))); ?>">
|
|
|
|
+<?php echo (__("Shop baseurl orders:", "dagsopt")) ?><br>
|
|
|
|
+ <input name="<?php echo ($pre . '_baseurl_order'); ?>" value="<?php echo (stripcslashes(get_option($pre . "_baseurl_order"))); ?>">
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
<?php echo (__("Itemnumber1 ... ItemnumberN > Role:", "dagsopt")) ?><br>
|
|
<?php echo (__("Itemnumber1 ... ItemnumberN > Role:", "dagsopt")) ?><br>
|
|
<textarea name="<?php echo ($pre . '_item_roles'); ?>" rows="7" class="large-text code"><?php echo (stripcslashes(get_option($pre . "_item_roles"))); ?></textarea>
|
|
<textarea name="<?php echo ($pre . '_item_roles'); ?>" rows="7" class="large-text code"><?php echo (stripcslashes(get_option($pre . "_item_roles"))); ?></textarea>
|
|
|
|
|