Пример #1
0
			</select>
			
			<p style="margin-top:5px; font-size:11px">
					Select Multiple Membership Levels: PC <code>ctrl + click</code> 
					Mac <code><img width="9" height="9" src="http://km.support.apple.com/library/APPLE/APPLECARE_ALLGEOS/HT1343/ks_command.gif" alt="Command key icon" data-hires="true">
(Command key) + click</code>
			</p>
			</td>
		</tr>
		<?php 
}
?>
	</table>
	
	<input id='id' type='hidden' value='<?php 
echo $employee->getId();
?>
' />
	<input id='mm-is-default' type='hidden' value='<?php 
echo $employee->isDefault();
?>
' />
</div>

<div class="mm-dialog-footer-container">
<div class="mm-dialog-button-container">
<a href="javascript:mmjs.save();" class="mm-ui-button blue">Save Employee</a>
<a href="javascript:mmjs.closeDialog();" class="mm-ui-button">Cancel</a>
</div>
</div>
Пример #2
0
 * (c) MemberMouse, LLC. All rights reserved.
 */
// Attempt to correct any invalid employees. Otherwise, delete invalid accounts
global $wpdb;
$sql = "SELECT ea.* FROM " . MM_TABLE_EMPLOYEE_ACCOUNTS . " ea LEFT JOIN {$wpdb->users} u ON (ea.user_id = u.ID) " . "where ((ea.user_id IS NULL) OR (u.ID IS NULL))";
$results = $wpdb->get_results($sql);
$invalid_account_ids = array();
if ($wpdb->num_rows > 0) {
    //either these accounts are not linked or the user_id is not valid (user with that ID does not exist in WP)
    foreach ($results as $nullAccount) {
        $currentAccount = new MM_Employee($nullAccount->id);
        if ($currentAccount->isValid()) {
            $currentAccount->commitData();
            //the commit logic will clean up any invalid links
            if ($currentAccount->getUserId() instanceof WP_Error || $currentAccount->getUserId() <= 0) {
                $invalid_account_ids[] = $currentAccount->getId();
            }
        }
    }
}
if (count($invalid_account_ids) > 0) {
    $successfully_deleted_accounts = array();
    // attempt to delete all invalid accounts
    for ($i = 0; $i < count($invalid_account_ids); $i++) {
        $account = new MM_Employee($invalid_account_ids[$i]);
        if ($account->isValid()) {
            $userEmail = $account->getEmail();
            $response = $account->delete();
            // if account was deleted successfully, store it in $successfully_deleted_accounts
            if ($response) {
                $successfully_deleted_accounts[] = $userEmail;