[Typo3-dev] [PATCH] Better behavior of dkd_redirect_at_login

tonym at bvrmc.org tonym at bvrmc.org
Tue Jul 20 20:14:26 CEST 2004


Hello Ingmar,

I have modified your plugin dkd_redirect_at_login to check all of the users
groups for a redirect page.  Basically it works the same as before, but now
if the user's primary group doesn't have a redirect page, the next group
that does is used.  Also, if there is no redirect found, it will redirect to
the normal page (not '' like before).

Also in the patch is a small sync up with the latest version of newloginbox.

Please apply this and release a new version, unless you have any objections.
You can find the patch at
http://test.bvrmc.org/dkd_redirect_at_login-first_group_cleanup.patch if the
inline one gets mangled.

Tony Murray
Internet Specialist
Buena Vista Regional Medical Center
tonym at bvrmc.org

--- class.ux_tx_newloginbox_pi1.php.old	2004-07-20 12:21:58.000000000 -0500
+++ class.ux_tx_newloginbox_pi1.php	2004-07-20 13:10:54.274852000 -0500
@@ -6,6 +6,7 @@
  * @author	Kasper Skårhøj (kasper at typo3.com)
  * @author	Ingmar Schlecht (ingmars at web.de)
  * @author	Hans J. Martin <Hans-Jakob.Martin at gmx.net>
+ * @author	Tony Murray <tonymurray at fastmail.fm>
  * @package TYPO3
  * @subpackage ux_dkd_redirect_user_at_login
  */
@@ -34,8 +35,8 @@
 			// Loading language-labels
 		$this->pi_loadLL();
 		
-			// Converting flexform data into array:
-		$this->cObj->data['pi_flexform'] =
t3lib_div::xml2array($this->cObj->data['pi_flexform']);
+			// Init FlexForm configuration for plugin:
+		$this->pi_initPIflexForm();
 
 			// Get storage PIDs:
 		$d=$GLOBALS['TSFE']->getStorageSiterootPids();
@@ -108,21 +109,19 @@
 					if ($outH)
$content.='<h3>'.$outH.'</h3>';
 					if ($outC)
$content.='<p>'.$outC.'</p>';
 					
+//added for redirect 
+					$groupData =
$GLOBALS["TSFE"]->fe_user->groupData;
+					reset($groupData);
+					$query = "SELECT
tx_dkdredirectatlogin_redirectpage FROM
".$GLOBALS["TSFE"]->fe_user->usergroup_table." WHERE
tx_dkdredirectatlogin_redirectpage AND uid IN
(".implode(",",$groupData["uid"]).")";
+					$res = @mysql(TYPO3_db,$query);
+					if($row = mysql_fetch_array($res,
MYSQL_NUM)) {
+						($redirect_url)? '' :
$redirect_url = $this->pi_getPageLink($row[0]); //take the first group with
a redirect page
+					}
+
 					if
(!$GLOBALS['TSFE']->fe_user->cookieId)	{
 						$content.='<p
style="color:red;
font-weight:bold;">'.$this->pi_getLL('cookie_warning','',1).'</p>';
-					} elseif ($redirect_url || 1)	{
-
-//added for redirect 
-						$groupData =
$GLOBALS["TSFE"]->fe_user->groupData;
-						reset($groupData);
-
list(,$groupUid)=each($groupData["uid"]);
-						$query = "SELECT * FROM
".$GLOBALS["TSFE"]->fe_user->usergroup_table." WHERE uid=".$groupUid;
-						$res =
@mysql(TYPO3_db,$query);
-						$row =
mysql_fetch_assoc($res);
-						($redirect_url)? '' :
$redirect_url =
$this->pi_getPageLink($row["tx_dkdredirectatlogin_redirectpage"]);
-//						$redirect_url =
"index.php?id=".$row["tx_dkdredirectatlogin_redirectpage"];
+					} elseif ($redirect_url)	{
 						header('Location:
'.t3lib_div::locationHeaderUrl($redirect_url));
-#debug(t3lib_div::locationHeaderUrl($redirect_url));
 						exit;
 					}
 				} else {


	********************************************
This message and accompanying documents are covered by the Electronic
Communications Privacy Act, 18 U.S.C. §§ 2510-2521, and contain information
intended for the specified individual (s) only. This information is
confidential. If you are not the intended recipient or an agent responsible
for delivering it to the intended recipient, you are hereby notified that
you have received the document in error and that any review, dissemination,
copying, or the taking of any action based on the contents of this is
strictly prohibited. If you have received this communication in error,
please notify us immediately by email, and delete the original message.
	*********************************************






More information about the TYPO3-dev mailing list