TYPO3Jack.net - Das TYPO3 Mailinglist Forum Archiv

Die TYPO3 Mailingliste - nicht fragen: lesen!

[TYPO3] php help in regards to frontend logins

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 ...


Zurück   TYPO3Jack.net - Das TYPO3 Mailinglist Forum Archiv > TYPO3-Mailinglists: ENGLISH > typo3-english@lists.netfielders.de

Registrieren Hilfe Benutzerliste Kalender Suchen Heutige Beiträge Alle Foren als gelesen markieren
  #1  
Alt 09.05.2007, 12:09
dave typo
Gast
 
Beiträge: n/a
Standard [TYPO3] php help in regards to frontend logins

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!Spurl this Post!Reddit! Diesen Post bei linksilo.de bookmarken!
  #2  
Alt 09.05.2007, 12:32
Mauro Lorenzutti
Gast
 
Beiträge: n/a
Standard Re: [TYPO3] php help in regards to frontend logins

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!Spurl this Post!Reddit! Diesen Post bei linksilo.de bookmarken!
  #3  
Alt 09.05.2007, 14:33
dave typo
Gast
 
Beiträge: n/a
Standard Re: [TYPO3] php help in regards to frontend logins

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!Spurl this Post!Reddit! Diesen Post bei linksilo.de bookmarken!
  #4  
Alt 09.05.2007, 15:10
Mauro Lorenzutti
Gast
 
Beiträge: n/a
Standard Re: [TYPO3] php help in regards to frontend logins

> 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!Spurl this Post!Reddit! Diesen Post bei linksilo.de bookmarken!
  #5  
Alt 09.05.2007, 17:31
dave typo
Gast
 
Beiträge: n/a
Standard Re: [TYPO3] php help in regards to frontend logins

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!Spurl this Post!Reddit! Diesen Post bei linksilo.de bookmarken!
  #6  
Alt 09.05.2007, 17:40
Mauro Lorenzutti
Gast
 
Beiträge: n/a
Standard Re: [TYPO3] php help in regards to frontend logins

> 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!Spurl this Post!Reddit! Diesen Post bei linksilo.de bookmarken!
  #7  
Alt 09.05.2007, 17:44
Martin Mifsud
Gast
 
Beiträge: n/a
Standard Re: [TYPO3] php help in regards to frontend logins

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!Spurl this Post!Reddit! Diesen Post bei linksilo.de bookmarken!
  #8  
Alt 09.05.2007, 17:48
dave typo
Gast
 
Beiträge: n/a
Standard Re: [TYPO3] php help in regards to frontend logins

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!Spurl this Post!Reddit! Diesen Post bei linksilo.de bookmarken!
 

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an


Ähnliche Themen

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


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:26 Uhr.


Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74