Skip to content

Commit

Permalink
Only display invoice to users we can read invoice.
Browse files Browse the repository at this point in the history
  • Loading branch information
remcotolsma committed Feb 19, 2024
1 parent 0c628f9 commit f2a680c
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions classes/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,16 @@ public function post_class( $classes ) {
* @return array
*/
public function project_sections( $sections ) {
$sections[] = [
'id' => 'invoices',
'slug' => __( 'invoices', 'orbis-projects' ),
'name' => __( 'Invoices', 'orbis-projects' ),
'callback' => function () {
include __DIR__ . '/../templates/project-invoices.php';
},
];
if ( \current_user_can( 'read_orbis_project_invoice', \get_the_ID() ) ) {
$sections[] = [
'id' => 'invoices',
'slug' => __( 'invoices', 'orbis-projects' ),
'name' => __( 'Invoices', 'orbis-projects' ),
'callback' => function () {
include __DIR__ . '/../templates/project-invoices.php';
},
];
}

return $sections;
}
Expand Down

0 comments on commit f2a680c

Please sign in to comment.