Fix for “User Access Manager” for WordPress
Updated November 2016
Seems after all this time, this plugin still doesn't work as it should. If you are using User Access Manager for WP 4.6.1 and still have this issue, here is the fix:
- Open /wp-content/plugins/user-access-manager/class/UserAccessManager.class.php.
- Search for 'public function redirect' and replace this code:
$oObject = get_page_by_title($oPageParams->query_vars['pagename']);
with this code: $oObject = get_page_by_path($oPageParams->query_vars['pagename']);
Fix for older versions of WP below this:
If you happen to be using the "User Access Manager" in your WordPress install, and you are using Permalinks, then you will need this fix. Without it, the redirect for logged out users won't work, and they'll end up on a 404 page.
(Original link: Note that my code updates the fix for Wordpress 3.5.1 and up, and the latest UAM as of May 5th 2013)
- Open /wp-content/plugins/user-access-manager/class/UserAccessManager.class.php.
- Search for 'public function redirect' and replace this code:
if (isset($oPageParams->query_vars['p'])) {
$oObject = get_post($oPageParams->query_vars['p']);
$oObjectType = $oObject->post_type;
$iObjectId = $oObject->ID;
} elseif (isset($oPageParams->query_vars['page_id'])) {
$oObject = get_post($oPageParams->query_vars['page_id']);
$oObjectType = $oObject->post_type;
$iObjectId = $oObject->ID;
} elseif (isset($oPageParams->query_vars['cat_id'])) {
$oObject = get_category($oPageParams->query_vars['cat_id']);
$oObjectType = 'category';
$iObjectId = $oObject->term_id;
}
with this code: if (isset($oPageParams->query_vars['p'])) { $oObject = get_post($oPageParams->query_vars['p']); $oObjectType = $oObject->post_type; $iObjectId = $oObject->ID; } elseif (isset($oPageParams->query_vars['pagename'])) { $oObject = get_page_by_path($oPageParams->query_vars['pagename']); $oObjectType = $oObject->post_type; $iObjectId = $oObject->ID; } elseif (isset($oPageParams->query_vars['category_name'])) { $oObject = get_category_by_slug($oPageParams->query_vars['category_name']); $oObjectType = 'category'; $iObjectId = $oObject->term_id; }