[freeside-commits] branch master updated. 99818af994e0731542beebc1045cfc33dcf746f1
Ivan
ivan at 420.am
Wed Apr 19 12:57:58 PDT 2017
The branch, master has been updated
via 99818af994e0731542beebc1045cfc33dcf746f1 (commit)
from 786daeef39e4009958f732744cacc0d24d16d021 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 99818af994e0731542beebc1045cfc33dcf746f1
Author: Ivan Kohler <ivan at freeside.biz>
Date: Wed Apr 19 12:57:57 2017 -0700
add logout to example wordpress self-service, RT#75279
diff --git a/fs_selfservice/wordpress/README.txt b/fs_selfservice/wordpress/README.txt
index 759f839..f068e82 100644
--- a/fs_selfservice/wordpress/README.txt
+++ b/fs_selfservice/wordpress/README.txt
@@ -38,10 +38,11 @@ VPN or tunnel.
Usage:
-See the included example_login.php, process_login.php, example_selfservice.php
-and view_invoice.php files. These files perform a self-service login
-and display a basic landing page. To use, copy them to the wordpress content
-directory (or a subdirectory), and point your browser to example_login.php
+See the included example_login.php, process_login.php, process_login.php,
+example_selfservice.php and view_invoice.php files. These files perform a
+self-service login and display a basic landing page. To use, copy them and
+the elements/ subdirectory to the wordpress content directory (or a
+subdirectory) and point your browser to example_login.php
For full API documentation including all available functions, their arguments
and return data, see
diff --git a/fs_selfservice/wordpress/example_selfservice.php b/fs_selfservice/wordpress/example_selfservice.php
index 2bfb5b3..6e5049c 100644
--- a/fs_selfservice/wordpress/example_selfservice.php
+++ b/fs_selfservice/wordpress/example_selfservice.php
@@ -60,6 +60,7 @@ get_header();
<p><a href="view_invoice.php?invnum=<?php echo $max_invnum ?>">View my Bill</a></p>
<p><a href="change_bill.php">Change Bill Deliver Options</a></p>
+<p><a href="process_logout.php">Logout</a></p>
<h3>Services</h3>
diff --git a/fs_selfservice/wordpress/freeside_selfservice.php b/fs_selfservice/wordpress/freeside_selfservice.php
index d26c56f..852c22e 100644
--- a/fs_selfservice/wordpress/freeside_selfservice.php
+++ b/fs_selfservice/wordpress/freeside_selfservice.php
@@ -46,6 +46,22 @@ function freeside_server_input() {
//TODO: remove freeside_server on uninstall
function freeside_init() {
+
+ if ( $GLOBALS['FREESIDE_PROCESS_LOGOUT'] ) {
+ $GLOBALS['FREESIDE_PROCESS_LOGOUT'] = false;
+
+ $freeside = new FreesideSelfService();
+ $response = $freeside->logout( array(
+ 'session_id' => $_COOKIE['freeside_session_id'],
+ ) );
+ setcookie('freeside_session_id', '', time() - 3600);
+ $error = $response['error'];
+ if ( $error ) {
+ error_log("Logout error: $error");
+ }
+ return;
+ }
+
if ( ! $GLOBALS['FREESIDE_PROCESS_LOGIN'] ) {
return;
} else {
@@ -129,7 +145,7 @@ class FreesideSelfService {
)));
$file = file_get_contents($URL, false, $context);
$response = xmlrpc_decode($file);
- if (xmlrpc_is_fault($response)) {
+ if (isset($response) && xmlrpc_is_fault($response)) {
trigger_error("[FreesideSelfService] XML-RPC communication error: $response[faultString] ($response[faultCode])");
} else {
//error_log("[FreesideSelfService] $response");
diff --git a/fs_selfservice/wordpress/process_logout.php b/fs_selfservice/wordpress/process_logout.php
new file mode 100644
index 0000000..398fb22
--- /dev/null
+++ b/fs_selfservice/wordpress/process_logout.php
@@ -0,0 +1,13 @@
+<?php
+
+$GLOBALS['FREESIDE_PROCESS_LOGOUT'] = true;
+
+require( dirname( __FILE__ ) . '/wp-blog-header.php' );
+
+get_header();
+
+?>
+
+You have been logged out.
+
+<?php get_footer(); ?>
-----------------------------------------------------------------------
Summary of changes:
fs_selfservice/wordpress/README.txt | 9 +++++----
fs_selfservice/wordpress/example_selfservice.php | 1 +
fs_selfservice/wordpress/freeside_selfservice.php | 18 +++++++++++++++++-
fs_selfservice/wordpress/process_logout.php | 13 +++++++++++++
4 files changed, 36 insertions(+), 5 deletions(-)
create mode 100644 fs_selfservice/wordpress/process_logout.php
More information about the freeside-commits
mailing list