Last active
October 31, 2018 09:17
-
-
Save mikeyhoward1977/41ffb28f1a67af976f2f30a130c59bf8 to your computer and use it in GitHub Desktop.
Redirect agents to ticket admin when they login via the Ticket Manager front end
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Redirect agents to the ticket admin screen. | |
* | |
* Effective when agents login via the KBS front end login form. | |
* | |
* @param string $redirect_to The redirect URL | |
* @param int $user_id ID of user logging in | |
* @return string Redirect URL | |
*/ | |
function kbs_agent_redirect_to_admin_ticket_screen( $redirect_to, $user_id ) { | |
if ( kbs_is_agent( $user_id ) ) { | |
$redirect_to = add_query_arg( array( | |
'post_type' => 'kbs_ticket' | |
), admin_url( 'edit.php' ) ); | |
} | |
return $redirect_to; | |
} | |
add_filter( 'kbs_login_redirect', 'kbs_agent_redirect_to_admin_ticket_screen', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment