Hi @stefanmeyer2,
I am a developer of Permalink Manager plugin 🙂
Could you provide me with more details on this issue via email:
contact /at/ maciejbis.net
Best regards,
Maciej
I did some extensive testing and the source of the problem is in the fact that my plugin (Permalink Manager) does not recognize the additional rewrite rules used by Ultimate Member plugin.
There are two ways to make both plugins work together.
You can make my plugin recognize UW permalinks with a custom code snippet:
function pm_detect_um_pages($uri_parts) {
global $permalink_manager_uris;
$output = '';
if(class_exists('UM') && empty($element_id)) {
$request_url = trim("{$uri_parts['uri']}/{$uri_parts['endpoint_value']}", "/");
$um_pages = array(
'user' => 'um_user',
'account' => 'um_tab',
);
// Detect UM permalinks
foreach($um_pages as $um_page => $query_var) {
$um_page_id = UM()->config()->permalinks[$um_page];
// Support for WPML/Polylang
$um_page_id = (!empty($uri_parts['lang'])) ? apply_filters('wpml_object_id', $um_page_id, 'page', true, $uri_parts['lang']) : $um_page_id;
if(!empty($um_page_id) && !empty($permalink_manager_uris[$um_page_id])) {
$user_page_uri = preg_quote($permalink_manager_uris[$um_page_id], '/');
preg_match("/^({$user_page_uri})\/([^\/]+)?$/", $request_url, $parts);
if(!empty($parts[2])) {
$uri_parts['uri'] = $parts[1];
$uri_parts['endpoint'] = $query_var;
$uri_parts['endpoint_value'] = sanitize_title($parts[2]);
}
}
}
}
return $uri_parts;
}
add_filter('permalink_manager_detect_uri', 'pm_detect_um_pages', 20);
The above snippet will be probably integrated in the next version of Permalink Manager.
Alternatively, you can make my plugin ignore the UM pages:
function pm_ignore_uw_permalinks($custom_uris) {
global $sitepress;
if(!is_array($custom_uris)) {
return $custom_uris;
}
$um_pages = array(
'user',
'account'
);
$excluded_ids = get_transient('pm_uw_excluded_ids');
// Cache UW permalinks
if(empty($excluded_ids)) {
foreach($um_pages as $um_page) {
$um_page_id = UM()->config()->permalinks[$um_page];
// Support for WPML
if(is_object($sitepress) && method_exists($sitepress, 'get_element_translations')) {
$trid = $sitepress->get_element_trid($um_page_id, 'post_page');
$page_translations = $sitepress->get_element_translations($trid, 'post_page');
}
if(is_array($page_translations)) {
foreach($page_translations as $page_translation) {
if(property_exists($page_translation, 'element_id')) {
$excluded_ids[] = $page_translation->element_id;
}
}
} else {
$excluded_ids[] = $um_page_id;
}
}
set_transient('pm_uw_excluded_ids', $excluded_ids, DAY_IN_SECONDS);
}
foreach($excluded_ids as $page_id) {
unset($custom_uris[$page_id]);
}
return $custom_uris;
}
add_filter('permalink_manager_uris', 'pm_ignore_uw_permalinks', 9);
Best regards,
Maciej
Hi @mbis
Sorry for the late response.
Thanks for providing a solution. @stefanmeyer2 please see if the above solution resolves the issue on your end.
Please feel free to re-open this thread by changing the topic status to “Not Resolved”.
Regards,
@champsupertramp The author of permalink manager (@mbis) will fix this issue with the next release and he provided a workaround.
Thanks very much everyone for the great support!
-
This reply was modified 5 years, 4 months ago by
stefanmeyer2.