* @access public
*/
public $numberProcessed = 0;
+ /**
+ * updatedMembers
+ *
+ * @var float
+ * @access public
+ */
+ public $updatedMembers = 0;
+ /**
+ * addedMembers
+ *
+ * @var float
+ * @access public
+ */
+ public $addedMembers = 0;
/**
* totalMembers
}
// Here we need to check to see if we processed all members.
// Also the counter has to increment the total processed so far.
- if ( $this->numberProcessed == $this->totalMembers ) {
+ if ( $this->numberProcessed >= $this->totalMembers ) {
$this->processingComplete = true;
}
// Set the view file
'option' => $option,
'errors' => $this->errors,
'numberProcessed' => $this->numberProcessed,
+ 'updatedMembers' => $this->updatedMembers,
+ 'addedMembers' => $this->addedMembers,
'totalMembers' => $this->totalMembers,
'totalPhotos' => $this->totalPhotos,
'totalFiles' => $this->totalFiles,
return ( $errorCount == 0 );
break;
case 'member':
+ require_once GLM_MEMBERS_PLUGIN_PATH . '/classes/data/dataMemberInfo.php';
+ $memberInfoObj = new GlmDataMemberInfo( $this->wpdb, $this->config );
+
+ // Turn on wpdb errors
+ $this->wpdb->show_errors();
+ $this->wpdb->query( 'START TRANSACTION' );
+
// Setup the image processing
require_once GLM_MEMBERS_PLUGIN_PATH . '/models/admin/ajax/imageUpload.php';
$ImageUpload = new GlmMembersAdmin_ajax_imageUpload( $this->wpdb, $this->config );
$testEnd = $start + $this->memberProcessCountPerRound;
$ending = ( $testEnd <= $this->totalMembers ) ? $testEnd : $this->totalMembers;
- // Turn on wpdb errors
- $this->wpdb->show_errors();
-
// We have to add one to $ending (array starts at 1 not 0).
$ending++;
// Starting iterating over memberData
}
// get last id for member_info table to use for profile id
// Setup the categories for this profile record
+ if ( $memberNeedsUpdate ) {
+ $this->wpdb->delete(
+ GLM_MEMBERS_PLUGIN_DB_PREFIX . 'category_member_info',
+ array( 'member_info' => $profileId ),
+ array( '%d' )
+ );
+ }
if ( $data['categories'] ) {
$categories = explode( ',', $data['categories'] );
foreach ( $categories as $catData ) {
}
}
}
+ if ( $memberNeedsUpdate ) {
+ $this->wpdb->delete(
+ GLM_MEMBERS_PLUGIN_DB_PREFIX . 'amenity_ref',
+ array( 'ref_dest' => $profileId ),
+ array( '%d' )
+ );
+ }
// Setup the amenities for this profile record
if ( $data['amenities'] ) {
$amenities = explode( ',', $data['amenities'] );
}
// Add this record to the processed counter.
$this->numberProcessed++;
+ if ( $memberNeedsUpdate ) {
+ $this->updatedMembers++;
+ } else {
+ $this->addedMembers++;
+ }
// Ending iterating over memberData
}
+
+ // ROLLBACK
+ // $this->wpdb->query( 'ROLLBACK' );
+ // Commit
+ $this->wpdb->query( 'COMMIT' );
+
//$ret .= '<pre>$this->members: ' . print_r( $this->members, true ) . '</pre>';
$ret .= '<p>...</p>';
break;
<th>Processed Member</th>
<td>{$numberProcessed}</td>
</tr>
+ <tr>
+ <th>Updated Member</th>
+ <td>{$updatedMembers}</td>
+ </tr>
+ <tr>
+ <th>Added Member</th>
+ <td>{$addedMembers}</td>
+ </tr>
{if !$completed}
{$newStart = 1 + $numberProcessed}
<tr>
</table>
{if !$completed}
- {$newStart = 1 + $numberProcessed}
- <script>
- var test = '{$thisUrl}?page={$thisPage}&glm_action=index&option=processMembers&start={$newStart}&numberProcessed={$numberProcessed}';
- window.location.href = test;
- </script>
+ {$newStart = 1 + $numberProcessed}
+ <script>
+ var test = '{$thisUrl}?page={$thisPage}&glm_action=index&option=processMembers&start={$newStart}&numberProcessed={$numberProcessed}';
+ window.location.href = test;
+ </script>
{/if}
{include file='admin/footer.html'}