Hide visibility option from player performance edit screen if auto

This commit is contained in:
Brian Miyaji
2016-04-13 15:56:30 +10:00
parent c2e8f4c945
commit 3261a1bb51

View File

@@ -39,10 +39,6 @@ class SP_Meta_Box_Performance_Details extends SP_Meta_Box_Config {
if ( '' === $format ) { if ( '' === $format ) {
$format = 'number'; $format = 'number';
} }
$visible = get_post_meta( $post->ID, 'sp_visible', true );
if ( '' === $visible ) {
$visible = 1;
}
?> ?>
<p><strong><?php _e( 'Variable', 'sportspress' ); ?></strong></p> <p><strong><?php _e( 'Variable', 'sportspress' ); ?></strong></p>
<p> <p>
@@ -71,6 +67,13 @@ class SP_Meta_Box_Performance_Details extends SP_Meta_Box_Config {
?> ?>
</select> </select>
</p> </p>
<?php
if ( 'auto' === get_option( 'sportspress_player_columns', 'auto' ) ) {
$visible = get_post_meta( $post->ID, 'sp_visible', true );
if ( '' === $visible ) {
$visible = 1;
}
?>
<p> <p>
<strong><?php _e( 'Visible', 'sportspress' ); ?></strong> <strong><?php _e( 'Visible', 'sportspress' ); ?></strong>
<i class="dashicons dashicons-editor-help sp-desc-tip" title="<?php _e( 'Display in player profile?', 'sportspress' ); ?>"></i> <i class="dashicons dashicons-editor-help sp-desc-tip" title="<?php _e( 'Display in player profile?', 'sportspress' ); ?>"></i>
@@ -91,6 +94,7 @@ class SP_Meta_Box_Performance_Details extends SP_Meta_Box_Config {
</ul> </ul>
<?php <?php
} }
}
/** /**
* Save meta box data * Save meta box data
@@ -99,6 +103,8 @@ class SP_Meta_Box_Performance_Details extends SP_Meta_Box_Config {
self::delete_duplicate( $_POST ); self::delete_duplicate( $_POST );
update_post_meta( $post_id, 'sp_section', (int) sp_array_value( $_POST, 'sp_section', -1 ) ); update_post_meta( $post_id, 'sp_section', (int) sp_array_value( $_POST, 'sp_section', -1 ) );
update_post_meta( $post_id, 'sp_format', sp_array_value( $_POST, 'sp_format', 'number' ) ); update_post_meta( $post_id, 'sp_format', sp_array_value( $_POST, 'sp_format', 'number' ) );
if ( 'auto' === get_option( 'sportspress_player_columns', 'auto' ) ) {
update_post_meta( $post_id, 'sp_visible', sp_array_value( $_POST, 'sp_visible', 1 ) ); update_post_meta( $post_id, 'sp_visible', sp_array_value( $_POST, 'sp_visible', 1 ) );
} }
}
} }