• Resolved stws

    (@stws)


    Hi Tobias! Please help me in next problem. I have the same task as in this post Post link.
    1 step. I copied this code into the function.php file:

    }
    add_shortcode( 'table-user-filtered', 'tablepress_filtered_table' );
    function tablepress_filtered_table( $atts ) {
      if ( ! is_user_logged_in() ) {
        return 'only for logged in';
      }
      $current_user = wp_get_current_user();
      $username = $current_user->user_login;
      $atts['filter'] = $username;
      $atts['cache_table_output'] = false;
      return tablepress_get_table( $atts );
    	$atts['filter_full_cell_match'] = true;
    }
    ?>

    2. step. After that i created the “test.xlsx” table with 6 columns (one of them contains username tags) and with 6 rows. 3 rows with “admin” username tag and another 3 rows with “test” username tag. After that i imported this table in tablepress and use the this shortcode [table-user-filtered id=1 /] to place this table on the page.
    Anddd … on the page i see the all data the rows with admin username tags and with test username tags. From admin account i see the “test username” data
    and from “test” account i see the “admin” username tags data.
    Tobias, pleas help me to find a mistake. May be in options, may bе in code or shortcode, i searched for several hours, but found nothing ?

    • This topic was modified 5 years, 9 months ago by stws.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘user login system tag’ is closed to new replies.