Files

39 lines
696 B
PHP
Raw Permalink 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'] !== '' ) {
2015-11-05 19:51:31 +08:00
wp_logout();
exit( wp_redirect( $_REQUEST['redirect_to'] ) );
2014-12-15 22:38:07 +02:00
} else if ( um_user('after_logout') == 'redirect_home' ) {
2015-11-05 19:51:31 +08:00
wp_logout();
um_redirect_home();
2014-12-15 22:38:07 +02:00
} else {
2015-11-05 19:51:31 +08:00
wp_logout();
exit( wp_redirect( um_user('logout_redirect_url') ) );
2014-12-15 22:38:07 +02:00
}
2015-11-05 19:51:31 +08:00
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
}
}