Forum Replies Created
-
Author
-
November 3, 2018 at 11:53 in reply to: How to use bp_core_fetch_avatar instead of get_avatar for blog post owner #212752arbolifeParticipant
Hi Radu,
I tried to put this code as it is in my functions.php file and it generates an HTTP error 500.
COPY CODE<img src=” if ( ! function_exists( ‘kleo_fb_bp_show_avatar_url’ ) ) { function kleo_fb_bp_show_avatar_url($gravatar, $params) { //if we have an avatar uploaded and is not Gravatar return it if (strpos($gravatar, home_url()) !== false && strpos($gravatar, ‘gravatar’) === false) { return $gravatar; } return $gravatar; } }”>
Cheers,
MarcarbolifeParticipantHi Radu,
The IP was blocked only for 24 hours because it generated 10x 404 errors in 30 seconds. It has now been put on whitelist.
Maybe don’t deactivate the Cloudinary plugin, otherwise all images hosted in the cloud generate 404 errors:
COPY CODE86.127.153.187 - - [28/Apr/2017:15:56:44 +0200] "GET /wp-content/uploads/https:/res.cloudinary.com/arbolife/image/upload/v1481389384/clients/ArboLife-client-logo-graine-de-belette.png HTTP/1.1" 404 8565 - ww1.arbolife.com 86.127.153.187 - - [28/Apr/2017:15:56:45 +0200] "GET /wp-content/uploads/https:/res.cloudinary.com/arbolife/image/upload/v1481389384/clients/ArboLife-client-logo-zero-waste-switzerland.png HTTP/1.1" 404 8567 - ww1.arbolife.com 86.127.153.187 - - [28/Apr/2017:15:56:45 +0200] "GET /wp-content/uploads/https:/res.cloudinary.com/arbolife/image/upload/v1481389384/clients/ArboLife-client-logo-oka.png HTTP/1.1" 404 8555 - ww1.arbolife.com
You can continue troubleshooting now. I had already tried disabling all plugins, it’s really only connected to WPML.
Cheers,
MarcarbolifeParticipantHi Radu,
Great, thanks. I made a lot of progress with this. I can now customize the message and translate it with a filter in my child theme [by the way, the only way to detect language is through the referring URL as both get_locale() and ICL_LANGUAGE_CODE always bring the default site language].
Here’s the code if it can help someone:
COPY CODEadd_filter('login_errors','login_error_message'); function login_error_message($error){ //check if that's the error you are looking for with the search string $pos = strpos($error, 'paramètres invalides'); if (is_int($pos)) { $refer_url = explode('/', wp_get_referer() ); $refer_lang = $refer_url[3]; if ( strpos($refer_lang, 'en') !== false ) { $error = '<strong>ERROR</strong>: Invalid username. <a href="#kleo-lostpass-modal" class="kleo-show-lostpass kleo-other-action">Lost your password?</a>'; } elseif ( strpos($refer_lang, 'fr') !== false ) { $error = '<strong>ERREUR</strong>: paramètres invalides. <a href="#kleo-lostpass-modal" class="kleo-show-lostpass kleo-other-action">Mot de passe oublié ?</a>'; } } return $error; }
Now I have 2 more issues with the kleo ajax login pop-up mechanism:
1. I set WPML to have show /fr/ in French and /en/ in English. I also switched the default language to French. Now the ajax login pop-up works everywhere on the site except from the home page. So If you go to https://www.arbolife.com/en/ and click on the login icon (top right), it opens wp-login.php which I want to avoid (can’t be translated). From any other page on the site, the kleo ajax pop-up works fine.
2. I changed the “lost password” link in the login error message (code above) to use the Kleo modal pop-up but it doesn’t work. My link looks like the other one with this:
<a href="#kleo-lostpass-modal" class="kleo-show-lostpass kleo-other-action">
but clicking on it has no effect instead of switching to the kleo ajax lost password form. How to I make this link also switch. You can try if you try the ajax login from anywhere except the homepage and try to login with bogus information. Then the link shows up but doesn’t workCheers,
MarcarbolifeParticipantHi Radu,
This doesn’t work either.
I tried the most trivial test (from the code you suggested) and it doesn’t work:
COPY CODEadd_filter('login_errors','login_error_message'); function login_error_message($error){ $error = "Test error message"; return $error; }
Cheers,
MarcarbolifeParticipantHi Radu,
So I tried 2 versions and still no success:
First with trying your suggestion, heres my code:
COPY CODEif ( is_wp_error( $user_signon ) ) { $error_msg = $user_signon->get_error_message(); if( get_locale() == 'fr_FR' ) { $error_msg = '<strong>ERREUR</strong>: Utilisateur ou mot de passe invalide.'; } echo wp_json_encode( array( 'loggedin' => false, 'message' => '<span class="wrong-response"><i class="icon icon-attention"></i> ' . $error_msg . '</span>', ) ); //echo json_encode(array( 'loggedin' => false, 'message' => '<span class="wrong-response"><i class="icon icon-attention"></i> ' . __( 'Wrong username or password. Please try again.', 'kleo_framework' ) . '</span>' ));
No success, it stays in English.
Second attempt is with the old code from your function and WPML string translation:
echo json_encode(array( 'loggedin' => false, 'message' => '<span class="wrong-response"><i class="icon icon-attention"></i> ' . __( 'Wrong username or password. Please try again.', 'kleo_framework' ) . '</span>' ));
I found the exact string in WPML string translation, translated it… and still no success. The message stays in English no matter what I do.
What else do you suggest I try?
Cheers,
MarcarbolifeParticipantHi Radu,
It seems like you guys had it right for translation but then commented the code out to put something that can’t be translated easily.
in functions.php on line 1408:
COPY CODEecho wp_json_encode( array( 'loggedin' => false, 'message' => '<span class="wrong-response"><i class="icon icon-attention"></i> ' . $error_msg . '</span>', ) ); //echo json_encode(array( 'loggedin' => false, 'message' => '<span class="wrong-response"><i class="icon icon-attention"></i> ' . __( 'Wrong username or password. Please try again.', 'kleo_framework' ) . '</span>' ));
If I comment the first part and uncomment the second part, it works and can be translated. If this is intended to stay like this, could you guys add a filter there so the content of $error_msg could be easily customized?
Cheers,
MarcarbolifeParticipantHi Radu,
Thanks, it works only when I put priority 9 instead of 11. Does that make sense?
COPY CODEfunction sq7_rdu_redirect( $redirect_to, $request, $user ) { $redirect_to = get_permalink(); return $redirect_to; } add_filter('login_redirect', 'sq7_rdu_redirect', 9, 3);
Best,
MarcarbolifeParticipantHi Abe,
I’ve updated my code, but the disappears which defeats the entire purpose. Here’s my new code, still not working:
COPY CODE<p style="text-align: center;"><strong>© [current-year] ArboLife Ltd liab. Co | Neuchâtel | Switzerland | <a href="https://www.facebook.com/arbolifecom" target="_blank"><span style="color:#b2b8c0"><i class="icon-facebook-1"></i></span></a> | <a href="https://www.linkedin.com/company/arbolife" target="_blank"><span style="color:#b2b8c0"><i class="icon-linkedin-1"></i></span></a> | <a href="https://twitter.com/arbo_life" target="_blank"><span style="color:#b2b8c0"><i class="icon-twitter-1"></i></span></a></strong></p>
Best,
MarcarbolifeParticipantHi Radu,
Thanks, but that produces the same result as the first two attempts, it creates a 404 error because there is again “/false” appended to the current page URL.
I googled it realized the get_permalink(); was returning the false and your function was appending it to the end of the current page URL, so no need to get the current URL because it’s already there. Not adding anything to it might work. So I tried this – and I’m not a coder, but it worked:
COPY CODEadd_filter('kleo_fb_register_redirect','custom_redirect_link_facebook_login'); function custom_redirect_link_facebook_login(){ $reloadcurrentpage = ""; return $reloadcurrentpage; } add_filter('kleo_fb_register_redirect','custom_redirect_link_facebook_login');
Is this completely stupid to create a function to return nothing or should it do something else?
Cheers,
MarcarbolifeParticipantI have one more issue with this code, so let me summarize it all in this post for you.
What I want: when menu is set to transparent -> the mobile menu is also transparent.
The code you provided works fine for achieving it, but it has 2 side effects:1. The title and breadcrumb area disappearing below a certain browser size (1024px or so)
2. It makes the whole page get hidden behind the mobile menu (removes padding) when a non-transparent mobile menu is being used.
COPY CODE@media(max-width:1024px) { .navbar { background:rgba(42, 42, 42, 0.0) !important; position: absolute; } }
Can you please suggest another fix that doesn’t break the other things ?
Cheers,
MarcarbolifeParticipantHi,
OK, so I fixed the weird icons by adding this to the quick CSS:
COPY CODE.icon-bar:before { content: '' !important; }
I don’t know why it was there in the first place 😉
However, the title and breadcrumb disappearing is really bad, I hope you can help me fix that one.
Thanks,
MarcarbolifeParticipantHi Radu,
Sorry, I need to reopen this thread.
There is a side-effect of the code you provided is that the title + breadcrumb area disappear below a certain browser size:
COPY CODE@media(max-width:1024px) { .navbar { background:rgba(42, 42, 42, 0.0) !important; position: absolute; } }
Can you please provide an update that doesn’t create this problem?
The other problem that was solved in this ticket was the 3 arrows on top of each others right below the mobile menu. I solved it as you recommended by doing another clean download of new icons. The problem is now back, but I have not touched the icon files since fixing it.
You can check it out yourself. Here’s a simple page that has both problems, the title and breadcrumbs + the weird icons: https://www.arbolife.com/events-home/events-attending/
Cheers,
MarcarbolifeParticipantOK I tried just that and it’s a complete failure. I get an HTTP error 500 in return.
Here’s my archive.php file in the kleo child theme:
COPY CODE<?php /** * The template for displaying Archive pages * * Used to display archive-type pages if nothing more specific matches a query. * For example, puts together date-based pages if no date.php file exists. * * If you'd like to further customize these archive views, you may create a * new template file for each specific one. For example, Twenty Fourteen * already has tag.php for Tag archives, category.php for Category archives, * and author.php for Author archives. * * @link http://codex.wordpress.org/Template_Hierarchy * * @package WordPress * @subpackage Kleo * @since Kleo 1.0 */ get_header(); ?> <?php //Specific class for post listing */ $blog_type = sq_option('blog_type','masonry'); $blog_type = apply_filters( 'kleo_blog_type', $blog_type ); $template_classes = $blog_type . '-listing'; if ( sq_option( 'blog_archive_meta', 1 ) == 1 ) { $template_classes .= ' with-meta'; } else { $template_classes .= ' no-meta'; } if ( $blog_type == 'standard' && sq_option('blog_standard_meta', 'left' ) == 'inline' ) { $template_classes .= ' inline-meta'; } add_filter('kleo_main_template_classes', create_function('$cls','$cls .=" posts-listing ' . $template_classes . '"; return $cls;')); ?> <?php get_template_part('page-parts/general-title-section'); ?> <?php get_template_part('page-parts/general-before-wrap'); ?> <?php if ( category_description() ) : ?> <div class="archive-description"><?php echo category_description(); ?></div> <?php endif; ?> <?php if ( have_posts() ) : ?> echo do_shortcode( '[vc_row][vc_column][vc_masonry_grid post_type="post" max_items="-1" style="lazy" items_per_page="8" show_filter="yes" gap="15" filter_style="bordered-rounded" item="8865" grid_id="vc_gid:1470176247276-98a2a59c-ab45-5" filter_source="category"][/vc_column][/vc_row]' ); else : // If no content, include the "No posts found" template. get_template_part( 'content', 'none' ); endif; ?> <?php get_template_part('page-parts/general-after-wrap'); ?> <?php get_footer(); ?>
-
AuthorPosts