Remove Status Column

This topic contains 2 reply and 2 voices, and was last updated by Jamie 10 years, 3 months ago
Viewing 2 Posts - 1 through 2 (of 2 total)
Author Posts
January 16, 2014 at 3:53 am 14455
Jamie I found the following tutorial to add columns to the user dashboard in your docs. http://docs.wedevs.com/adding-columns-to-dashboard-table/ I am using this for woo commerce products and I think instead of status, stock quantity would be more relevant. Can I remove the status column and replace it with the qty column ? Thanks.
January 16, 2014 at 1:52 pm 14483
Tareq Hasan Tareq Hasan

For that, you’ve to edit the plugin. No other way to remove the status column. Look at /class/frontend-dashboard.php and remove the column.

January 17, 2014 at 8:34 am 14515
Jamie Jamie

Thanks Tareq

I don’t like to make modifications to plugins as it breaks upgrades. I have modified the plugin and added 2 filters instead. It would be great if you could include these so my code doesn’t break on the next update.

Here is the code:

Replace line 109

<th><?php _e( 'Status', 'wpuf' ); ?></th>

With

 <?php $head_col = '<th>'.__('Status', 'wpuf').'</th>'; ?>
  <?php $head_col = apply_filters('wpuf_dashboard_status_head_col', $head_col ); ?>
  <?php echo $head_col; ?>

Then replace line 154 – 156

<td>
  <?php wpuf_show_post_status( $post->post_status ) ?>
</td>

With

<?php 
// method echos need to store in variable 
ob_start(); 
wpuf_show_post_status( $post->post_status );
$status_data = ob_get_clean();  
                            
$col = '<td>'.$status_data.'</td>';
$col = apply_filters('wpuf_dashboard_status_col', $col );
echo $col; 
?>

Then I put this in my functions.php

function remove_status_head($html) { 
    $html = ''; 
    return $html; 
}
add_filter( 'wpuf_dashboard_status_head_col', 'remove_status_head');

function remove_status_col($html) { 
    $html = ''; 
    return $html; 
}
add_filter( 'wpuf_dashboard_status_col', 'remove_status_col');
Viewing 2 Posts - 1 through 2 (of 2 total)