Frontpage guest Tweek

Social Joomla! template ideal to promote activities and discussion at various levels with JomSocial support.
GK User
Fri Oct 01, 2010 7:31 pm
Hi guys,

Here's what I did.

I wanted to have a message in the community home page only for guests, however, in the page frontpage.guests.php I only have the login form.
I was able to achieve what I wanted putting the code in page frontpage.index.php however it is visible to guests and logged in members.

I belive the code should be in page frontpage.guests.php so when the user is logged in the message does not show up.

How could I manage to have a message only for unregistered users?

Thank you very muchf for you help
User avatar
Junior Boarder

teitbite
Sat Oct 02, 2010 10:13 pm
Hi

I believe that You can put it into template with checking if the user got an ID. Like this:

Code: Select all
if( $user->get('id') ) {
msg here
}
User avatar
Moderator

GK User
Sun Oct 03, 2010 2:33 am
Hi Teitbite,

Thank you for the reply.

Actually I don't want it to be show to a specific use but to be bee shown to all users who have not logged yet, once they log in the piece of code I added is no longer displayed.

You gave me an idea with your if, I was wondering if I could put a if condition before the piece of code and check if the user is logged in, if yes then the code is not displayed.

Thank you
User avatar
Junior Boarder

teitbite
Sun Oct 03, 2010 8:38 pm
Hi

Not logged users will have user_id not set or "0".

Code: Select all
if( empty( $user->get('id') ) ) {
msg here
}


Should cover both conditions.
User avatar
Moderator

GK User
Mon Oct 04, 2010 3:00 am
Hi Teitbite,

Here's the code I have:

Code: Select all
<?php if( empty( $user->get('id') ) ) { ?>
          <div class="greybox">
            <div>
              <div>
                <div class="introduction">
                  <h1><?php echo JText::_('CC GET CONNECTED TITLE'); ?></h1>
                  <ul id="featurelist">
                    <li class="icon1 first-item"><span><?php echo JText::_('CC CONNECT AND EXPAND'); ?></span></li>
                    <li class="icon2"><span><?php echo JText::_('CC VEW PROFILES AND ADD FRIEND'); ?></span></li>
                    <li class="icon3"><span><?php echo JText::_('CC SHARE PHOTOS AND VIDEOS'); ?></span></li>
                    <li class="icon4 last-item"><span><?php echo JText::_('CC CREATE OWN GROUP OR JOIN'); ?></span></li>
                  </ul>
                  <div class="joinbutton">
                    <a id="joinButton" href="<?php echo CRoute::_( 'index.php?option=com_community&view=register' , false ); ?>" title="<?php echo JText::_('CC JOIN US NOW'); ?>">
                      <?php echo JText::_('CC JOIN US NOW'); ?>
                    </a>
                  </div>
                </div>
              </div>
            </div>
          </div>       
        <?php } ?>


I've placed it after
Code: Select all
<!-- begin: .cMain -->
       <div class="cMain clrfix">


But when I add this code
Code: Select all
<?php if( empty( $user->get('id') ) ) { ?>
<?php } ?>


I guet this error:
Fatal error: Can't use method return value in write context in /home/xxxxxxx/components/com_community/templates/gk_style/frontpage.index.php on line 255 (Line 255 is where I have the if condition)

I've annexed the file frontage.index.php

What am I doing wrong?

Thank you
User avatar
Junior Boarder

teitbite
Tue Oct 05, 2010 2:01 pm
Hi

You've done it ok, but I didn't thought You want it at jomsocial style file. The code I gave You will work inside the template code. I will need ftp access to see how the user id is handle inside this.
User avatar
Moderator

GK User
Tue Oct 05, 2010 4:35 pm
Hi Teitbite,

I sent you an email with the info you requested.

Thank you
User avatar
Junior Boarder

teitbite
Thu Oct 07, 2010 12:45 pm
Hi

Can You please also send me the address to the page where I can see this error ? I cannot find it ;/
User avatar
Moderator

GK User
Thu Oct 07, 2010 1:23 pm
Hi,

I was able to fix the problem.

I replaced <?php if( empty( $user->get('id') ) ) { ?> by <?php if( $my->id == 0 ) { ?>

When the user is not logged in he sees the message but when he logs in he doesn't see it anymore, I think the problem is solved.

Thank you
User avatar
Junior Boarder

teitbite
Fri Oct 08, 2010 12:35 am
Hi

It's good to know in which param the values are stored :) Thanks.
User avatar
Moderator


cron