Changeset 4613
- Timestamp:
- 01/09/2017 05:43:43 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php
r4610 r4613 27 27 // Add notice to reply forms for privileged users in closed forums. 28 28 add_action( 'bbp_template_notices', array( $this, 'closed_forum_notice_for_moderators' ), 1 ); 29 30 // Fix login url links 31 add_filter( 'login_url', array( $this, 'fix_login_url' ), 10, 3 ); 29 32 } 30 33 … … 122 125 } 123 126 127 /** 128 * Adjust the login URL to point back to whatever part of the support forums we're 129 * currently looking at. This allows the redirect to come back to the same place 130 * instead of the main /support URL by default. 131 */ 132 public function fix_login_url( $login_url, $redirect, $force_reauth ) { 133 // modify the redirect_to for the support forums to point to the current page 134 if ( 0 === strpos($_SERVER['REQUEST_URI'], '/support' ) ) { 135 // Note that this is not normal because of the code in /mu-plugins/wporg-sso/class-wporg-sso.php. 136 // The login_url function there expects the redirect_to as the first parameter passed into it instead of the second 137 // Since we're changing this with a filter on login_url, then we have to change the login_url to the 138 // place we want to redirect instead, and then let the SSO plugin do the rest. 139 // 140 // If the SSO code gets fixed, this will need to be modified. 141 // 142 // parse_url is used here to remove any additional query args from the REQUEST_URI before redirection 143 // The SSO code handles the urlencoding of the redirect_to parameter 144 $url_parts = parse_url('https://wordpress.org'.$_SERVER['REQUEST_URI']); 145 $constructed_url = $url_parts['scheme'] . '://' . $url_parts['host'] . (isset($url_parts['path'])?$url_parts['path']:''); 146 $login_url = $constructed_url; 147 } 148 return $login_url; 149 } 150 124 151 }
Note: See TracChangeset
for help on using the changeset viewer.