Skip to content

Commit

Permalink
Add function to convert an approval status to a post status
Browse files Browse the repository at this point in the history
  • Loading branch information
joedolson committed Aug 7, 2024
1 parent 59ef5e0 commit 4547008
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/my-calendar-import.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,31 @@ function mc_convert_post_status_to_approval( $status ) {
return $approval;
}

/**
* Convert an approval type to a post status.
*
* @param int $approval Approval value.
*
* @return string Post status.
*/
function mc_convert_approval_to_post_status( $approval ) {
switch ( $approval ) {
case 1:
$status = 'publish';
break;
case 0:
$status = 'draft';
break;
case 2:
$status = 'trash';
break;
default:
$status = 'draft';
}

return $status;
}

/**
* Import events from Kieran O'Shea's "Calendar". Largely obsolete.
*/
Expand Down

0 comments on commit 4547008

Please sign in to comment.