Skip to content

Commit

Permalink
Merge pull request #61 from osDXP/1.1.1
Browse files Browse the repository at this point in the history
- Apply proper colspan to module update messages (8336f3d)
- Refactor dashboard templates logic (41c7c8e)
- Refactor redirect path for user logins that are using osDXP (41c7c8e)
- Account for osDXP dashboard status when deciding redirect path when checking for updates (cdab982)
- Update default available modules json file (50c2504)
- Reimplement available modules in regular admin on a multisite (50c2504)
- Fix checking for new modules on a single site in a multisite instance (3cc3bd7)
- Fix proper path when switching to regular WordPress interface (8336f3d)
  • Loading branch information
al-esc authored Jan 6, 2020
2 parents d93b0a2 + 1d11a55 commit 43728a7
Show file tree
Hide file tree
Showing 17 changed files with 39 additions and 180 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

A historical record of notable changes to `osdxp-dashboard` will be documented in this file.

## [v1.1.1 (2019-12-27)](https://github.com/osDXP/osdxp-dashboard/releases/tag/v1.1.1)
- Apply proper colspan to module update messages
- Refactor dashboard templates logic
- Refactor redirect path for user logins that are using osDXP
- Account for osDXP dashboard status when deciding redirect path when checking for updates
- Update default available modules json file
- Reimplement available modules in regular admin on a multisite
- Fix checking for new modules on a single site in a multisite instance
- Fix proper path when switching to regular WordPress interface

## [v1.1.0 (2019-12-05)](https://github.com/osDXP/osdxp-dashboard/releases/tag/v1.1.0)
- Update repository meta files
- Make plugin agnostic of integrations
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ osDXP Dashboard is dependent on:
[![Latest Release](https://img.shields.io/github/v/release/osDXP/osdxp-dashboard)](https://github.com/osDXP/osdxp-dashboard/releases)
[![CSS gzip size](https://img.badgesize.io/osDXP/osdxp-dashboard/master/build/style-admin.min.css?compression=gzip&label=CSS+gzip+size)](https://github.com/osDXP/osdxp-dashboard/tree/master/build/style-admin.min.css)
[![JS gzip size](https://img.badgesize.io/osDXP/osdxp-dashboard/master/build/app.min.js?compression=gzip&label=JS+gzip+size)](https://github.com/osDXP/osdxp-dashboard/tree/master/build/app.min.js)
[![License](https://img.shields.io/github/license/osDXP/osdxp-dashboard)](https://github.com/osDXP/osdxp-dashboard/blob/master/LICENSE)

## Bugs and feature requests

Expand Down
2 changes: 2 additions & 0 deletions assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,7 @@
$(".dxp-dashboard #wp-admin-bar-root-default li").each( function() {
$(this).addClass('current');
});

$('.plugin-update-tr td').attr('colspan', 4);
});
})(jQuery);
1 change: 1 addition & 0 deletions build/app.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/app.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion default-available-modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"author": "Crowd Favorite",
"price": null,
"before-price-text": null,
"after-price-text": "Will be Available Nov 7"
"after-price-text": "Coming Soon"
},
"osdxp-shared-counts/osdxp-shared-counts.php" : {
"name": "Shared Counts (osDXP Adaptation)",
Expand Down
2 changes: 1 addition & 1 deletion includes/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function get_dxp_menu_pages()
'capability' => 'manage_options',
'menu_slug' => 'dxp-modules',
'function' => __NAMESPACE__ . '\\dxp_render_available_modules',
'network' => 'true',
'network' => 'both',
],
[
'type' => OSDXP_DASHBOARD_MENU_TYPE_ENDPOINT,
Expand Down
10 changes: 8 additions & 2 deletions includes/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,14 @@ function get_dxp_version_details()
*/
function set_dxp_meta_on_login($redirect_to, $request, $user)
{
if (isset($user->allcaps) && (!array_key_exists('dxp-dashboard', get_metadata('user', $user->ID)) || get_user_meta($user->ID, 'dxp-dashboard', true) === '1')) { // phpcs:ignore
$redirect_to = '/wp-admin/?dxp=on';
if (
($user instanceof \WP_User && user_can($user, 'edit_posts'))
&& (
! array_key_exists('dxp-dashboard', get_metadata('user', $user->ID))
|| get_user_meta($user->ID, 'dxp-dashboard', true) === '1'
)
) {
$redirect_to = esc_url(self_admin_url('?dxp=on'));
}
return $redirect_to;
}
Expand Down
4 changes: 1 addition & 3 deletions includes/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ function dxp_dashboard_actions()
{
if (is_network_admin() && is_super_admin()) {
require_once(OSDXP_DASHBOARD_DIR . '/templates/dashboard-actions-network-admin.php');
} elseif (is_multisite() && is_super_admin()) {
require_once(OSDXP_DASHBOARD_DIR . '/templates/dashboard-actions-multisite-admin.php');
} elseif (!is_multisite() && current_user_can('administrator')) {
} elseif (current_user_can('administrator')) {
require_once(OSDXP_DASHBOARD_DIR . '/templates/dashboard-actions-single-admin.php');
} elseif (!current_user_can('administrator') && current_user_can('editor')) {
require_once(OSDXP_DASHBOARD_DIR . '/templates/dashboard-actions-editor.php');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,13 @@ public function handleManualCheck()
set_site_transient($this->manualCheckErrorTransient, $this->lastRequestApiErrors, 60);
}
}

$url = is_dxp_dashboard() ? 'admin.php?page=dxp-modules-installed&' : 'plugins.php?';
wp_redirect(add_query_arg(
array(
'puc_update_check_result' => $status,
'puc_slug' => $this->updateChecker->slug,
),
self_admin_url('admin.php?page=dxp-modules-installed&')
self_admin_url($url)
));
exit;
}
Expand Down
6 changes: 3 additions & 3 deletions includes/menus.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function add_switch_to_dxp_button_to_admin_bar_menu($wp_admin_bar)
'<div>%s</div>',
__('<div>Return to<br> WordPress</div>', 'osdxp-dashboard')
),
'href' => '/wp-admin/?dxp=off', // return to wp-admin dashboard
'href' => esc_url(self_admin_url('?dxp=off')), // return to wp-admin dashboard
]
);
}
Expand All @@ -103,7 +103,7 @@ function add_switch_to_dxp_button_to_admin_bar_menu($wp_admin_bar)
'title' => '<div></div><span class="screen-reader-text">'
. esc_html__('Switch to osDXP', 'osdxp-dashboard')
. '</span>',
'href' => admin_url('?dxp=on'), //set the user meta&init plugin based on dxp param
'href' => esc_url(self_admin_url('?dxp=on')), //set the user meta&init plugin based on dxp param

]
);
Expand All @@ -114,7 +114,7 @@ function add_switch_to_dxp_button_to_admin_bar_menu($wp_admin_bar)
'title' => '<span class="screen-reader-text">'
. esc_html__('Switch to osDXP', 'osdxp-dashboard')
. '</span>',
'href' => admin_url('?dxp=on'), //set the user meta&init plugin based on dxp param
'href' => esc_url(self_admin_url('?dxp=on')), //set the user meta&init plugin based on dxp param
]
);
}
Expand Down
2 changes: 1 addition & 1 deletion includes/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ function osdxp_activation_redirect()
//ignore multisite since it will always be dxp on network dashboard
if (get_option('osdxp_activation_redirect', false) && !is_network_admin()) {
delete_option('osdxp_activation_redirect');
wp_safe_redirect("/wp-admin/?dxp=on");
wp_safe_redirect(esc_url(self_admin_url('?dxp=on')));
exit;
}
}
Expand Down
4 changes: 2 additions & 2 deletions osdxp-dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Author URI: https://osdxp.org
* Requires at least: 5.2
* Requires PHP: 7.2
* Version: 1.1.0
* Version: 1.1.1
* License: GPL2
* License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* Text domain: osdxp-dashboard
Expand Down Expand Up @@ -42,7 +42,7 @@
define('OSDXP_DASHBOARD_URL', plugins_url('/', OSDXP_DASHBOARD_FILE));

