show any kind of content in a page only to logged visitors

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
larissa
Posts: 39
Joined: Tue 31. Jul 2007, 23:18
Contact:

show any kind of content in a page only to logged visitors

Post by larissa »

I wonder if is possible to show content in a page only to logged visitor
I mean a tag like
[iflogged] any kind of content [/iflogged]
I have searched for this with no results at all
Any help is much appreciated
Thanks in advanc Larissa
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

KH_frontend_user

Post by flip-flop »

Hi,

at this moment we only can switch a category and his children for a frontend user to on/off.

Code: Select all

1. conf.inc.php:
------------------------------
$phpwcms['SESSION_FEinit']    = 1; // set 1 to enable sessions in frontend, 0 to disable sessions in frontend

Code: Select all

2. user administration: 
------------------------------
  login section: [x] frontend   [ ] backend   [ ] frontend and backend 
set user active: [x] if set the user can login
  user is admin: [ ] if set the user gets admin rights !!!
   verification: [/] send an email to new user with the account information 

Code: Select all

3. site structure (child of):
------------------------------
frontend menu status:
[ ] hide   [ ] visible when active   [x] visible for users logged on only 

status:
[x] visible   [x] public   [ ] SSL   [/] sitemap 
Please place the CP frontend login into a non hidden area.

Knut

[German Frontend Login: http://www.phpwcms.de/forum/viewtopic.php?p=94549#94549]
Last edited by flip-flop on Thu 8. Nov 2007, 15:52, edited 1 time in total.
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
larissa
Posts: 39
Joined: Tue 31. Jul 2007, 23:18
Contact:

show any kind of content in a page only to logged visitors

Post by larissa »

Thanks Knut your suggestions is what I am using at the moment but I found it a bit poor as solution:

My idea is the following :

in any page not logged user see only what not logged users are alllowed to see then in the same page when user is logged can see links or any kind of stuff that not logged can not see does it makes sense ?
In this I can add a any thing I want in a page i.e. 4images gallery allows to do it
it would be a big feature any chance t have it as an HAck
Many thanks Larissa
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Post by flip-flop »

At this moment we have no chance to do so. (There is no hack for solving your problem).
O:G. is writing an enhanced user management. We don´t know what feature he will insert.

Knut
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
larissa
Posts: 39
Joined: Tue 31. Jul 2007, 23:18
Contact:

show any kind of content in a page only to logged visitors

Post by larissa »

knut ,
shall I ask directly to O:G. ? what do you suggest
Many Thanks
Larissa
User avatar
flip-flop
Moderator
Posts: 8178
Joined: Sat 21. May 2005, 21:25
Location: HAMM (Germany)
Contact:

Post by flip-flop »

Yes, yes, do it. Have a call to him via eMail or Skype.

Knut
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
larissa
Posts: 39
Joined: Tue 31. Jul 2007, 23:18
Contact:

show any kind of content in a page only to logged visitors

Post by larissa »

Knut,
may be you can contact O. G. on my behalf,
You know him much better then me, moreover
I think this is a quite important issue and not too difficult to be implemented.

let me know
many thanks
LArissa
User avatar
Oliver Georgi
Site Admin
Posts: 9703
Joined: Fri 3. Oct 2003, 22:22
Location: Moscow, Russia
Contact:

Post by Oliver Georgi »

OK, here is the solution:

Open include/inc_front/content.func.inc.php and
place the following code snippet at the end but before the closing ?>

Code: Select all

// now clean up special sections in case user is logged in OR not
if(strpos($content['all'], '--LOGGED_')) {

	if( _getFeUserLoginStatus() ) {
		// if user IS logged in
		$content['all'] = str_replace(array('<!--LOGGED_IN_START//-->', '<!--LOGGED_IN_END//-->'), '', $content['all']);
		$content['all'] = replace_tmpl_section('LOGGED_OUT', $content['all']);	
	} else {
		// user is NOT logged
		$content['all'] = str_replace(array('<!--LOGGED_OUT_START//-->', '<!--LOGGED_OUT_END//-->'), '', $content['all']);
		$content['all'] = replace_tmpl_section('LOGGED_IN', $content['all']);
	}

}
If you are not sure how to handle this you can also place a new file login_status_render.php inside
template/inc_script/frontend_render with following content:

Code: Select all

<?php

// now clean up special sections in case user is logged in OR not
if(strpos($content['all'], '--LOGGED_')) {

	if( _getFeUserLoginStatus() ) {
		// if user IS logged in
		$content['all'] = str_replace(array('<!--LOGGED_IN_START//-->', '<!--LOGGED_IN_END//-->'), '', $content['all']);
		$content['all'] = replace_tmpl_section('LOGGED_OUT', $content['all']);	
	} else {
		// user is NOT logged
		$content['all'] = str_replace(array('<!--LOGGED_OUT_START//-->', '<!--LOGGED_OUT_END//-->'), '', $content['all']);
		$content['all'] = replace_tmpl_section('LOGGED_IN', $content['all']);
	}

}

?>
But use only one of my suggestions - the first solution is now part of phpwcms.

Oliver
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
larissa
Posts: 39
Joined: Tue 31. Jul 2007, 23:18
Contact:

show any kind of content in a page only to logged visitors

Post by larissa »

Oliveeerrrrrrrrrrr you are a magiciaaannnnnnnnnn first solution works as smoothly as silk
SMACK SMACK
Lari
User avatar
heliotrope
Posts: 33
Joined: Fri 14. Sep 2007, 15:21

Post by heliotrope »

Hello !
That's exactly what I'm looking for !!!

But what kind of tag should I use ????
I tried [LOGGED]
[IFLOGGED]
[LOGGEDIN]
and [LOGGED_IN] ...

But nothing works ...
Any idea ?????????

Thanks !!!
User avatar
update
Moderator
Posts: 6430
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Post by update »

something similarly to <!--LOGGED_IN_START//--> heyhey<!--LOGGED_IN_END//--> could be imagined ... :?:
User avatar
heliotrope
Posts: 33
Joined: Fri 14. Sep 2007, 15:21

Post by heliotrope »

yeah ! It works !!
Thanks Claus !!!
I've sometimes some problems to view evident things in code ... ;-)

I start understanding the way phpwcms is working...
Incredible tool !!!!!
Thanks again for your help !
User avatar
update
Moderator
Posts: 6430
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Post by update »

:oops: welcome!
User avatar
update
Moderator
Posts: 6430
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Re: show any kind of content in a page only to logged visitors

Post by update »

Yesterday I started using
<!--LOGGED_IN_START//-->heyhey<!--LOGGED_IN_END//-->
and
<!--LOGGED_OUT_START//-->oh-oh!<!--LOGGED_OUT_END//-->
in an extended way and must tell that this is really very 8)
:D
It's mostly all about maintaining two or three customer's sites Still supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.
Now building a venue for young artists to get wet on stage, rehearsal rooms, a studio, a guitar shop - yes I'm going to build some guitars.
pepe
Posts: 3954
Joined: Mon 19. Jan 2004, 13:46

Re: show any kind of content in a page only to logged visitors

Post by pepe »

Hi Claus...

you are able to use the switch inside the ContentParts to do the same thing "articlewide".

Your solution is for the templates.... to do it "sitewide".
Post Reply