• Resolved stefanmeyer2

    (@stefanmeyer2)


    We get a reproducible redirect loop with the profile page since updating to UM 2.1.11. (see here for all details https://wordpress.org/support/topic/user-profile-redirect-bug-after-update/ – unfortunately we never got a feedback after updating the bug report…)

    Now we’ve been able to drill the issue down to an incompatibility with Permalink Manager Lite plugin that apparently got introduced with UM 2.1.11 (before everything worked fine). Permalink Manager is at 2.2.9.1 and hasn’t changed for quite a while.

    Hope this info helps to eliminate this very annoying bug.

    BTW: The “logout” issue also discussed at the link above could be eliminated by reassigning the logout page in UM>Settings>Pages again. Also an issue introduced with 2.1.11

    Thanks very much!

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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

    Plugin Contributor Champ Camba

    (@champsupertramp)

    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,

    Thread Starter stefanmeyer2

    (@stefanmeyer2)

    @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.
Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘UM and Permalink Manager Lite incompatibility (since UM 2.1.11)’ is closed to new replies.