public function nicePrint($array){
echo '<pre>', print_r($array), '</pre>';
}
-
+
+ public function write_log ( $log ) {
+ if ( true === WP_DEBUG ) {
+ if ( is_array( $log ) || is_object( $log ) ) {
+ error_log( print_r( $log, true ) );
+ } else {
+ error_log( $log );
+ }
+ }
+ }
}
/*
* @version 0.1
*/
require_once GLM_MEMBERS_PLUGIN_PATH . '/controllers/admin.php';
+require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/glmPluginSupport.php';
/**
*
* This class exports the currently selected members list
{
global $wpdb;
+ $support = new glmPluginSupport();
foreach ($this->config['addOns'] as $a) {
if (is_file(GLM_MEMBERS_WORDPRESS_PLUGIN_PATH.$a['slug'].'/setup/adminMenus.php')) {
require_once GLM_MEMBERS_WORDPRESS_PLUGIN_PATH.$a['slug'].'/setup/adminMenus.php';
require_once GLM_MEMBERS_WORDPRESS_PLUGIN_PATH.$a['slug'].'/setup/adminTabs.php';
}
}
-
+
if( $_REQUEST['option'] == 'manage'){
$memberID = $_REQUEST['memberID'];
$data = $this->controller( 'member', 'index', array("memberID" => $memberID), true, true);
$data = $this->controller( 'member', 'memberInfo', false, true, true);
}
+ if($_REQUEST['option'] == 'submit'){
+ $support->write_log($_REQUEST);
+ $data = "test";
+ }
$return = array(
- "test" => [$memberID, $memberInfo],
'searchData' => $data, // Where our events list will go
);
<script>
jQuery(function($){
- var defaultData = {
- action : 'glm_members_admin_ajax',
- glm_action : 'memberManagement',
- }
- let listData = {
- action : defaultData.action,
- glm_action : defaultData.glm_action,
- }
- var editData = {
- action : defaultData.action,
- glm_action : defaultData.glm_action,
- }
-
window.Glma = (function() {
var xhr = function(data, complete, success, error, type){
$.ajax({
}
})();
+ window.Glma['defaultData'] = {
+ action : 'glm_members_admin_ajax',
+ glm_action : 'memberManagement',
+ }
+ let listData = {
+ action : Glma.defaultData.action,
+ glm_action : Glma.defaultData.glm_action,
+ }
+ var editData = {
+ action : Glma.defaultData.action,
+ glm_action : Glma.defaultData.glm_action,
+ }
+
/*
* Init Materialize collapsible
*/
{/if}
- <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <form id="member-info-form" action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
<input type="hidden" name="glm_action" value="memberInfo">
<input type="hidden" name="member" value="{$member.id}">
{if $memberInfoID && $memberInfo}
<script >
jQuery(function($) {
+ var memberInfoData = {
+ action : window.Glma.defaultData.action,
+ glm_action : window.Glma.defaultData.glm_action,
+ }
$('select').formSelect();
/*
* Edit area tabs
$('.updateMemberProfile').addClass('glm-bad-input-area');
glmSubmitRequired = true;
}
+
+
// When submit button is clicked, disable the beforeunload message
$('.updateMemberProfile').on('click', function(e) {
e.preventDefault();
- window.Glma()
- glmSubmitRequired = false;
- return true;
+ var form = $("#member-info-form");
+ memberInfoData.option = "submit";
+ memberInfoData.form = form.serialize();
+ console.log(memberInfoData);
+ window.Glma.memberEdit(
+ memberInfoData,
+ function(complete) {},
+ function(success) {
+ console.log(success);
+ },
+ function(error) {
+ console.log(error);
+ },
+ "POST"
+ );
+ // glmSubmitRequired = false;
+ // return true;
});
+
+
// If submit is required and we're laving the page, alert the user
$(window).bind('beforeunload', function() {
if (glmSubmitRequired) {