Die TYPO3 Mailingliste - nicht fragen: lesen!
This is a discussion on [TYPO3] php help in regards to frontend logins within the typo3-english@lists.netfielders.de forums, part of the TYPO3-Mailinglists: ENGLISH category; Hi I'm trying to make it so that the marker ###DOWNLOAD_LINK### within a php file only displays when a ...
|
|||||||
| Registrieren | Hilfe | Benutzerliste | Kalender | Suchen | Heutige Beiträge | Alle Foren als gelesen markieren |
|
#1
|
|||
|
|||
|
Hi I'm trying to make it so that the marker ###DOWNLOAD_LINK###
within a php file only displays when a frontend user (belonging to a specific group) is logged in so I added the line if ($HTTP_COOKIE_VARS["fe_typo_user"]) { to the following: if ($HTTP_COOKIE_VARS["fe_typo_user"]) { $this->markContentArray["###DOWNLOAD_LINK###"] = ''; if($this->conf['addDownloadLink']) { $this->markContentArray["###DOWNLOAD_LINK###"] = '<a href="' . $info['origFile'] . '"' . $target.$GLOBALS['TSFE']->ATagParams . '>download original image</a>'; } } but nothing worked, the ###DOWNLOAD_LINK### was still parsed, despite the user not being logged in. what else do i need to add in order to make it so that only logged in users see the parsed marker ? any help is appreciated. -Dave _______________________________________________ TYPO3-english mailing list TYPO3-english (AT) lists (DOT) netfielders.de http://lists.netfielders.de/cgi-bin/.../typo3-english |
|
#2
|
|||
|
|||
|
Hi Dave,
Wednesday, May 9, 2007, 12:09:20 PM, you wrote: > Hi I'm trying to make it so that the marker ###DOWNLOAD_LINK### > within a php file only displays when a frontend user (belonging to a > specific group) is logged in > so I added the line if ($HTTP_COOKIE_VARS["fe_typo_user"]) { To get the logged in user you can use the following code: $logged = $GLOBALS["TSFE"]->fe_user->user; $logged will contain an array with all the FE user informations. Regards, Mauro Lorenzutti e-mail: mauro.lorenzutti (AT) webformat (DOT) com --------------------------------------------------------- WEBFORMAT srl | Corte Europa, 12 | I-33097 SPILIMBERGO PN Tel +39-0427-926.389 -- Fax +39-0427-927.653 info (AT) webformat (DOT) com -- http://www.webformat.com --------------------------------------------------------- _______________________________________________ TYPO3-english mailing list TYPO3-english (AT) lists (DOT) netfielders.de http://lists.netfielders.de/cgi-bin/.../typo3-english |
|
#3
|
|||
|
|||
|
so are we looking at syntax like this?
if ($logged = $GLOBALS["TSFE"]->fe_user->user == 8) { $this->markContentArray["###DOWNLOAD_LINK###"] = ''; if($this->conf['addDownloadLink']) { $this->markContentArray["###DOWNLOAD_LINK###"] = '<a href="' . $info['origFile'] . '"' . $target.$GLOBALS['TSFE']->ATagParams . '>download original image</a>'; } } // also is 8 on the first line also be the uid of the user group? logically this looks like it makes sense to me... thanks again -dave On 5/9/07, Mauro Lorenzutti <mauro.lorenzutti (AT) webformat (DOT) com> wrote: > Hi Dave, > > Wednesday, May 9, 2007, 12:09:20 PM, you wrote: > > > Hi I'm trying to make it so that the marker ###DOWNLOAD_LINK### > > within a php file only displays when a frontend user (belonging to a > > specific group) is logged in > > > so I added the line if ($HTTP_COOKIE_VARS["fe_typo_user"]) { > > > To get the logged in user you can use the following code: > > $logged = $GLOBALS["TSFE"]->fe_user->user; > > $logged will contain an array with all the FE user informations. > > Regards, > Mauro Lorenzutti > > > e-mail: mauro.lorenzutti (AT) webformat (DOT) com > > --------------------------------------------------------- > WEBFORMAT srl | Corte Europa, 12 | I-33097 SPILIMBERGO PN > Tel +39-0427-926.389 -- Fax +39-0427-927.653 > info (AT) webformat (DOT) com -- http://www.webformat.com > --------------------------------------------------------- > _______________________________________________ > TYPO3-english mailing list > TYPO3-english (AT) lists (DOT) netfielders.de > http://lists.netfielders.de/cgi-bin/.../typo3-english > _______________________________________________ TYPO3-english mailing list TYPO3-english (AT) lists (DOT) netfielders.de http://lists.netfielders.de/cgi-bin/.../typo3-english |
|
#4
|
|||
|
|||
|
> if ($logged = $GLOBALS["TSFE"]->fe_user->user == 8) {
> $this->markContentArray["###DOWNLOAD_LINK###"] = ''; > if($this->conf['addDownloadLink']) { > $this->markContentArray["###DOWNLOAD_LINK###"] = '<a > href="' . $info['origFile'] . '"' . > $target.$GLOBALS['TSFE']->ATagParams . '>>download original image</a>'; > } > } > // also is 8 on the first line also be the uid of the user group? I think you have to write something like this: $logged = $GLOBALS["TSFE"]->fe_user->user; if ($logged['group'] == 8) { ... } I don't remember if 'group' is the correct key, you can see the whole array by adding this line: t3lib_div::debug($logged); And then you'll be sure about the correct key. Pay attention to the fact that a user can belong to more than one usergroup. For this reason your test can't be "==" but you have to use something like this: $usergroups = explode(',', $logged['group']); if (in_array(8, $usergroups)) { ... } Regards, Mauro Lorenzutti e-mail: mauro.lorenzutti (AT) webformat (DOT) com --------------------------------------------------------- WEBFORMAT srl | Corte Europa, 12 | I-33097 SPILIMBERGO PN Tel +39-0427-926.389 -- Fax +39-0427-927.653 info (AT) webformat (DOT) com -- http://www.webformat.com --------------------------------------------------------- _______________________________________________ TYPO3-english mailing list TYPO3-english (AT) lists (DOT) netfielders.de http://lists.netfielders.de/cgi-bin/.../typo3-english |
|
#5
|
|||
|
|||
|
hmm can't seem to see the key when typing in
t3lib_div::debug($logged); just says debug at the upper left hand corner with no array displayed. this is my code currently: $usergroups = explode(',', $logged['usergroups']); t3lib_div::debug($logged); if (in_array($8, usergroups)) { $this->markContentArray["###DOWNLOAD_LINK###"] = ''; if($this->conf['addDownloadLink']) { $this->markContentArray["###DOWNLOAD_LINK###"] = '<a href="' . $info['origFile'] . '"' . $target.$GLOBALS['TSFE']->ATagParams . '>download original image</a>'; } } this does not parse the ###DOWNLOAD_LINK### in the front end either, and its displayed as ###DOWNLOAD_LINK### (exactly as it is written) any more help? ![]() thanks -dave On 5/9/07, Mauro Lorenzutti <mauro.lorenzutti (AT) webformat (DOT) com> wrote: > > > if ($logged = $GLOBALS["TSFE"]->fe_user->user == 8) { > > $this->markContentArray["###DOWNLOAD_LINK###"] = ''; > > > if($this->conf['addDownloadLink']) { > > > $this->markContentArray["###DOWNLOAD_LINK###"] = '<a > > href="' . $info['origFile'] . '"' . > > $target.$GLOBALS['TSFE']->ATagParams . > '>>download original image</a>'; > > } > > } > > > > // also is 8 on the first line also be the uid of the user group? > > > > I think you have to write something like this: > > $logged = $GLOBALS["TSFE"]->fe_user->user; > > if ($logged['group'] == 8) { > ... > } > > I don't remember if 'group' is the correct key, you can see the whole > array by adding this line: > > t3lib_div::debug($logged); > > And then you'll be sure about the correct key. > > Pay attention to the fact that a user can belong to more than one > usergroup. For this reason your test can't be "==" but you have to use > something like this: > > $usergroups = explode(',', $logged['group']); > if (in_array(8, $usergroups)) { > ... > } > > Regards, > Mauro Lorenzutti > > > e-mail: mauro.lorenzutti (AT) webformat (DOT) com > > --------------------------------------------------------- > WEBFORMAT srl | Corte Europa, 12 | I-33097 SPILIMBERGO PN > Tel +39-0427-926.389 -- Fax +39-0427-927.653 > info (AT) webformat (DOT) com -- http://www.webformat.com > --------------------------------------------------------- > _______________________________________________ > TYPO3-english mailing list > TYPO3-english (AT) lists (DOT) netfielders.de > http://lists.netfielders.de/cgi-bin/.../typo3-english > _______________________________________________ TYPO3-english mailing list TYPO3-english (AT) lists (DOT) netfielders.de http://lists.netfielders.de/cgi-bin/.../typo3-english |
|
#6
|
|||
|
|||
|
> hmm can't seem to see the key when typing in
> t3lib_div::debug($logged); > just says debug at the upper left hand corner with no array displayed. > this is my code currently: > $usergroups = explode(',', $logged['usergroups']); > t3lib_div::debug($logged); > if (in_array($8, usergroups)) { > $this->markContentArray["###DOWNLOAD_LINK###"] = ''; > if($this->conf['addDownloadLink']) { > $this->markContentArray["###DOWNLOAD_LINK###"] = '<a > href="' . $info['origFile'] . '"' . > $target.$GLOBALS['TSFE']->ATagParams . '>>download original image</a>'; > } > } In your code I can't find the following line: $logged = $GLOBALS["TSFE"]->fe_user->user; Did you miss it? It must be the first line. Regards, Mauro Lorenzutti e-mail: mauro.lorenzutti (AT) webformat (DOT) com --------------------------------------------------------- WEBFORMAT srl | Corte Europa, 12 | I-33097 SPILIMBERGO PN Tel +39-0427-926.389 -- Fax +39-0427-927.653 info (AT) webformat (DOT) com -- http://www.webformat.com --------------------------------------------------------- _______________________________________________ TYPO3-english mailing list TYPO3-english (AT) lists (DOT) netfielders.de http://lists.netfielders.de/cgi-bin/.../typo3-english |
|
#7
|
|||
|
|||
|
dave typo wrote:
> if (in_array($8, usergroups)) { Think you mixed up which one has the $ ?? Can't help with anything else, sorry. -- Martin Mifsud _______________________________________________ TYPO3-english mailing list TYPO3-english (AT) lists (DOT) netfielders.de http://lists.netfielders.de/cgi-bin/.../typo3-english |
|
#8
|
|||
|
|||
|
yeah i did.
but even with that fixed, it still doesnt work $usergroups = explode(',', $logged['usergroups']); t3lib_div::debug($logged); if (in_array(8, $usergroups)) { $this->markContentArray["###DOWNLOAD_LINK###"] = ''; if($this->conf['addDownloadLink']) { $this->markContentArray["###DOWNLOAD_LINK###"] = '<a href="' . $info['origFile'] . '"' . $target.$GLOBALS['TSFE']->ATagParams . '>download original image</a>'; } } If you could just get me to get the debug to work, that would be great too thanks On 5/9/07, Martin Mifsud <martin.mifsud (AT) bikealert (DOT) com> wrote: > > > dave typo wrote: > > if (in_array($8, usergroups)) { > > Think you mixed up which one has the $ ?? > > Can't help with anything else, sorry. > > > -- > Martin Mifsud > _______________________________________________ > TYPO3-english mailing list > TYPO3-english (AT) lists (DOT) netfielders.de > http://lists.netfielders.de/cgi-bin/.../typo3-english > _______________________________________________ TYPO3-english mailing list TYPO3-english (AT) lists (DOT) netfielders.de http://lists.netfielders.de/cgi-bin/.../typo3-english |
| Themen-Optionen | Thema durchsuchen |
| Ansicht | Thema bewerten |
|
|
|
||||
| Thema | Autor | Forum | Antworten | Letzter Beitrag |
| [TYPO3-dev] Frontend clipboard | Tapio Markula | typo3-dev@lists.netfielders.de | 0 | 15.02.2007 21:58 |
| [TYPO3-dev] Frontend editing | Dan Frost | typo3-dev@lists.netfielders.de | 9 | 21.01.2007 01:02 |
| [TYPO3-german] bestimmtes Kontingent an Logins für Kunden | Stephan Bäcker | typo3-german@lists.netfielders.de | 2 | 22.12.2006 12:22 |
| [TYPO3] Blank frontend | Juan Madurga | typo3-english@lists.netfielders.de | 0 | 15.12.2006 11:59 |
| Re: [TYPO3] RTE -> no <a> tags in the frontend | Sander van Gelderen | typo3-english@lists.netfielders.de | 1 | 13.12.2006 10:22 |