csit
Forum Replies Created
-
Maybe use “else” is better than “return”, because return; empty will refresh the page and user will never see the send success massages in run.php:114
$html .= __( "Your message was sent successfully. Thank you!", 'contact-form-block' );
I changed the code and it works properly
// Final data for this form
$data = array( 'success' => $success, 'error' => $error, 'form' => $form );
// If Success and URL Redirect, then redirect
$redirect_url = apply_filters( 'mcfb_redirect_url', get_option( 'mcfb_redirect_url', '' ), $success, $error, $form );
if ( $success && !empty( $redirect_url ) ) {
$redirect_url = $redirect_url . '#my_form_id'; //maybe this is not necessarily
wp_safe_redirect( $redirect_url );
//return; remove the empty return
}else{
// Prepare an ID associated with a transcient for the original page
$id = uniqid();
set_transient( "mcfb_{$id}", json_encode( $data ), 60 );
$url = esc_url( add_query_arg( 'mcfb_redirect', $id, $_SERVER["HTTP_REFERER"] ) );
$url = $url . '#my_form_id';
wp_safe_redirect( $url );
}Forum: Fixing WordPress
In reply to: shortcode in block theme templates template.html not workVersion 6.2.2
Security updates
The security team would like to thank the following people for responsibly reporting vulnerabilities and allowing them to be fixed in this release.
- Block themes parsing shortcodes in user-generated data; thanks to Liam Gladdy of WP Engine for reporting this issue.
The issue above was originally patched in the 6.2.1 release, but needed further hardening here in 6.2.2. The Core team is thankful for the community in their response to 6.2.1 and collaboration on finding the best path forward for proper resolution in 6.2.2.
- This reply was modified 1 year, 10 months ago by csit.
Forum: Fixing WordPress
In reply to: shortcode in block theme templates template.html not workI wrote the details here!
Forum: Plugins
In reply to: [WooCommerce] [woocommerce_my_account] not work after update wordpress 6.2.1my account code structure : wp-content/themes/my-theme/patterns/my-account.php
<?php /** * Title: My Account pattern * Slug: my-theme/account */ ?> <!-- wp:group {"layout":{"type":"constrained"}} --> <div class="wp-block-group"><!-- wp:shortcode --> [woocommerce_my_account] <!-- /wp:shortcode --></div> <!-- /wp:group -->
my theme templates code structure : wp-content/themes/my-theme/templates/my-account.html
<!-- wp:pattern {"slug":"my-theme/account"} /-->
my theme templates code structure : wp-content/themes/my-theme/theme.json
{ "$schema": "https://schemas.wp.org/wp/6.1/theme.json", "customTemplates": [ { "name": "my-account", "title": "My Account" }, ], "version": 2, }
then edit a page and select a page template choose our custom template My Account
then the page will only output the [woocommerce_my_account] string.
I want to get the form id in my theme functions.php
I have try, but the result is still the same, the user name always after the ?lang=en
the result: https://192.168.9.168:89/user?lang=en/qq122649529sdaf/
even I try return nothing:add_filter("um_localize_permalink_filter","my_um_profile_url", 20, 2); function my_um_profile_url( $profile_url){ //nothing to return return; }
the “View profile” link output:
<a href="/qq122649529sdaf/">View profile</a>
the username “/qq122649529sdaf/” always added to the View profile, even the “um_localize_permalink_filter” return empty
Hi @champsupertramp Thanks for your code! I have try to use it ,but still no change, even I test it like this:
add_filter("um_localize_permalink_filter","my_um_profile_url", 10, 2); function my_um_profile_url( $profile_url){ $url = $profile_url; $url = str_replace('?lang=en', '', $url); $url = untrailingslashit( $url ).'?lang=en'; return $url }
the result is : https://192.168.9.168:89/user?lang=en/qq122649529sdaf/
It seems that the part of username is added after this filter
- This reply was modified 3 years, 2 months ago by csit.
I found the way to change the url on WPML side, but Ultimate Member since no hook to change the “View profile” link
here is my code in my themes functions.php:
if ( function_exists('icl_object_id') ){ $languages = icl_get_languages('skip_missing=0&orderby=code'); if(!empty($languages)){ html = ''; foreach($languages as $l){ if(!$l['active'] || $l['active'] ) { if( $l['code'] === 'en'){ $url = str_replace('?lang=en', '', $l['url']); $url = untrailingslashit( $url ).'?lang=en'; }else{......
on this way I change the WMPL switcher to the correct link, but the “View profile” link can not change
Thanks for your suggestion, it works fine, and everything works fine, that’s my fault, I test it not enough
Is there any different with my code?
Thanks so much for your help. It works! but here have a little different when show the error msg, please look at the picture login-form-and-register-form
at the top of the user name field of the login form, show the error msg and have a close button, but the register form not show, how to make it to the same ?- This reply was modified 3 years, 3 months ago by csit.
Hi @champsupertramp Thanks your reply!
I add your code but it give me a notice:
Notice: Undefined variable: key in /var/www/html/wp…..I added the code to my functions.php
function my_frontend_ur_lostpassword_form_captcha(){ ...... } add_action('user_registration_lostpassword_form', 'my_frontend_ur_lostpassword_form_captcha', 10, 2); function my_ur_lostpassword_form_verification($true){ if ( isset($_POST['captcha_token']) && isset($_POST['captcha_server']) ) { $captcha_token = $_POST['captcha_token']; $captcha_server = $_POST['captcha_server']; $myCaptcha = new myCaptcha(); if ( $myCaptcha->$myCaptcha_verification( $captcha_server, $captcha_token ) == true ){ return $true; }else{ return new WP_Error("Captcha Invalid", __("<strong>ERROR</strong>: Captcha verification failed, please try again.", 'mycaptcha')); } }else{ return new WP_Error("Captcha Invalid", __("<strong>ERROR</strong>: Captcha verification failed, please try again. If not then enable JavaScript", 'mycaptcha')); } } return $true; } add_filter( 'allow_password_reset','my_ur_lostpassword_form_verification', 10, 3);
when I test it on the lostpassword page after I input the email address and the captcha done, everything works fine, but click the reset password button will give this
Fatal error: Uncaught Error: Object of class WP_Error could not be converted to string in /var/www/html/wp-content/plugins/user-registration/includes/class-ur-emailer.php:605 Stack trace: #0 /var/www/html/wp-content/plugins/user-registration/includes/class-ur-emailer.php(605): str_replace('{{key}}', Object(WP_Error), 'Someone has req...') #1 /var/www/html/wp-content/plugins/user-registration/includes/class-ur-emailer.php(439): UR_Emailer::parse_smart_tags('Someone has req...', Array) #2 /var/www/html/wp-content/plugins/user-registration/includes/shortcodes/class-ur-shortcode-my-account.php(371): UR_Emailer::lost_password_email('[email protected]...', Object(WP_User), Object(WP_Error)) #3 /var/www/html/wp-content/plugins/user-registration/includes/class-ur-form-handler.php(487): UR_Shortcode_My_Account::retrieve_password() #4 /var/www/html/wp-includes/class-wp-hook.php(303): UR_Form_Handler::process_lost_password('') #5 /var/www/html/wp-includes/class-wp-hook.php(327): WP_Hook->apply_filters(NULL, Array) #6 /var/www/html/wp- in /var/www/html/wp-content/plugins/user-registration/includes/class-ur-emailer.php on line 605
It seems that the user registration plugin does not allow other plugins to add the verification code to the lost password page and I found the filter “allow_password_reset” in /var/www/html/wp-content/plugins/user-registration/includes/shortcodes/class-ur-shortcode-my-account.php $allow = apply_filters( ‘allow_password_reset’, true, $user_data->ID ); ,
I don’t know why the user registration plugin use the wordpress default filter name “allow_password_reset”, is there have any other filter let me to add my own custom captcha verification to User Registration lostpassword page ?- This reply was modified 3 years, 3 months ago by csit.
means that if you want to controls your plugin css you need to add something like:
.user-registration .components-base-control__field
don’t use .components-base-control__field directly. this is the wordpress components input field class nameI think you need to update your permalinks.
Try this, go to the admin panel –> Settings –> Permalinks
just click Save Changes.