import.php
1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* import.php
*
* Copyright (c) "kento" Karim Rahimpur www.itthinx.com
*
* This code is provided subject to the license granted.
* Unauthorized use and distribution is prohibited.
* See COPYRIGHT.txt and LICENSE.txt
*
* This code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* This header and all notices must be kept intact.
*
* @author Karim Rahimpur
* @package affiliates-users
* @since affiliates-users 1.2.0
*/
?>
<?php
if ( !current_user_can( AFFILIATES_ADMINISTER_AFFILIATES ) ) {
wp_die( __( 'Access denied.', AFFILIATES_USERS_PLUGIN_DOMAIN ) );
}
if ( isset( $_POST['action'] ) && wp_verify_nonce( $_POST['affiliates-users-import'], 'admin' ) ) {
if ( $_POST['action'] == 'import' ) {
$affiliate_ids = Affiliates_Users::all();
$n = count( $affiliate_ids );
if ( $n > 0 ) {
echo '<p class="some">';
echo sprintf( _n( 'One new affiliate account has been created.', '%d new affiliate accounts have been created.', $n, AFFILIATES_USERS_PLUGIN_DOMAIN ), $n );
echo '</p>';
} else {
echo '<p class="none">';
echo __( 'No new affiliate accounts have been created.', AFFILIATES_USERS_PLUGIN_DOMAIN );
echo '</p>';
}
}
}
?>
<div class="import">
<form name="import" method="post" action="">
<div>
<?php
echo
'<p>' .
__( 'Press the import button to create affiliate accounts for all user accounts.', AFFILIATES_USERS_PLUGIN_DOMAIN ) .
'</p>';
?>
<?php wp_nonce_field( 'admin', 'affiliates-users-import', true, true ); ?>
<div class="buttons">
<input class="import button" type="submit" name="submit" value="<?php echo __( 'Import', AFFILIATES_USERS_PLUGIN_DOMAIN ); ?>" />
<input type="hidden" name="action" value="import" />
</div>
</div>
</form>
</div>