PluginProbe
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More / 2.4.1
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More v2.4.1
2.4.1 2.4.0 2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.2 2.2.1 2.2.0 2.1.2 2.1.1 trunk 0.0.1 0.0.2 0.0.3 0.0.4 0.0.5 0.0.6 0.0.7 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 All 68 releases
← All changes | includes/Admin/ReactAdmin.php +60 -31 2.1.2 → 2.4.1 View file →
@@ -4,8 +4,9 @@
4 4
5 5 use Better_Payment\Lite\Controller;
6 6 use Better_Payment\Lite\Admin\DB;
7 7 use Better_Payment\Lite\Traits\Helper as TraitsHelper;
8 +use Better_Payment\Lite\Campaign\Templates\TemplateManager;
8 9
9 10 /**
10 11 * Exit if accessed directly
11 12 */
@@ -96,13 +97,23 @@
96 97 'title' => __('Dashboard', 'better-payment'),
97 98 'capability' => 'manage_options',
98 99 'callback' => [$this, 'render_react_admin_page'],
99 100 ),
101 + $this->page_slug_prefix . '-admin&tab=campaigns' => array(
102 + 'title' => __('Campaigns', 'better-payment'),
103 + 'capability' => 'manage_options',
104 + 'callback' => [$this, 'render_react_admin_page'],
105 + ),
100 106 $this->page_slug_prefix . '-admin&tab=transactions' => array(
101 107 'title' => __('Transactions', 'better-payment'),
102 108 'capability' => 'manage_options',
103 109 'callback' => [$this, 'render_react_admin_page'],
104 110 ),
111 + $this->page_slug_prefix . '-admin&tab=subscriptions' => array(
112 + 'title' => __('Subscriptions', 'better-payment'),
113 + 'capability' => 'manage_options',
114 + 'callback' => [$this, 'render_react_admin_page'],
115 + ),
105 116 $this->page_slug_prefix . '-admin&tab=analytics' => array(
106 117 'title' => __('Analytics', 'better-payment'),
107 118 'capability' => 'manage_options',
108 119 'callback' => [$this, 'render_react_admin_page'],
@@ -222,37 +233,8 @@
222 233 .auto-fold .better-payment-admin {
223 234 margin-left: -2px;
224 235 }
225 236 }
226 -
227 - @media print {
228 - body {
229 - transform: scale(1);
230 - background: white !important;
231 - }
232 -
233 - body, body *, .wpcontent {
234 - visibility: hidden !important;
235 - }
236 -
237 - .bp-invoice-body,
238 - .bp-invoice-body * {
239 - visibility: visible !important;
240 - }
241 -
242 - /* Make modal fill the full page */
243 - .bp-invoice-body {
244 - position: absolute !important;
245 - left: 0;
246 - top: 100;
247 - width: 100% !important;
248 - height: auto !important;
249 - }
250 -
251 - .bp-button-wrapper {
252 - display: none !important;
253 - }
254 - }
255 237 </style>
256 238 <?php
257 239 }
258 240
@@ -281,13 +263,41 @@
281 263 'name' => wp_get_current_user()->display_name,
282 264 'email' => wp_get_current_user()->user_email
283 265 ],
284 266 'currencies' => $this->get_currency_list(),
267 + 'userRoles' => $this->get_user_roles_list(),
285 268 'currencySymbol' => $this->get_currency_symbol( $settings['better_payment_settings_general_general_currency'] ),
269 + // Picker-facing, so retired designs stay out of it. The renderer
270 + // still needs get_all(); see TemplateManager::get_for_picker().
271 + 'campaignTemplates' => array_values( TemplateManager::get_for_picker() ),
272 + 'adminBaseUrl' => admin_url(),
273 + // How `payment_date` (UTC) is shown: the site's timezone, an IANA name or a
274 + // fixed offset such as `+06:00` (never '' — the `timezone_string` option is
275 + // empty on a site set to a manual UTC offset).
276 + 'siteTimezone' => wp_timezone_string(),
286 277 ];
287 278 }
288 279
289 280 /**
281 + * Get the site's user roles as a role_key => display_name map.
282 + *
283 + * Used by the Settings page (E-commerce > Subscription) role selects.
284 + *
285 + * @since 2.3.2
286 + * @return array
287 + */
288 + private function get_user_roles_list()
289 + {
290 + $roles = [];
291 +
292 + foreach (wp_roles()->roles as $role_key => $role) {
293 + $roles[$role_key] = translate_user_role($role['name']);
294 + }
295 +
296 + return $roles;
297 + }
298 +
299 + /**
290 300 * Customize admin footer text and version display
291 301 *
292 302 * @since 1.5.0
293 303 */
@@ -292,10 +302,15 @@
292 302 * @since 1.5.0
293 303 */
294 304 public function customize_admin_footer($hook)
295 305 {
296 - // Only apply to Better Payment admin pages
297 - if (strpos($hook, $this->page_slug_prefix . '-admin') === false) {
306 + // Only apply to Better Payment admin pages — including the campaign
307 + // builder page, whose hook is suffixed with 'bp-campaign-builder'
308 + // rather than the '-admin' slug, so it shares the same branded footer.
309 + if (
310 + strpos($hook, $this->page_slug_prefix . '-admin') === false
311 + && strpos($hook, 'bp-campaign-builder') === false
312 + ) {
298 313 return;
299 314 }
300 315
301 316 add_filter('admin_footer_text', [$this, 'get_footer_text']);
@@ -386,8 +401,22 @@
386 401 $admin_css_file,
387 402 [],
388 403 $this->file_version
389 404 );
405 +
406 + // Styles for the screens only Pro renders (receipt modal, Analytics, refund card,
407 + // licence page) ship with Better Payment Pro, which depends on this handle.
408 +
409 + // Campaign-list CSS contains the template-select modal styles needed on this page too.
410 + $campaign_list_css = BETTER_PAYMENT_ASSETS . '/admin/campaign-list/campaign-list.min.css';
411 + if ( file_exists( BETTER_PAYMENT_PATH . '/assets/admin/campaign-list/campaign-list.min.css' ) ) {
412 + wp_enqueue_style(
413 + 'bp-campaign-list',
414 + $campaign_list_css,
415 + [],
416 + $this->file_version
417 + );
418 + }
390 419
391 420 wp_add_inline_script(
392 421 'better-payment-react-admin',
393 422 'wp.apiFetch.use(wp.apiFetch.createNonceMiddleware("' . wp_create_nonce('wp_rest') . '"));',