Thread Starter
efrap
(@efrap)
Solved. Needed to call secondary menu with esc_html__ in functions.php.
Thread Starter
efrap
(@efrap)
Correction – although visibility is solved, log out link still incomplete. /wp-login.php
-
This reply was modified 6 years, 1 month ago by
efrap.
Plugin Contributor
Paolo
(@paoltaia)
Hi,
we are checking this, we’ll get back to you asap.
Thanks for your patience
Thread Starter
efrap
(@efrap)
Issue solved by inserting the menus again. Thank you.
Again, great plugin.
Thread Starter
efrap
(@efrap)
The issues do reappear again if I add an additional css class to the menus.
Thanks, we are checking into it.
Thread Starter
efrap
(@efrap)
Bypassing the css problem can done with alternate css coding.
But the login menu does not play nice with a multilingual site and always sends user to main language login page, even if I change the menu url to the correct page. Logout menu works fine.
This is not a deal breaker, as I can use a couple of other plugins to make this work.
Thread Starter
efrap
(@efrap)
Also, links like ‘forgot password’ and ‘create account’ all link back to main language.
Thread Starter
efrap
(@efrap)
To fix this lastest reported bug, I have added code to the uwp_get_page_link function in /includes/helpers/permalinks.php
Original function:
function uwp_get_page_link($page_type) {
$page = new UsersWP_Pages();
return $page->get_page_link($page_type);
}
Modified function (for polylang)
function uwp_get_page_link($page_type) {
$page = new UsersWP_Pages();
$url = $page->get_page_link($page_type);
$post_id = url_to_postid( $url ); // find id from url
$trans_id = pll_get_post( $post_id); // find correct id
$trans_url = get_permalink($trans_id); // get permalink from id
return $trans_url;
}
This does not work on login menu link though, still main language link.
If you based the page links on ID of page instead of permalinks, this might fix the problem.
EDIT
A simpler change can be made upstream in /inludes/class-pages.php, at end of file.
Original code
if ($page_id) {
if (uwp_is_wpml()) {
$wpml_page_id = uwp_wpml_object_id($page_id, 'page', true, ICL_LANGUAGE_CODE);
if (!empty($wpml_page_id)) {
$page_id = $wpml_page_id;
}
}
$link = $page_id;
if($get_link){
$link = get_permalink($page_id);
}
}
Changed code
if ($page_id) {
if (uwp_is_wpml()) {
$wpml_page_id = uwp_wpml_object_id($page_id, 'page', true, ICL_LANGUAGE_CODE);
if (!empty($wpml_page_id)) {
$page_id = $wpml_page_id;
}
}
// added polylang code
if (class_exists('Polylang')){
$page_id = pll_get_post( $page_id);
}
$link = $page_id;
if($get_link){
$link = get_permalink($page_id);
}
}
Still does not change Login menu url.
-
This reply was modified 6 years, 1 month ago by
efrap.
-
This reply was modified 6 years, 1 month ago by
efrap.
-
This reply was modified 6 years, 1 month ago by
t-p.
Thread Starter
efrap
(@efrap)
Simpler still
inclues/helpers/misc.php, uwp_is_wpml function, line 1417
original
if (class_exists('SitePress') && function_exists('icl_object_id')) {
modified
if ((class_exists('SitePress') && function_exists('icl_object_id')) || class_exists('Polylang')) {
-
This reply was modified 6 years, 1 month ago by
efrap.
Hi,
Thank you very much for all your suggestions. Those are helpful and we will add them in our next release of the plugin.
Regards,
Patrik
Thread Starter
efrap
(@efrap)
That would be great!
In the meantime, I have made changes to plugin code
1. includes/class-templates.php line 737 for logout redirection
2. includes/helpers/permalinks.php line 424 for other redirections
3. includes/helpers/misc.php line 1417 – only check for icl_object_id – polylang is compatible with WPML but the Sitepress check prevents it. I ended up using add_actions, (uwp_after_process_login and uwp_after_process_register) since I needed to redirect to a post type other than a page.
Hi,
We have also considered changes you have just mentioned in your last comment.
Thanks