PHP . SU
Программирование на PHP, MySQL и другие веб-технологии
Страниц (1): [1]
Найдено сообщений: 6
keeon
Отправлено: 20 Августа, 2019 - 22:20:31 • Тема: Переадресация на другую станицу с контактной формы • Форум: Напишите за меня, пожалуйста
Ответов: 12 Просмотров: 217
Пробовал запускать с других браузеров - к сожалению, переадресация не работает.
По поводу минмфицированной версии не совсем понял: мне нужно в файлах темы найти этот код и заменить на что-то? Если да, то на что заменить?
LIME, извини за глупые вопросы, дело в том, что я у меня нет ИТ образования, я экономист)
Уже понял, что этот файл us.core.min.js (нашел его) нужно заменить на полную (не сжатую версию), но не совсем понимаю как эта не сжатая версия файла называется и как ее найти?
keeon
Отправлено: 20 Августа, 2019 - 08:14:33 • Тема: Переадресация на другую станицу с контактной формы • Форум: Напишите за меня, пожалуйста
Ответов: 12 Просмотров: 217
Нашел файл с кодом, заменил как указал LIME, но к сожалению переадресация не работает. Вот новый код файла (замена в строках 40-42):
PHP:
скопировать код в буфер обмена
jQuery( function ( $) {
$
( '.w-form.for_cform' ) . each ( function ( ) { var $container = $( this) ,
$form = $container . find( 'form:first' ) ,
$submitBtn = $form . find( '.w-btn' ) ,
$resultField = $form . find( '.w-form-message' ) ,
options = $container . find( '.w-form-json' ) [ 0] . onclick( ) ;
$form . submit( function ( event) {
event. preventDefault( ) ;
// Prevent double-sending
if ( $submitBtn . hasClass( 'loading' ) ) return ;
$resultField . usMod( 'type' , false ) . html( '' ) ;
// Validation
var errors = 0 ;
$form . find
( '[data-required="true"]' ) . each ( function ( ) { var $input = $( this) ,
isEmpty = $input . is( '[type="checkbox"]' ) ? ( ! $input . is( ':checked' ) ) : ( $input . val( ) == '' ) ,
$row = $input . closest( '.w-form-row' ) ,
errorText = options. errors[ $input . attr( 'name' ) ] || '' ;
$row . toggleClass( 'check_wrong' , isEmpty) ;
$row . find( '.w-form-row-state' ) . html( isEmpty ? errorText : '' ) ;
if ( isEmpty) {
errors++;
}
} ) ;
if ( errors != 0) return ;
$submitBtn . addClass( 'loading' ) ;
$. ajax( {
type: 'POST' ,
url: options. ajaxurl,
dataType: 'json' ,
success: function ( result) {
if ( result. success) {
document. location. href = 'https://fin-club.com.ua/konsulting/' ;
} else {
$form . find( '.w-form-row.check_wrong' ) . removeClass( 'check_wrong' ) ;
$form . find( '.w-form-state' ) . html( '' ) ;
if ( result. data && typeof result. data == 'object' ) {
for ( var fieldName in result. data) {
if ( fieldName == 'empty_message' ) {
var errorText = result. data[ fieldName] ;
$resultField . usMod( 'type' , 'error' ) . html( errorText) ;
continue ;
}
if ( ! result. data. hasOwnProperty( fieldName) ) continue ;
var $input = $form . find( '[name="' + fieldName + '"]' ) ,
errorText = result. data[ fieldName] ;
$input . closest( '.w-form-row' ) . addClass( 'check_wrong' )
. find( '.w-form-row-state' ) . html( errorText) ;
}
} else {
$resultField . usMod( 'type' , 'error' ) . html( result. data) ;
}
}
} ,
complete: function ( ) {
$submitBtn . removeClass( 'loading' ) ;
}
} ) ;
} ) ;
} ) ;
} ) ;
/**
* CherryTheme Login Widget: widget_us_login
*
*/
! function ( $) {
"use strict" ;
$us . WLogin = function ( container, options) {
this. init( container, options) ;
} ;
$us . WLogin. prototype = {
init: function ( container, options) {
this. $container = $( container) ;
this. $form = this. $container . find( '.w-form' ) ;
this. $profile = this. $container . find( '.w-profile' ) ;
this. $preloader = this. $container . find( 'div.g-preloader' ) ;
this. $submitBtn = this. $form . find( '.w-btn' ) ;
this. $username = this. $form . find( '.for_log input[name="log"]' ) ;
this. $password = this. $form . find( '.for_pwd input[name="pwd"]' ) ;
this. $nonceVal = this. $form . find( '#us_login_nonce' ) . val( ) ;
this. $resultField = this. $form . find( '.w-form-message' ) ;
this. $jsonContainer = this. $container . find( '.w-profile-json' ) ;
this. jsonData = this. $jsonContainer [ 0] . onclick( ) || { } ;
this. $jsonContainer . remove( ) ;
this. ajaxUrl = this. jsonData. ajax_url || '' ;
this. logoutRedirect = this. jsonData. logout_redirect || '/' ;
this. loginRedirect = this. jsonData. login_redirect || '' ;
this. _events = {
formSubmit: this. formSubmit. bind( this)
} ;
this. $form . on( 'submit' , this. _events. formSubmit) ;
$. ajax( {
type: 'post' ,
url: this. ajaxUrl,
data: {
action: 'us_ajax_user_info' ,
logout_redirect: this. logoutRedirect
} ,
success: function ( result) {
if ( result. success) {
var $avatar = this. $profile . find( '.w-profile-avatar' ) ,
$name = this. $profile . find( '.w-profile-name' ) ,
$logoutLink = this. $profile . find( '.w-profile-link.for_logout' ) ;
$avatar . html( result. data. avatar) ;
$name . html( result. data. name) ;
$logoutLink . attr( 'href' , result. data. logout_url) ;
this. $profile . removeClass( 'hidden' ) ;
} else {
this. $form . removeClass( 'hidden' ) ;
}
this. $preloader . addClass( 'hidden' ) ;
} . bind( this)
} ) ;
} ,
formSubmit: function ( event) {
event. preventDefault( ) ;
// Prevent double-sending
if ( this. $submitBtn . hasClass( 'loading' ) ) return ;
// Clear errors
this. $resultField . usMod( 'type' , false ) . html( '' ) ;
this. $form . find( '.w-form-row.check_wrong' ) . removeClass( 'check_wrong' ) ;
this. $form . find( '.w-form-state' ) . html( '' ) ;
// Prevent sending data with empty username
if ( this. $form . find( 'input[name="log"]' ) . val( ) == '' ) {
this. $username . closest( '.w-form-row' ) . toggleClass( 'check_wrong' ) ;
this. $username . closest( '.w-form-row' ) . find( '.w-form-row-state' ) . html( this. jsonData. error_message) ;
return ;
}
this. $submitBtn . addClass( 'loading' ) ;
$. ajax( {
type: 'post' ,
url: this. ajaxUrl,
dataType: 'json' ,
data: {
action: 'us_ajax_login' ,
username: this. $username . val( ) ,
password: this. $password . val( ) ,
us_login_nonce: this. $nonceVal
} ,
success: function ( result) {
if ( result. success) {
document. location. href = this. loginRedirect;
} else {
if ( result. data. code == 'invalid_username' ) {
var $rowLog = this. $username . closest( '.w-form-row' ) ;
$rowLog . toggleClass( 'check_wrong' ) ;
$rowLog . find( '.w-form-row-state' ) . html( result. data. message ? result. data. message : '' ) ;
} else if ( result. data. code == 'incorrect_password' || result. data. code == 'empty_password' ) {
var $rowPwd = this. $password . closest( '.w-form-row' ) ;
$rowPwd . toggleClass( 'check_wrong' ) ;
$rowPwd . find( '.w-form-row-state' ) . html( result. data. message ? result. data. message : '' ) ;
} else {
this. $resultField . usMod( 'type' , 'error' ) . html( result. data. message) ;
}
}
this. $submitBtn . removeClass( 'loading' ) ;
} . bind( this) ,
} ) ;
}
} ;
$. fn. wUsLogin = function ( options) {
return this
. each ( function ( ) { $( this) . data( 'wUsLogin' , new $us . WLogin( this, options) ) ;
} ) ;
} ;
$( function ( ) {
$( '.widget_us_login' ) . wUsLogin( ) ;
} ) ;
} ( jQuery) ;
/**
* Form customs
*/
jQuery( function ( $) {
// Add not-empty class when filling form fields
$
( 'input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="date"], input[type="search"], input[type="url"], input[type="password"], textarea' ) . each ( function ( index
, input
) { var $input = $( input) ,
$row = $input . closest( '.w-form-row' ) ;
if ( $input . attr( 'type' ) == 'hidden' ) return ;
$row . toggleClass( 'not-empty' , $input . val( ) != '' ) ;
$input . on( 'input' , function ( ) {
$row . toggleClass( 'not-empty' , $input . val( ) != '' ) ;
} ) ;
} ) ;
// Add focused class for all form fields
$( document) . on( 'focus' , '.w-form-row-field input, .w-form-row-field textarea' , function ( ) {
$( this) . closest( '.w-form-row' ) . addClass( 'focused' ) ;
} ) ;
$( document) . on( 'blur' , '.w-form-row-field input, .w-form-row-field textarea' , function ( ) {
$( this) . closest( '.w-form-row' ) . removeClass( 'focused' ) ;
} ) ;
} ) ;
keeon
Отправлено: 18 Августа, 2019 - 14:34:37 • Тема: Переадресация на другую станицу с контактной формы • Форум: Напишите за меня, пожалуйста
Ответов: 12 Просмотров: 217
Прошу помочь опытных пользователей. Есть сайт на котором установлена контактная форма. После нажатия "Ок", я получаю e-mail и телефон клиента, а пользователь сайта получает сообщение об успешной отправки информации. Нужно вместо сообщения, настроить автоматический перевод клиента на другую страницу сайта после нажатия "Ок" и отправки контактных данных.
Код контактной формы на сайте:
PHP:
скопировать код в буфер обмена
<?PHP defined ( 'ABSPATH' ) OR
die ( 'This script cannot be accessed directly.' ) ;
/**
* Contact form configuration
*
* @filter us_config_cform
*/
'type' => 'textfield' ,
'title' => '' ,
'placeholder' => us_translate( 'Name' ) ,
'error' => __( 'Please enter your Name' , 'us' ) ,
) ,
'type' => 'email' ,
'title' => '' ,
'placeholder' => us_translate( 'Email' ) ,
'error' => us_translate( 'Please enter a valid email address.' ) ,
) ,
'type' => 'textfield' ,
'title' => '' ,
'placeholder' => __( 'Phone Number' , 'us' ) ,
'error' => __( 'Please enter your Phone Number' , 'us' ) ,
) ,
'type' => 'textarea' ,
'title' => '' ,
'placeholder' => __( 'Message' , 'us' ) ,
'error' => __( 'Please enter a Message' , 'us' ) ,
) ,
'type' => 'captcha' ,
'title' => __( 'Just to prove you are a human, please solve the equation: ' , 'us' ) ,
'placeholder' => '' ,
'error' => __( 'Please enter the equation result' , 'us' ) ,
) ,
'type' => 'checkbox' ,
'title' => '' ,
'placeholder' => '' ,
'error' => __( 'You need to agree with the terms to proceed' , 'us' ) ,
) ,
) ,
'submit' => __( 'Send Message' , 'us' ) ,
'success' => __( 'Thank you! Your message was sent.' , 'us' ) ,
'empty_message' => __( 'Cannot send empty message. Please fill any of the fields.' , 'us' ) ,
'other' => __( 'Cannot send the message. Please contact the website administrator directly.' , 'us' ) ,
) ,
'subject' => __( 'New message from %s' , 'us' ) ,
) ;
Вставка контактной формы на сайте:
PHP:
скопировать код в буфер обмена
[ us_cform receiver_email= "contact@________.ua" message_field= "hidden" button_text= "OK" ] I consent to the processing and storage of my personal data[ / us_cform]
Страниц (1): [1]
Powered by ExBB FM 1.0 RC1. InvisionExBB