<?php
/**
 * Lantern Span People Directory uninstall routine.
 *
 * Directory profiles, contact fields, settings, pages, and Media Library files
 * are intentionally preserved to reduce the risk of accidental data loss.
 *
 * @package LanternSpanPeopleDirectory
 */

if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
	exit;
}

$lspd_administrator_role = get_role( 'administrator' );

if ( $lspd_administrator_role ) {
	$lspd_capabilities = array(
		'edit_lspd_person',
		'read_lspd_person',
		'delete_lspd_person',
		'edit_lspd_people',
		'edit_others_lspd_people',
		'publish_lspd_people',
		'read_private_lspd_people',
		'delete_lspd_people',
		'delete_private_lspd_people',
		'delete_published_lspd_people',
		'delete_others_lspd_people',
		'edit_private_lspd_people',
		'edit_published_lspd_people',
		'create_lspd_people',
	);

	foreach ( $lspd_capabilities as $lspd_capability ) {
		$lspd_administrator_role->remove_cap( $lspd_capability );
	}
}

delete_option( 'lspd_version' );
delete_transient( 'lspd_activation_notice' );
