vl4d
Forum Replies Created
-
Forum: Plugins
In reply to: [Comments - wpDiscuz] custom avatarthanks i try something like this
function my_custom_avatar($avatar, $id_or_email, $size, $default, $alt) {
// Get user ID if email or object is provided
if (is_numeric($id_or_email)) {
$user_id = $id_or_email;
} elseif (is_object($id_or_email)) {
// For objects like WP_Comment
$user_id = $id_or_email->user_id;
} else {
$user = get_user_by('email', $id_or_email);
$user_id = $user ? $user->ID : null;
}
// Retrieve custom avatar from user meta (with correct meta_key)
if ($user_id) {
$custom_avatar = get_user_meta($user_id, 'Custom_User_avatar', true);
}
// If a custom avatar is available, return it directly
if (!empty($custom_avatar)) {
$avatar = "<img alt='{$alt}' src='" . esc_url($custom_avatar) . "' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' />";
}
return $avatar;
}
add_filter('get_avatar', 'my_custom_avatar', 10, 5);but beacuse i have the Comments and Users Cache on if a user have make a comment and after change the avatar its still show the old is this normal??
@nsinelnikov so my problem is fixed but i never check the settings or other pages from ultimate member now the style of the plugin is broken :/ https://prnt.sc/vNIWK9MT5pte – https://prnt.sc/wCE9D0W_fQNb
- This reply was modified 1 year, 5 months ago by vl4d.
thank you
@nsinelnikov sorry again but never help me with this….
@elliotvs sorry for the x2post but is any way to help me with this??
@nsinelnikov sorry for the reply but is any way to help me with this?? and the wrong icons (except 2-3) is everywhere i have this https://prnt.sc/JndQbUfZsq7D
@elliotvs this is the code for the login part if helps
<?php /** * Plugin Name: MangaBooth Manga * Description: Login */ Class WP_MANGA_LOGIN { public function __construct() { // add_shortcode( 'wp_manga_user', array($this, 'wp_manga_user_shortcode') ); add_action( 'wp_enqueue_scripts', array( $this, 'wp_manga_login_styles' ), 50 ); add_action( 'wp_ajax_nopriv_wp_manga_signin', array( $this, 'wp_manga_sign_in' ) ); add_action( 'wp_ajax_nopriv_wp_manga_signup', array( $this, 'wp_manga_sign_up' ) ); add_action( 'wp_ajax_nopriv_wp_manga_reset', array( $this, 'wp_manga_reset' ) ); add_action( 'wp_ajax_nopriv_wp_manga_reset_password', array( $this, 'wp_manga_reset_password' ) ); add_action( 'wp_footer', array( $this, 'login_template' ) ); add_action( 'wp_loaded', array( $this, 'remove_wp_toolbar' ) ); } function login_template() { global $wp_manga_template; if ( ! is_user_logged_in() ) { $wp_manga_template->load_template( 'login', false ); } // Reset password form if( isset( $_GET['action'] ) && $_GET['action'] == 'rp' && !empty( $_GET['key'] ) && !empty( $_GET['login'] ) ){ $check = check_password_reset_key( $_GET['key'], $_GET['login'] ); if( is_wp_error( $check ) ){ return; } wp_enqueue_script('utils'); wp_enqueue_script('user-profile'); $wp_manga_template->load_template( 'reset-password', false ); } } function wp_manga_login_styles() { wp_enqueue_script( 'wp-manga-login-ajax', WP_MANGA_URI . 'assets/js/login.js', array( 'jquery' ), '1.7.2', true ); wp_localize_script( 'wp-manga-login-ajax', 'wpMangaLogin', array( 'admin_ajax' => admin_url( 'admin-ajax.php' ), 'home_url' => get_home_url(), 'nonce' => wp_create_nonce('wp-manga'), 'messages' => array( 'please_enter_username' => esc_html__('Please enter username', WP_MANGA_TEXTDOMAIN), 'please_enter_password' => esc_html__('Please enter password', WP_MANGA_TEXTDOMAIN), 'invalid_username_or_password' => esc_html__('Invalid username or password', WP_MANGA_TEXTDOMAIN), 'server_error' => esc_html__('Server Error!', WP_MANGA_TEXTDOMAIN), 'username_or_email_cannot_be_empty' => esc_html__('Username or Email cannot be empty', WP_MANGA_TEXTDOMAIN), 'please_fill_all_fields' => esc_html__('Please fill in all password fields.', WP_MANGA_TEXTDOMAIN), 'password_cannot_less_than_12' => esc_html__('Password cannot have less than 12 characters', WP_MANGA_TEXTDOMAIN), 'password_doesnot_match' => esc_html__('Password does not match. Please try again.', WP_MANGA_TEXTDOMAIN), 'username_cannot_empty' => esc_html__('Username cannot be empty', WP_MANGA_TEXTDOMAIN), 'email_cannot_empty' => esc_html__('Email cannot be empty', WP_MANGA_TEXTDOMAIN), 'password_cannot_empty' => esc_html__('Password cannot be empty', WP_MANGA_TEXTDOMAIN), ) ) ); } function wp_manga_sign_in() { if( empty( $_POST['login'] ) || empty( $_POST['pass'] ) ){ wp_send_json_error( esc_html__('Invalid Login Request', WP_MANGA_TEXTDOMAIN ) ); } // This is for Login ReCaptcha plugin $_SERVER['PHP_SELF'] = 'wp-login.php'; $user_data = array(); $user_data['user_login'] = trim( $_POST['login'] ); $user_data['user_password'] = trim( $_POST['pass'] ); $user_data['remember'] = $_POST['rememberme']; $user = wp_signon( $user_data, false ); $nonce = isset($_POST['nonce']) ? $_POST['nonce'] : ''; if(wp_verify_nonce( $nonce, "wp-manga" )){ if ( is_wp_error( $user ) ) { wp_send_json_error( strip_tags( $user->get_error_message() ) ); } else { wp_set_current_user( $user->ID, $user_data['user_login'] ); wp_send_json_success( array( 'id' => $user->ID ) ); } } } function wp_manga_sign_up() { $nonce = isset($_POST['nonce']) ? $_POST['nonce'] : ''; if(wp_verify_nonce( $nonce, "wp-manga" )){ if ( ! empty( $_POST['user_login'] ) && ! empty( $_POST['user_pass'] ) && ! empty( $_POST['user_email'] ) ) { /** * Verify Captcha */ if( method_exists( 'LoginNocaptcha', 'authenticate' ) ){ // This is for Login ReCaptcha plugin $_SERVER['PHP_SELF'] = 'wp-login.php'; // Verify Recaptcha with dummy user $recaptcha = LoginNocaptcha::authenticate( null, null, null ); if( is_wp_error( $recaptcha ) ){ wp_send_json_error( __( $recaptcha->get_error_message(), WP_MANGA_TEXTDOMAIN ) ); } } /** * Validate Email */ if( ! $this->is_valid_email( $_POST['user_email'] ) ){ return wp_send_json_error( esc_html__( 'Invalid email address. Please check again.', WP_MANGA_TEXTDOMAIN ) ); } $user_data = array(); $user_data['user_login'] = trim( $_POST['user_login'] ); $user_data['user_pass'] = trim( $_POST['user_pass'] ); $user_data['user_email'] = trim( $_POST['user_email'] ); $user_data['role'] = get_option('default_role','subscriber'); $min_username_characters = apply_filters('wp_manga_user_registration_username_min_characters', 6); if( strlen( $user_data['user_login'] ) < $min_username_characters ){ return wp_send_json_error( sprintf(esc_html__( 'Username must have at least %d characters', WP_MANGA_TEXTDOMAIN ), $min_username_characters) ); } $min_password_characters = apply_filters('wp_manga_user_registration_password_min_characters', 6); if( strlen( $user_data['user_pass'] ) < $min_password_characters ){ return wp_send_json_error( sprintf(esc_html__( 'Password must have at least %d characters.', WP_MANGA_TEXTDOMAIN ), $min_password_characters) ); } $user_id = wp_insert_user( $user_data ); if ( is_wp_error( $user_id ) ) { wp_send_json_error( strip_tags( $user_id->get_error_message() ) ); } else { do_action( 'register_new_user', $user_id ); wp_send_json_success( __( 'Registration successfully! You can login now.', WP_MANGA_TEXTDOMAIN ) ); } } else { wp_send_json_error( __( 'There was an error when registration', WP_MANGA_TEXTDOMAIN ) ); } } } function wp_manga_reset() { $nonce = isset($_POST['nonce']) ? $_POST['nonce'] : ''; if(wp_verify_nonce( $nonce, "wp-manga" )){ /** * Verify Captcha */ if( method_exists( 'LoginNocaptcha', 'authenticate' ) ){ // This is for Login ReCaptcha plugin $_SERVER['PHP_SELF'] = 'wp-login.php'; // Verify Recaptcha with dummy user $recaptcha = LoginNocaptcha::authenticate( null, null, null ); if( is_wp_error( $recaptcha ) ){ wp_send_json_error( __( $recaptcha->get_error_message(), WP_MANGA_TEXTDOMAIN ) ); } } $user_reset = isset( $_POST['user'] ) ? $_POST['user'] : ''; if ( empty( $user_reset ) ) { wp_send_json_error( __( 'Username or email address cannot be empty' ) ); } $user_reset = trim( $user_reset ); $result = $this->retrieve_password( $user_reset ); if( is_wp_error( $result ) ){ wp_send_json_error( $result->get_error_message() ); }else{ wp_send_json_success( __( 'Please check your email to get reset password link.', WP_MANGA_TEXTDOMAIN ) ); } die(); } } function retrieve_password( $user_login ){ if( $this->is_valid_email( $user_login ) ){ $user_data = get_user_by('email', $user_login ); }else{ $user_data = get_user_by( 'login', $user_login ); } if( ! $user_data ){ return new WP_Error( 'invalid_login', __( 'Invalid user login', WP_MANGA_TEXTDOMAIN ) ); } $key = get_password_reset_key( $user_data ); if ( is_wp_error( $key ) ) { return $key; } if ( is_multisite() ) { $site_name = get_network()->site_name; } else { /* * The blogname option is escaped with esc_html on the way into the database * in sanitize_option we want to reverse this for the plain text arena of emails. */ $site_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); } $user_email = $user_data->user_email; $message = __( 'Someone has requested a password reset for the following account:', WP_MANGA_TEXTDOMAIN ) . "\r\n\r\n"; /* translators : %s: user login */ $message .= sprintf( __( 'Username: %s', WP_MANGA_TEXTDOMAIN), $user_login ) . "\r\n\r\n"; $message .= __( 'If this was a mistake, just ignore this email and nothing will happen.', WP_MANGA_TEXTDOMAIN ) . "\r\n\r\n"; $message .= __( 'To reset your password, visit the following address:', WP_MANGA_TEXTDOMAIN ) . "\r\n\r\n"; $message .= '<' . home_url( "?action=rp&key=$key&login=" . rawurlencode( $user_data->user_login ) ) . ">\r\n"; /* translators: Password reset email subject. %s: Site name */ $title = sprintf( __( '[%s] Password Reset' ), $site_name ); $title = apply_filters( 'retrieve_password_title', $title, $user_login, $user_data ); $message = apply_filters( 'retrieve_password_message', $message, $key, $user_login, $user_data ); if( ! wp_mail( $user_email, wp_specialchars_decode( $title ), $message ) ){ return new WP_Error( 'sent_failed', __( 'The email could not be sent.', WP_MANGA_TEXTDOMAIN ) ); } return true; } function remove_wp_toolbar() { if ( is_user_logged_in() ) { //check current user role $user = wp_get_current_user(); $roles = $user->roles; global $wp_manga_setting; //check if hide admin for administrator $admin_hide_bar = $wp_manga_setting->get_manga_option( 'admin_hide_bar', false ); if ( in_array( 'administrator', $roles ) && $admin_hide_bar == false ) { show_admin_bar( true ); return; } } show_admin_bar( false ); } public function wp_manga_reset_password(){ if( ! empty( $_POST['user'] ) && ! empty( $_POST['new_password'] ) && strlen( $_POST['new_password'] ) > 12 && ! empty( $_POST['key'] ) ){ $check = check_password_reset_key( $_POST['key'], $_POST['user'] ); if( is_wp_error( $check ) ){ return wp_send_json_error( __( 'Invalid reset password request', WP_MANGA_TEXTDOMAIN ) );; } $password = base64_decode( $_POST['new_password'] ); $user_login = $_POST['user']; if( empty( $password ) ){ wp_send_json_error( __( 'Invalid password requested', WP_MANGA_TEXTDOMAIN ) ); } if( $this->is_valid_email( $user_login ) ){ $user_data = get_user_by('email', $user_login ); }else{ $user_data = get_user_by( 'login', $user_login ); } if( ! $user_data ){ return wp_send_json_error( __( 'User not found', WP_MANGA_TEXTDOMAIN ) ); } wp_set_password( $password, $user_data->ID ); wp_send_json_success([ 'message' => __( 'Password reset successuflly! You can login now.' ) ]); } wp_send_json_error( __( 'Invalid reset password request', WP_MANGA_TEXTDOMAIN ) ); } public function is_valid_email( $email ){ return filter_var( $email, FILTER_VALIDATE_EMAIL ); } } $GLOBALS['wp_manga_login'] = new WP_MANGA_LOGIN;
@nsinelnikov i can’t put my site here but i use this theme https://live.mangabooth.com/home-dark/
@elliotvs still the same after the new update
nop i dont use WooCommerce only the deafult wp
ok done i send you the files
i can’t share my website but is base on this theme https://live.mangabooth.com/
and the problme is only with login not with reset or registration- This reply was modified 1 year, 11 months ago by vl4d.
i try 3-4 browsers and i have clear the cache is not only for me is for all my users (but is working for the default wp-login.php)
edit: https://prnt.sc/NCRiuzQs8eZw
so i find i have this in my style and i fix it sorry for this i just dont search becuase i think is from plugin thanks
Forum: Plugins
In reply to: [A-Z Listing] Prevent list items from going over one linei wait for 1 year to get a response for the same question and they dont help
try this go to a-z-listing/css/a-z-listing-default.css
find all themax-width: calc((min(var(--a-z-listing-column-count, 3), 9) * var(--a-z-listing-column-width, 15em)) + ((min(var(--a-z-listing-column-count, 3), 9) - 1) * var(--a-z-listing-column-gap, 0.6em)));
and delete all the 16 lines like this https://prnt.sc/avjtIyCtj8dL
- This reply was modified 2 years, 2 months ago by vl4d.