// Always mention the plugin version (enclose in quotes so it is processed as a string).
define('OSDXP_DASHBOARD_VER', '1.1.0');
define('OSDXP_DASHBOARD_VER', '1.1.1');
define('OSDXP_DASHBOARD_SITE', 'https://osdxp.org/');

define('OSDXP_DASHBOARD_PLUGIN_NAME', 'Open Source DXP Dashboard');
Expand Down
157 changes: 0 additions & 157 deletions templates/dashboard-actions-multisite-admin.php

This file was deleted.

4 changes: 2 additions & 2 deletions templates/dashboard-actions-network-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<?php endif; ?>

<?php if (current_user_can('install_plugins')) : ?>
<a href="<?php echo network_admin_url('plugin-install.php'); // phpcs:ignore?>" class="col">
<a href="<?php echo network_admin_url('?page=dxp-modules-installed'); // phpcs:ignore?>" class="col">
<div class="postbox">
<div>
<div class="group">
Expand Down Expand Up @@ -115,7 +115,7 @@
<?php endif; ?>

<?php if (current_user_can('install_plugins')) : ?>
<a href="<?php echo network_admin_url('plugins.php'); // phpcs:ignore?>" class="col">
<a href="<?php echo network_admin_url('?page=dxp-modules-installed'); // phpcs:ignore?>" class="col">
<div class="postbox">
<div>
<div class="group">
Expand Down
6 changes: 3 additions & 3 deletions templates/dashboard-actions-single-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</a>
<?php endif; ?>

<?php if (current_user_can('install_plugins')) : ?>
<?php if (current_user_can('activate_plugins')) : ?>
<a href="<?php echo admin_url('admin.php?page=dxp-modules-installed'); // phpcs:ignore?>" class="col">
<div class="postbox">
<div>
Expand Down Expand Up @@ -114,8 +114,8 @@
</a>
<?php endif; ?>

<?php if (current_user_can('install_plugins')) : ?>
<a href="<?php echo admin_url('post-new.php?post_type=page'); // phpcs:ignore?>" class="col">
<?php if (current_user_can('install_plugins') && !is_multisite()) : ?>
<a href="<?php echo self_admin_url('?page=dxp-modules-installed'); // phpcs:ignore?>" class="col">
<div class="postbox">
<div>
<div class="group">
Expand Down
2 changes: 1 addition & 1 deletion templates/modules-list-available.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<h1 class="available-modules-header">
<?php esc_html_e('Available Modules', 'osdxp-dashboard');?>
<a href="<?php echo network_admin_url('admin.php?page=dxp-modules&refresh=1'); // phpcs:ignore?>" class="button-secondary check-available-modules">
<a href="<?php echo admin_url('admin.php?page=dxp-modules&refresh=1'); // phpcs:ignore?>" class="button-secondary check-available-modules">
<?php esc_html_e('Check for new modules', 'osdxp-dashboard');?>
</a>
</h1>
Expand Down

0 comments on commit 43728a7

Please sign in to comment.