Update ext/user/main.php
- Added board config option for user login forwarding - Set user_loginshowprofile default to 0 - now only applies when user is on a page containing post/ in its url (to avoid weird messages)
This commit is contained in:
		
							parent
							
								
									55b0919465
								
							
						
					
					
						commit
						c90689a63e
					
				| @ -146,7 +146,9 @@ class UserPage extends Extension { | |||||||
| 				$page->set_mode("redirect"); | 				$page->set_mode("redirect"); | ||||||
|                                  |                                  | ||||||
|                                 // Try forwarding to same page on logout unless user comes from registration page
 |                                 // Try forwarding to same page on logout unless user comes from registration page
 | ||||||
| 				if (isset($_SERVER['HTTP_REFERER']) && !strstr($_SERVER['HTTP_REFERER'], "user_admin/create")) | 				if ($config->get_int("user_loginshowprofile",0) == 0 &&  | ||||||
|  |                                     isset($_SERVER['HTTP_REFERER']) && | ||||||
|  |                                 strstr($_SERVER['HTTP_REFERER'], "post/")) | ||||||
|                                     $page->set_redirect ($_SERVER['HTTP_REFERER']); |                                     $page->set_redirect ($_SERVER['HTTP_REFERER']); | ||||||
|                                 else |                                 else | ||||||
|                                     $page->set_redirect(make_link()); |                                     $page->set_redirect(make_link()); | ||||||
| @ -279,6 +281,10 @@ class UserPage extends Extension { | |||||||
| 				"<br>Rating: "); | 				"<br>Rating: "); | ||||||
| 		} | 		} | ||||||
|                  |                  | ||||||
|  |                 $sb->add_choice_option("user_loginshowprofile", array( | ||||||
|  |                     "return to previous page" => 0, // 0 is default
 | ||||||
|  |                     "send to user profile" => 1), | ||||||
|  |                         "<br>When user logs in/out"); | ||||||
| 		$event->panel->add_block($sb); | 		$event->panel->add_block($sb); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| @ -319,6 +325,7 @@ class UserPage extends Extension { | |||||||
| // Things done *with* the user {{{
 | // Things done *with* the user {{{
 | ||||||
| 	private function login(Page $page)  { | 	private function login(Page $page)  { | ||||||
| 		global $user; | 		global $user; | ||||||
|  |                 global $config; | ||||||
| 
 | 
 | ||||||
| 		$name = $_POST['user']; | 		$name = $_POST['user']; | ||||||
| 		$pass = $_POST['pass']; | 		$pass = $_POST['pass']; | ||||||
| @ -337,11 +344,11 @@ class UserPage extends Extension { | |||||||
| 			$page->set_mode("redirect"); | 			$page->set_mode("redirect"); | ||||||
|                          |                          | ||||||
|                         // Try returning to previous page  
 |                         // Try returning to previous page  
 | ||||||
|                         if (isset($_SERVER['HTTP_REFERER']) && !strstr($_SERVER['HTTP_REFERER'], "user_admin/create") && |                         if ($config->get_int("user_loginshowprofile",0) == 0 &&  | ||||||
|                         !strstr($_SERVER['HTTP_REFERER'], "user_admin/login")) |                             isset($_SERVER['HTTP_REFERER']) &&  | ||||||
|                             $page->set_redirect ($_SERVER['HTTP_REFERER']); |                             strstr($_SERVER['HTTP_REFERER'], "post/")) | ||||||
| 			else |                                 $page->set_redirect($_SERVER['HTTP_REFERER']); | ||||||
|                             $page->set_redirect(make_link("user")); | 			else    $page->set_redirect(make_link("user")); | ||||||
| 		} | 		} | ||||||
| 		else { | 		else { | ||||||
| 			log_warning("user", "Failed to log in as ".html_escape($name)." [$hash]"); | 			log_warning("user", "Failed to log in as ".html_escape($name)." [$hash]"); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user