Adds a plugin hook to the profile page
parent
9d93106d00
commit
25037008de
|
|
@ -14,20 +14,21 @@
|
||||||
|
|
||||||
$action = $_REQUEST['action'] ?? '';
|
$action = $_REQUEST['action'] ?? '';
|
||||||
$item = $_REQUEST['item'] ?? '';
|
$item = $_REQUEST['item'] ?? '';
|
||||||
$subscription = null;
|
// pass the user details to the profile hooks
|
||||||
|
$profileHooksContext = [
|
||||||
|
'userId' => $userId ?? null,
|
||||||
|
'db' => $db ?? null,
|
||||||
|
'app_root' => $app_root ?? '/',
|
||||||
|
'user' => $userDetails[0] ?? null,
|
||||||
|
];
|
||||||
|
|
||||||
if (defined('PLUGIN_BILLING_PATH') && file_exists(PLUGIN_BILLING_PATH . 'models/billing.php')) {
|
if (class_exists('\\App\\Core\\HookDispatcher')) {
|
||||||
require_once PLUGIN_BILLING_PATH . 'models/billing.php';
|
$profileHooksContext = \App\Core\HookDispatcher::applyFilters('profile.context', $profileHooksContext);
|
||||||
if (class_exists('Billing')) {
|
|
||||||
try {
|
|
||||||
$billingModel = new Billing($db);
|
|
||||||
$subscription = $billingModel->getUserSubscription($userId);
|
|
||||||
} catch (Throwable $e) {
|
|
||||||
error_log('Failed to load billing subscription: ' . $e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// plugins can add additional panels to the profile page
|
||||||
|
$profilePanelsContext = $profileHooksContext;
|
||||||
|
|
||||||
// if a form is submitted, it's from the edit page
|
// if a form is submitted, it's from the edit page
|
||||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
// Validate CSRF token
|
// Validate CSRF token
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue