Files
ultimatemember/core/um-logout.php
T

40 lines
705 B
PHP
Raw Normal View History

2014-12-15 22:38:07 +02:00
<?php
class UM_Logout {
function __construct() {
add_action('template_redirect', array(&$this, 'logout_page'), 10000 );
}
/***
*** @Logout via logout page
***/
function logout_page() {
2014-12-22 01:45:24 +02:00
if ( um_is_core_page('logout') ) {
2014-12-15 22:38:07 +02:00
if ( is_user_logged_in() ) {
if ( isset($_REQUEST['redirect_to']) && $_REQUEST['redirect_to'] !== '' ) {
2014-12-22 23:34:05 +02:00
$redirect_to = $_REQUEST['redirect_to'];
2014-12-15 22:38:07 +02:00
} else if ( um_user('after_logout') == 'redirect_home' ) {
2014-12-22 23:34:05 +02:00
$redirect_to = home_url();
2014-12-15 22:38:07 +02:00
} else {
2014-12-22 23:34:05 +02:00
$redirect_to = um_user('logout_redirect_url');
2014-12-15 22:38:07 +02:00
}
wp_logout();
2014-12-22 23:34:05 +02:00
exit( wp_redirect( $redirect_to ) );
2014-12-15 22:38:07 +02:00
} else {
2015-01-03 15:31:15 +02:00
um_redirect_home();
2014-12-15 22:38:07 +02:00
}
}
2014-12-22 01:45:24 +02:00
2014-12-15 22:38:07 +02:00
}
}