Skip to content
Merged
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
11 changes: 9 additions & 2 deletions includes/class-paybutton-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PayButton_Admin {
public function __construct() {
add_action( 'admin_menu', array( $this, 'add_admin_menus' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
add_action( 'admin_notices', array( $this, 'admin_notice_missing_wallet_address' ) );
add_action( 'admin_notices', array( $this, 'admin_notice_missing_required_inputs' ) );
// Process form submissions early
add_action( 'admin_init', array( $this, 'handle_save_settings' ) );

Expand Down Expand Up @@ -228,7 +228,7 @@ public function paywall_settings_page() {
$this->load_admin_template( 'paywall-settings', $args );
}

public function admin_notice_missing_wallet_address() {
public function admin_notice_missing_required_inputs() {
if (isset($_GET['settings-updated']) && $_GET['settings-updated'] === 'true') {
return;
}
Expand All @@ -242,6 +242,13 @@ public function admin_notice_missing_wallet_address() {
echo '<p><strong>NOTICE:</strong> Please set your wallet address in <a href="' . esc_url(admin_url('admin.php?page=paybutton-paywall')) . '">Paywall Settings</a>. If you don\'t have an address yet, create a wallet using <a href="https://cashtab.com" target="_blank">Cashtab</a>, <a href="https://www.bitcoinabc.org/electrum/" target="_blank">Electrum ABC</a> or <a href="https://electroncash.org/" target="_blank">Electron Cash</a>.</p>';
echo '</div>';
}

$public_key = get_option('paybutton_public_key', '');
if (empty($public_key)) {
echo '<div class="notice notice-error">';
echo '<p><strong>NOTICE:</strong> Please set your public key in <a href="' . esc_url(admin_url('admin.php?page=paybutton-paywall')) . '">Paywall Settings</a>.</p>';
echo '</div>';
}
}

/**
Expand Down
6 changes: 3 additions & 3 deletions templates/admin/paywall-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,10 @@
<!--NEW Public Key input field-->
<tr>
<th scope="row">
<label for="paybutton_public_key">PayButton Public Key (optional)</label>
<label for="paybutton_public_key">PayButton Public Key (required)</label>
</th>
<td>
<input type="text" name="paybutton_public_key" id="paybutton_public_key" class="regular-text" value="<?php echo esc_attr( $paybutton_public_key ); ?>">
<input type="text" name="paybutton_public_key" id="paybutton_public_key" class="regular-text" value="<?php echo esc_attr( $paybutton_public_key ); ?>" required>
<p class="description">
Enter your PayButton public key to verify Payment Trigger requests.
</p>
Expand Down Expand Up @@ -239,7 +239,7 @@
6. Save your button settings after pasting these values, and you're all set!
</p>
<p>
<strong>Note:</strong> Enabling this feature is strongly recommended as it improves payment reliability, leveraging secure server-to-server messaging to record paywall transactions to your database.
<strong>Note:</strong> Enabling this feature is required as it improves payment reliability, leveraging secure server-to-server messaging to record paywall and login transactions to your database.
</p>
</div>
</td>
Expand Down