Skip to content

Commit

Permalink
Merge pull request #365 from mailjet/DE-1135-wordpress-mailjet-plugin…
Browse files Browse the repository at this point in the history
…-cant-access-to-the-settings-page

Some fixes for user permissions
  • Loading branch information
oleksandr-mykhailenko authored Sep 24, 2023
2 parents 2b2645b + 2477555 commit dfb82be
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- Tags: email, marketing, signup, newsletter, widget, smtp, woocommerce, contact form 7
- Requires at least: 4.4
- Tested up to: 6.2.2
- Stable tag: 5.5.0
- Stable tag: 5.5.1
- Requires PHP: 5.6
- License: GPLv2 or later
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Contributors: Mailjet
Tags: email, marketing, signup, newsletter, widget, smtp, woocommerce, contact form 7
Requires at least: 4.4
Tested up to: 6.2.2
Stable tag: 5.5.0
Stable tag: 5.5.1
Requires PHP: 5.6
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down
2 changes: 1 addition & 1 deletion src/includes/Mailjet.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function __construct()
if (\defined('MAILJET_VERSION')) {
$this->version = MAILJET_VERSION;
} else {
$this->version = '5.4.6';
$this->version = '5.5.1';
}
$this->plugin_name = 'mailjet';
$this->load_dependencies();
Expand Down
5 changes: 0 additions & 5 deletions src/includes/SettingsPages/ConnectAccountSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,6 @@ public function mailjet_connect_account_cb($args)
*/
public function mailjet_connect_account_page_html()
{
// check user capabilities
if (!current_user_can('read')) {
MailjetLogger::error('[ Mailjet ] [ ' . __METHOD__ . ' ] [ Line #' . __LINE__ . ' ] [ Current user don\'t have \\`manage_options\\` permission ]');
return;
}
// register a new section in the "mailjet" page
add_settings_section('mailjet_section_connect_account_settings', null, array($this, 'mailjet_section_connect_account_cb'), 'mailjet_connect_account_page');
// register a new field in the "mailjet_section_developers" section, inside the "mailjet" page
Expand Down
5 changes: 0 additions & 5 deletions src/includes/SettingsPages/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ public function mailjet_dashboard_page_html()
if (!MailjetApi::isValidAPICredentials()) {
MailjetSettings::redirectJs(admin_url('/admin.php?page=mailjet_settings_page&from=plugins'));
}
// check user capabilities
if (!current_user_can('read')) {
MailjetLogger::error('[ Mailjet ] [ ' . __METHOD__ . ' ] [ Line #' . __LINE__ . ' ] [ Current user don\'t have \\`manage_options\\` permission ]');
return;
}
?>

<div class="mj-pluginPage">
Expand Down
5 changes: 0 additions & 5 deletions src/includes/SettingsPages/InitialSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,6 @@ public function mailjet_initial_settings_cb($args)
public function mailjet_initial_settings_page_html()
{
$fromPage = !empty($_REQUEST['from']) ? sanitize_text_field($_REQUEST['from']) : null;
// check user capabilities
if (!current_user_can('read')) {
MailjetLogger::error('[ Mailjet ] [ ' . __METHOD__ . ' ] [ Line #' . __LINE__ . ' ] [ Current user don\'t have \\`manage_options\\` permission ]');
return;
}
// register a new section in the "mailjet" page
add_settings_section('mailjet_section_initial_settings', null, [$this, 'mailjet_section_initial_settings_cb'], 'mailjet_initial_settings_page');
// register a new field in the "mailjet_section_developers" section, inside the "mailjet" page
Expand Down
5 changes: 0 additions & 5 deletions src/includes/SettingsPages/UserAccessSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,6 @@ public function user_access_post_handler()
*/
public function mailjet_user_access_page_html()
{
// check user capabilities
if (!current_user_can('read')) {
MailjetLogger::error('[ Mailjet ] [ ' . __METHOD__ . ' ] [ Line #' . __LINE__ . ' ] [ Current user don\'t have \\`manage_options\\` permission ]');
return;
}
// register a new section in the "mailjet" page
add_settings_section('mailjet_user_access_settings', null, array($this, 'mailjet_section_user_access_cb'), 'mailjet_user_access_page');
// register a new field in the "mailjet_section_developers" section, inside the "mailjet" page
Expand Down
2 changes: 1 addition & 1 deletion wp-mailjet.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
/**
* Mailjet plugin version.
*/
define('MAILJET_VERSION', '5.5.0');
define('MAILJET_VERSION', '5.5.1');

/**
* Mailjet Plugid dir.
Expand Down

0 comments on commit dfb82be

Please sign in to comment.