Skip to content

Commit 8be8376

Browse files
author
Maxime CULEA
committed
add filter to hide admin export/import part
1 parent af5e6cc commit 8be8376

File tree

1 file changed

+46
-42
lines changed

1 file changed

+46
-42
lines changed

views/admin/page-import-export.php

Lines changed: 46 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,51 @@
77
<div class="wrap">
88
<div id="icon-edit" class="icon32 icon32-posts-member"></div>
99
<h2><?php _e( 'Import / Export Members', 'mpt' ); ?></h2>
10-
<h3><?php _e( 'Import CSV file', 'mpt' ); ?></h3>
11-
12-
<form action="" method="post" id="import-diag" enctype="multipart/form-data">
13-
<p><?php _e( 'Import members from a CSV file. The format for the CSV file is "email; lastname; firstname; username". The password is automaticaly generated when the user is created.', 'mpt' ); ?></p>
14-
<label for='csv-file'><?php _e( 'Select a CSV file.', 'mpt' ); ?></label>
15-
<input type="file" name="csv-file" />
16-
<p class="submit">
17-
<input type="submit" name="import_members" class="button-primary export" value="<?php esc_attr_e( 'Import', 'mpt' ); ?>" />
18-
19-
<?php wp_nonce_field( 'import-members' ); ?>
20-
<input type="hidden" name="mpt_action" value="mpt_import_action" />
21-
</p>
22-
23-
<div class="report">
24-
<?php if( $report != false ) : ?>
25-
<p><strong><?php echo sprintf( __( 'Last import : %s', 'mpt'), date('d/m/Y H\hi', $report['report_date']) ); ?></strong></p>
26-
<?php if( !empty($report['ignore_line']) ) : ?>
27-
<p><?php _e( 'CSV formating error :', 'mpt' ); ?></p>
28-
<?php foreach( $report['ignore_line'] as $line => $result ) : ?>
29-
<p class="import-<?php echo $result['status']; ?>"><?php echo sprintf(__( 'Line %s : "%s" %s (%s)', 'mpt'), $result['line'], $result['content'], $result['operation'], $result['status']); ?></p>
30-
<?php endforeach; ?>
10+
11+
<?php if( ! apply_filters( 'mpt_admin_hide_import', false ) ) : ?>
12+
<h3><?php _e( 'Import CSV file', 'mpt' ); ?></h3>
13+
<form action="" method="post" id="import-diag" enctype="multipart/form-data">
14+
<p><?php _e( 'Import members from a CSV file. The format for the CSV file is "email; lastname; firstname; username". The password is automaticaly generated when the user is created.', 'mpt' ); ?></p>
15+
<label for='csv-file'><?php _e( 'Select a CSV file.', 'mpt' ); ?></label>
16+
<input type="file" name="csv-file" />
17+
<p class="submit">
18+
<input type="submit" name="import_members" class="button-primary export" value="<?php esc_attr_e( 'Import', 'mpt' ); ?>" />
19+
20+
<?php wp_nonce_field( 'import-members' ); ?>
21+
<input type="hidden" name="mpt_action" value="mpt_import_action" />
22+
</p>
23+
24+
<div class="report">
25+
<?php if( $report != false ) : ?>
26+
<p><strong><?php echo sprintf( __( 'Last import : %s', 'mpt'), date('d/m/Y H\hi', $report['report_date']) ); ?></strong></p>
27+
<?php if( !empty($report['ignore_line']) ) : ?>
28+
<p><?php _e( 'CSV formating error :', 'mpt' ); ?></p>
29+
<?php foreach( $report['ignore_line'] as $line => $result ) : ?>
30+
<p class="import-<?php echo $result['status']; ?>"><?php echo sprintf(__( 'Line %s : "%s" %s (%s)', 'mpt'), $result['line'], $result['content'], $result['operation'], $result['status']); ?></p>
31+
<?php endforeach; ?>
32+
<?php endif; ?>
33+
<?php if( !empty($report['import_status']) ) : ?>
34+
<p><?php _e( 'Importing status :', 'mpt' ); ?></p>
35+
<?php foreach( $report['import_status'] as $line => $result ) : ?>
36+
<p class="import-<?php echo $result['status']; ?>"><?php echo sprintf(__( '%s) %s (%s) : %s', 'mpt'), $line+1, $result['member'], $result['operation'], $result['status']); ?></p>
37+
<?php endforeach; ?>
38+
<?php endif; ?>
39+
<?php else : ?>
40+
<p><strong><?php _e( 'No report data available.', 'mpt' ); ?></strong></p>
3141
<?php endif; ?>
32-
<?php if( !empty($report['import_status']) ) : ?>
33-
<p><?php _e( 'Importing status :', 'mpt' ); ?></p>
34-
<?php foreach( $report['import_status'] as $line => $result ) : ?>
35-
<p class="import-<?php echo $result['status']; ?>"><?php echo sprintf(__( '%s) %s (%s) : %s', 'mpt'), $line+1, $result['member'], $result['operation'], $result['status']); ?></p>
36-
<?php endforeach; ?>
37-
<?php endif; ?>
38-
<?php else : ?>
39-
<p><strong><?php _e( 'No report data available.', 'mpt' ); ?></strong></p>
40-
<?php endif; ?>
41-
</div>
42-
</form>
43-
44-
<h3><?php _e( 'Export CSV file', 'mpt' ); ?></h3>
45-
<form action="" method="post" id="export-diag">
46-
<p class="submit">
47-
<input type="submit" name="export_members" class="button-primary export" value="<?php esc_attr_e( 'Export', 'mpt' ); ?>" />
48-
49-
<?php wp_nonce_field( 'export-members' ); ?>
50-
<input type="hidden" name="mpt_action" value="mpt_export_action" />
51-
</p>
52-
</form>
42+
</div>
43+
</form>
44+
<?php endif; ?>
45+
46+
<?php if( ! apply_filters( 'mpt_admin_hide_import', false ) ) : ?>
47+
<h3><?php _e( 'Export CSV file', 'mpt' ); ?></h3>
48+
<form action="" method="post" id="export-diag">
49+
<p class="submit">
50+
<input type="submit" name="export_members" class="button-primary export" value="<?php esc_attr_e( 'Export', 'mpt' ); ?>" />
51+
52+
<?php wp_nonce_field( 'export-members' ); ?>
53+
<input type="hidden" name="mpt_action" value="mpt_export_action" />
54+
</p>
55+
</form>
56+
<?php endif; ?>
5357
</div><!-- /.wrap -->

0 commit comments

Comments
 (0)