1
Anonymous
Showing user related info in theme
  • 2013/2/22 22:27

  • Anonymous

  • Posts: 0

  • Since:


I want to change a theme to adapt to the fact a user is online after loging in or not. And showing info not shown to anonymous users. This is my startingpoint, who can help me out? Showing the number of PM's (or not) would also be nice

                    <
nav>
                        <
ul>
                            <
li><class="active" href="<{$xoops_url}>">Homea><span>|span>li>
                            <
li><a href="<{$xoops_url}>/user.php">Logina><span>|span>li>
                            <
li><a href="<{$xoops_url}>/viewpmsg.php">PMa><span>|span>li>
                            <
li><a href="<{$xoops_url}>/user.php">Account infoa><span>|span>li>
                            <
li><a href="<{$xoops_url}>/modules/contact">Contacta><span>|span>li>
                        ul>
                    nav>
                    
I also like a welcome 'user x' message shown

2
zyspec
Re: Showing user related info in theme
  • 2013/2/23 2:15

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


flipse,

There's quite a few themes that do this using Smarty... I'd recommend you just 'grab' some of the code out of one of those as a starting poing. You can do things like:
<{if $xoops_isuser}> Welcome <{$xoops_uname}><{else}><a href='<{xoAppUrl user.php}>'>Logina><{/if}>


You can also use <{$xoops_isadmin}> to display info only for administrators, etc... There's a lot of other smarty variables you can use in the template to customize it. You can of course also make a custom block only visible to Admins, specific groups, etc. to display content for them only...

3
irmtfan
Re: Showing user related info in theme
  • 2013/2/23 3:29

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


Quote:

There's a lot of other smarty variables


yes.
eg:
<{xoInboxCount}> shows the user pm count.

4
Peekay
Re: Showing user related info in theme
  • 2013/2/23 14:53

  • Peekay

  • XOOPS is my life!

  • Posts: 2335

  • Since: 2004/11/20


Quote:
There's a lot of other smarty variables


Where are these listed now?

5
Anonymous
Re: Showing user related info in theme
  • 2013/2/23 15:31

  • Anonymous

  • Posts: 0

  • Since:


I have a starting point now, thanks guys!

6
Anonymous
Re: Showing user related info in theme
  • 2013/2/23 16:46

  • Anonymous

  • Posts: 0

  • Since:


I managed to make a nice header menu with controls for logged in users. This one does not work as supposed. It has to show a messages link (works) with new message count right behind it (fails). What's wrong?
<{if $xoops_isuser}><li><a href="<{$xoops_url}>/viewpmsg.php">Berichtena><a href='<{xoInboxCount}>'>a><{/if}><span>|span>li>

7
Mamba
Re: Showing user related info in theme
  • 2013/2/23 17:10

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


Quote:
Where are these listed now?

I think, this list is outdated, but it's a good start:
http://xoops-tips.com/modules/news/article.php?storyid=12
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

8
irmtfan
Re: Showing user related info in theme
  • 2013/2/24 3:28

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


huum. <{xoInboxCount}> is just return the number of unread pm but you put it in href.
the corect code would be something like this:
<{if $xoops_isuser}><li><class="pmcount<{xoInboxCount}>" href="<{$xoops_url}>/viewpmsg.php">Berichten(You have  <{xoInboxCount}> unread pm)a><span>|span>li><{/if}>


the best way to find all smarties in the current page is to turn smarty debug on and investigate it.


9
Anonymous
Re: Showing user related info in theme
  • 2013/2/24 12:38

  • Anonymous

  • Posts: 0

  • Since:


Thanks irmtfan, now it works!

Login

Who's Online

275 user(s) are online (137 user(s) are browsing Support Forums)


Members: 0


Guests: 275


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits