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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,6 @@ assets/css/frontend-forms.css
assets/css/registration-forms.css
assets/css/wpuf-form-builder.css
languages/wp-user-frontend.pot

# OpenSpec change proposals (local spec artifacts)
openspec/
11 changes: 11 additions & 0 deletions assets/js/components/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,24 @@ const headerTitle = computed(() => {
const headerVersion = computed(() => {
return wpuf.isProActive && wpuf.pro_version ? wpuf.pro_version : wpuf.version;
});

const headerPlan = computed(() => {
if ( ! wpuf.isProActive || ! wpuf.plan ) {
return '';
}
return wpuf.plan
.split('-')
.map( ( word ) => word.charAt(0).toUpperCase() + word.slice(1) )
.join(' ');
});
</script>

<template>
<div class="wpuf-w-[calc(100%+40px)] wpuf-ml-[-20px] wpuf-px-[20px] wpuf-flex wpuf-mt-4 wpuf-justify-between wpuf-items-center wpuf-border-b-2 wpuf-border-gray-100 wpuf-pb-4">
<div class="wpuf-flex wpuf-justify-start wpuf-items-center">
<img :src="logoUrl" alt="WPUF Icon" class="wpuf-w-12 wpuf-mr-4" />
<h2 class="wpuf-text-2xl wpuf-leading-7 wpuf-font-bold">{{ headerTitle }}</h2>
<span v-if="headerPlan" class="wpuf-ml-2 wpuf-inline-flex wpuf-items-center wpuf-rounded-full wpuf-bg-green-100 wpuf-px-2 wpuf-py-1 wpuf-text-xs wpuf-font-semibold wpuf-text-green-700 wpuf-ring-1 wpuf-ring-inset wpuf-ring-green-600/20">{{ headerPlan }}</span>
<span class="wpuf-ml-2 wpuf-inline-flex wpuf-items-center wpuf-rounded-full wpuf-bg-green-100 wpuf-px-2 wpuf-py-1 wpuf-text-xs wpuf-font-medium wpuf-text-green-700 wpuf-ring-1 wpuf-ring-inset wpuf-ring-green-600/20">v{{ headerVersion }}</span>
<a
v-if="!wpuf.isProActive"
Expand Down
2 changes: 1 addition & 1 deletion assets/js/wpuf-user-directory-free.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-element', 'wp-i18n'), 'version' => '9b5085120efa50eaff3c');
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-element', 'wp-i18n'), 'version' => 'b28457d1bf22a26d2cf1');
2 changes: 1 addition & 1 deletion assets/js/wpuf-user-directory-free.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions includes/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@
wp_enqueue_script( 'wpuf-sweetalert2' );
wp_enqueue_script( 'wpuf-admin' );

$page = isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : '';

Check failure on line 96 in includes/Admin.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

$_GET['page'] not unslashed before sanitization. Use wp_unslash() or similar

Check warning on line 96 in includes/Admin.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Processing form data without nonce verification.

Check warning on line 96 in includes/Admin.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Processing form data without nonce verification.
$selected_page = [ 'wpuf-post-forms', 'wpuf-profile-forms', 'wpuf_subscription', 'wpuf_transaction', 'wpuf_tools' ];

if ( in_array( $page, $selected_page ) ) {

Check failure on line 99 in includes/Admin.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Not using strict comparison for in_array; supply true for $strict argument.
wpuf_load_headway_badge();
}

Expand All @@ -114,6 +114,7 @@
'version' => WPUF_VERSION,
'pro_version' => defined( 'WPUF_PRO_VERSION' ) ? WPUF_PRO_VERSION : '',
'isProActive' => class_exists( 'WP_User_Frontend_Pro' ),
'plan' => function_exists( 'wpuf_pro_current_plan' ) ? wpuf_pro_current_plan() : '',
'protected_shortcodes' => wpuf_get_protected_shortcodes(),
'protected_shortcodes_message' => sprintf(
// translators: %1$s is the opening div tag, %2$s is the shortcode [wpuf-registration], %3$s is the opening strong tag, %4$s is the closing strong tag, %5$s is the closing div tag
Expand All @@ -131,7 +132,7 @@
);

// Add inline script for dynamic API key link
wp_add_inline_script( 'wpuf-admin', '

Check failure on line 135 in includes/Admin.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Opening parenthesis of a multi-line function call must be the last content on the line
jQuery(document).ready(function($) {
function updateAPIKeyLink() {
var provider = $("[name=\'wpuf_ai[ai_provider]\']").val() || "openai";
Expand All @@ -148,7 +149,7 @@
// Initial update when page loads
updateAPIKeyLink();
});
' );

Check failure on line 152 in includes/Admin.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Closing parenthesis of a multi-line function call must be on a line by itself
}

public function enqueue_cpt_page_scripts( $hook_suffix ) {
Expand Down Expand Up @@ -206,7 +207,7 @@
wp_enqueue_style( 'wpuf-ai-form-builder' );

// Get AI settings
$ai_settings = get_option('wpuf_ai', []);

Check failure on line 210 in includes/Admin.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Expected 1 spaces before closing parenthesis; 0 found

Check failure on line 210 in includes/Admin.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Expected 1 spaces after opening parenthesis; 0 found

// Determine if we should expose API key status based on user capabilities
$show_api_status = current_user_can( wpuf_admin_role() );
Expand All @@ -229,14 +230,14 @@
'formType' => $form_type, // Pass form type to frontend
'provider' => $ai_settings['ai_provider'] ?? 'openai',
'model' => $ai_settings['ai_model'] ?? 'gpt-3.5-turbo',
'hasApiKey' => $show_api_status ? !empty($ai_settings['ai_api_key']) : null,

Check failure on line 233 in includes/Admin.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Expected 1 spaces before closing parenthesis; 0 found

Check failure on line 233 in includes/Admin.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Expected 1 spaces after opening parenthesis; 0 found

Check failure on line 233 in includes/Admin.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Expected 1 space after "!"; 0 found
'isProActive' => class_exists( 'WP_User_Frontend_Pro' ),
'temperature' => floatval( $ai_settings['temperature'] ?? 0.7 ),
'maxTokens' => intval( $ai_settings['max_tokens'] ?? 2000 ),
'promptTemplates' => $ai_manager->get_all_prompt_templates(),
'promptAIInstructions' => $ai_manager->get_all_prompt_ai_instructions(),
'i18n' => [
'errorTitle' => __('Error', 'wp-user-frontend'),

Check failure on line 240 in includes/Admin.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Expected 1 spaces after opening parenthesis; 0 found
'errorMessage' => __('Something went wrong. Please try again.', 'wp-user-frontend'),
'invalidRequest' => __('Invalid Request', 'wp-user-frontend'),
'nonFormRequest' => __('I can only help with form creation. Try: "Create a contact form"', 'wp-user-frontend'),
Expand Down Expand Up @@ -287,8 +288,8 @@
$valid_pages = [ 'admin-ajax.php', 'admin-post.php', 'async-upload.php', 'media-upload.php' ];

if ( ! current_user_can( $access_level ) && ! in_array( $pagenow, $valid_pages ) ) {
// wp_die( __( 'Access Denied. Your site administrator has blocked your access to the WordPress back-office.', 'wpuf' ) );

Check warning on line 291 in includes/Admin.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

This comment is 54% valid code; is this commented out code?
wp_redirect( home_url() );

Check warning on line 292 in includes/Admin.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

wp_redirect() found. Using wp_safe_redirect(), along with the "allowed_redirect_hosts" filter if needed, can help avoid any chances of malicious redirects within code. It is also important to remember to call exit() after a redirect so that no other unwanted code is executed.
exit;
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/js/user-directory/components/common/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ const Header = ({ utm = 'wpuf-user-directory' }) => {
const supportUrl = wpuf.support_url || 'https://wedevs.com/account/tickets/';
const version = wpuf.version || '';
const isProActive = wpuf.isProActive || false;
const plan = (isProActive && wpuf.plan)
? wpuf.plan.split('-').map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(' ')
: '';

// Initialize Headway widget on mount
useEffect(() => {
Expand All @@ -35,6 +38,11 @@ const Header = ({ utm = 'wpuf-user-directory' }) => {
<div className="wpuf-flex wpuf-justify-start wpuf-items-center">
<img src={logoUrl} alt="WPUF Icon" className="wpuf-w-12 wpuf-mr-4" />
<h2 className="wpuf-text-2xl wpuf-leading-7 wpuf-font-bold wpuf-m-0">{__('WP User Frontend', 'wp-user-frontend')}</h2>
{plan && (
<span className="wpuf-ml-2 wpuf-inline-flex wpuf-items-center wpuf-rounded-full wpuf-bg-green-100 wpuf-px-2 wpuf-py-1 wpuf-text-xs wpuf-font-semibold wpuf-text-green-700 wpuf-ring-1 wpuf-ring-inset wpuf-ring-green-600/20">
{plan}
</span>
)}
{version && (
<span className="wpuf-ml-2 wpuf-inline-flex wpuf-items-center wpuf-rounded-full wpuf-bg-green-100 wpuf-px-2 wpuf-py-1 wpuf-text-xs wpuf-font-medium wpuf-text-green-700 wpuf-ring-1 wpuf-ring-inset wpuf-ring-green-600/20">
v{version}
Expand Down
Loading