Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .svnignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ LICENSE.md
README.md
composer.json
tests
docs
TODO.md
*composer.lock" .
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ This plugin improves the login look for the website and defaults to the page log
* Just activating it already adds personality to the login
* Choose from pre-designed themes to instantly transform your login page
* Create your own custom theme with the Style Builder
* User-friendly feedback system for continuous improvement

## Features

Expand All @@ -44,9 +45,40 @@ This plugin improves the login look for the website and defaults to the page log
* Fine-tune borders, margins, and padding
* Live preview of changes

### User Feedback
* Unobtrusive review request system for administrators
* Helps improve the plugin through user suggestions
* Fully dismissible with permanent opt-out

## Frequently Asked Questions

[Link Wiki](https://github.com/AWP-Software/Login-AWP_WordPress_Plugin/wiki/Frequently-Asked-Questions)

## Changelog

### 3.1.0
* Added user feedback system for administrators to help improve the plugin
* Enhanced compatibility with older PHP versions
* Fixed various minor styling issues

### 3.0.0
* Added theme selection system with pre-designed layouts
* Visual Style Builder for advanced customization
* Custom fonts, colors, spacing, and border settings

### 2.1.0
* Added status notifications for image updates
* Added Spanish language translation

### 2.0.0
* Plugin moved to Appearance menu for easier access
* Added logo and background image customization

### 1.1.0
* Fixed: Automatically display custom site icon on login page if available

### 1.0.0
* Initial stable release

## About
[Vegas2 JS](https://vegas.jaysalvat.com/)
Binary file modified assets/banner-772x250.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/icon-128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon-256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
96 changes: 96 additions & 0 deletions trunk/assets/css/feedback-modal.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/**
* Feedback Modal Styles for Login AWP
*/
#login-awp-feedback-modal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 999999;
display: flex;
align-items: center;
justify-content: center;
}

.login-awp-feedback-modal-content {
background-color: #fff;
border-radius: 4px;
box-shadow: 0 2px 30px rgba(0, 0, 0, 0.3);
width: 550px;
max-width: 90%;
padding: 20px 30px;
position: relative;
max-height: 90vh;
overflow-y: auto;
}

.login-awp-feedback-modal-content h2 {
margin-top: 0;
color: #23282d;
border-bottom: 1px solid #eee;
padding-bottom: 15px;
}

.login-awp-feedback-options {
margin-bottom: 20px;
}

.login-awp-feedback-options label {
display: block;
margin-bottom: 10px;
padding: 10px;
background: #f9f9f9;
border-radius: 3px;
}

.login-awp-feedback-options label:hover {
background: #f5f5f5;
}

.login-awp-feedback-info {
margin-top: 8px;
width: 100%;
display: block;
}

.login-awp-feedback-info.hidden {
display: none;
}

.login-awp-anonymous-feedback {
margin-bottom: 15px;
padding: 10px;
background: #f9f9f9;
border-radius: 3px;
}

.login-awp-anonymous-feedback .description {
color: #666;
font-style: italic;
margin: 5px 0 0 24px;
}

.login-awp-feedback-actions {
text-align: right;
margin-top: 20px;
padding-top: 15px;
border-top: 1px solid #eee;
}

.login-awp-feedback-actions button {
margin-left: 10px;
}

textarea.login-awp-feedback-info {
min-height: 80px;
resize: vertical;
}

input[type="text"].login-awp-feedback-info,
textarea.login-awp-feedback-info {
padding: 8px;
margin-left: 24px;
width: calc(100% - 24px);
}
210 changes: 210 additions & 0 deletions trunk/assets/js/feedback-modal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
/**
* Feedback Modal JavaScript for Login AWP
*
* Handles the deactivation feedback modal functionality
*/
(function($) {
'use strict';

// Initialize once DOM is fully loaded
$(function() {
// Make sure we have the proper AJAX URL from the localized script
const ajaxUrl = loginAwpFeedback.ajax_url || window.ajaxurl || '/wp-admin/admin-ajax.php';

const pluginSlug = loginAwpFeedback.plugin_slug;
const baseSlug = pluginSlug.split('/')[0];

// Set up for deactivation link
setupDeactivationFeedback();

/**
* Set up feedback for deactivation
*/
function setupDeactivationFeedback() {
const pluginRow = $('tr[data-slug="' + baseSlug + '"]');
const deactivateLink = pluginRow.find('.deactivate a');

if (deactivateLink.length) {
const originalDeactivateLink = deactivateLink.attr('href');

// Replace the default deactivation action with our modal trigger
deactivateLink.on('click', function(e) {
e.preventDefault();
showModal(originalDeactivateLink, 'deactivate');
});
}
}

/**
* Show the feedback modal
* @param {string} actionUrl - The URL to redirect to after submission
* @param {string} actionType - 'deactivate'
*/
function showModal(actionUrl, actionType) {
$('#login-awp-feedback-modal').show();

// Update modal title and text
$('#login-awp-feedback-title').text(loginAwpFeedback.translations.heading || 'Quick Feedback');
$('#login-awp-feedback-intro').text(loginAwpFeedback.translations.intro || 'If you have a moment, please let us know why you are deactivating Login AWP:');
$('#login-awp-skip-feedback').text(loginAwpFeedback.translations.skip || 'Skip & Deactivate');
$('#login-awp-submit-feedback').text(loginAwpFeedback.translations.submit || 'Submit & Deactivate');

// Store the action URL for form submission
$('#login-awp-feedback-form').data('actionUrl', actionUrl);

setupModalEvents();
}

/**
* Set up event listeners for the modal
*/
function setupModalEvents() {
// Remove existing event handlers to prevent duplicates
$('#login-awp-feedback-form').off('submit');
$('#login-awp-skip-feedback').off('click');
$('#login-awp-cancel-feedback').off('click');
$('input[name="reason"]').off('change');

const form = $('#login-awp-feedback-form');
const actionUrl = form.data('actionUrl');

// Process form submission
form.on('submit', function(e) {
e.preventDefault();
submitFeedback();
});

// Skip feedback and proceed directly
$('#login-awp-skip-feedback').on('click', function() {
window.location.href = actionUrl;
});

// Close modal when clicking cancel
$('#login-awp-cancel-feedback').on('click', function() {
closeModal();
});

// Show/hide additional fields based on selected reason
$('input[name="reason"]').on('change', function() {
// Hide all detail fields first
$('.login-awp-feedback-info').addClass('hidden');

// Show the specific detail field if needed
const reason = $(this).val();
switch(reason) {
case 'found_better_plugin':
$('input[name="better_plugin"]').removeClass('hidden');
break;
case 'not_working':
$('textarea[name="not_working_details"]').removeClass('hidden');
break;
case 'other':
$('textarea[name="other_details"]').removeClass('hidden');
break;
}
});

// Close on clicking outside the modal
$(window).on('click', function(e) {
if ($(e.target).is('#login-awp-feedback-modal')) {
closeModal();
}
});

// Close on ESC key
$(document).on('keydown', function(e) {
if (e.keyCode === 27) { // ESC key
closeModal();
}
});
}

/**
* Submit the feedback form via AJAX
*/
function submitFeedback() {
const form = $('#login-awp-feedback-form');
const actionUrl = form.data('actionUrl');
let reason = form.find('input[name="reason"]:checked').val();
const includeEmail = form.find('input[name="include_email"]').is(':checked');

// If no reason selected but email is included, set default reason to "no context"
if (!reason && includeEmail) {
reason = 'no context';
} else if (!reason) {
// If no reason selected and no email, just proceed with action
window.location.href = actionUrl;
return;
}

// Collect additional details if provided
let details = '';
if (reason === 'found_better_plugin') {
details = form.find('input[name="better_plugin"]').val();
} else if (reason === 'not_working') {
details = form.find('textarea[name="not_working_details"]').val();
} else if (reason === 'other') {
details = form.find('textarea[name="other_details"]').val();
}

// Prepare the data to send
const data = {
action: 'login_awp_submit_feedback',
nonce: loginAwpFeedback.nonce,
reason: reason,
action_type: 'deactivate'
};

// Add additional data if provided
if (details) {
if (reason === 'found_better_plugin') {
data.better_plugin = details;
} else if (reason === 'not_working') {
data.not_working_details = details;
} else if (reason === 'other') {
data.other_details = details;
}
}

// Include email if checkbox is checked
if (includeEmail) {
data.include_email = '1';
}

// Show submitting state
const submitButton = $('#login-awp-submit-feedback');
const originalText = submitButton.text();
submitButton.text(loginAwpFeedback.translations.submitting || 'Submitting...');
submitButton.prop('disabled', true);

// Use a try-catch block to handle AJAX errors
try {
// Send the data to the correct AJAX URL
$.post(ajaxUrl, data)
.done(function(response) {
// After submitting feedback, proceed with action
window.location.href = actionUrl;
})
.fail(function(xhr, textStatus, errorThrown) {
// Log error details for debugging but still proceed with action
console.error('Feedback submission failed:', textStatus, errorThrown);
// Still proceed with the requested action even if feedback fails
window.location.href = actionUrl;
});
} catch(e) {
// If any error occurs, still proceed with the action
console.error('Error during feedback submission:', e);
window.location.href = actionUrl;
}
}

/**
* Close and reset the feedback modal
*/
function closeModal() {
$('#login-awp-feedback-modal').hide();
$('#login-awp-feedback-form')[0].reset();
$('.login-awp-feedback-info').addClass('hidden');
}
});
})(jQuery);
15 changes: 12 additions & 3 deletions trunk/login_awp.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Plugin Name: Login AWP
* Plugin URI: https://wordpress.org/plugins/login-awp
* Description: This plugin modifies the login area for WordPress admin
* Version: 3.0.0
* Version: 3.2.1
* Requires at least: 5.4
* Requires PHP: 7.4
* Author: AWP-Software
Expand All @@ -18,12 +18,21 @@
* https://www.gnu.org/licenses/gpl-3.0.html
*/


if (!defined(constant_name: 'ABSPATH')) {
if (!defined('ABSPATH')) {
die('You are not allowed to call this page directly.');
}

// Define plugin constants (previously in settings.php)
if (!defined('AWP_LOGIN_FEEDBACK_EMAIL')) {
define('AWP_LOGIN_FEEDBACK_EMAIL', 'support@awp-software.com');
}

if (!defined('AWP_LOGIN_FEEDBACK_WEBHOOK')) {
define('AWP_LOGIN_FEEDBACK_WEBHOOK', 'https://telemetry.awp-software.com/feedback');
}

require_once __DIR__ . '/vendor/autoload.php';
// settings.php is now integrated directly in this file

use Login\Awp\Register;

Expand Down
Loading