Home Forums Plugin Support WP User Frontend Pro Remove Status Column

This topic is: resolved

This topic contains 2 replies, has 2 voices, and was last updated by  Jamie 5 years, 5 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #14455

    Jamie
    Member
    Post count: 32

    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.

    #14483

    Tareq Hasan
    Keymaster
    Post count: 2831

    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.

    #14515

    Jamie
    Member
    Post count: 32

    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 3 posts - 1 through 3 (of 3 total)

The topic ‘Remove Status Column’ is closed to new replies.