1
SorenBeck
Welcome *name* block
  • 2004/11/9 14:04

  • SorenBeck

  • Just popping in

  • Posts: 3

  • Since: 2004/11/7


Hi Xoopsters,

I have just downloaded XOOPS and played arround with it for a bit. It seems alot more complete, robust and simple than Nuke or PostNuke - congratulations - and please keep it that way :)

I would like to know if it is possible to keep people logged in (if they choose to) so they do not have to log in every time they come to the site.

I would also like to know if there is any block available that would say "Welcome *name*" - I need to steal some code from it.

If not - could someone tell me (I can code php) how to get a users name written inside a themes file. Or even better guide me to some propper documentations that explains all the classes and how they work. Especially the $xoopsTpl-> class.

Is there anyway I can can safely write code (my own functions etc.) and have them included without worring about them beeing deleted when I update to future versions of Xoops?

2
rcjohnson
Re: Welcome *name* block
  • 2004/11/9 14:41

  • rcjohnson

  • Not too shy to talk

  • Posts: 187

  • Since: 2004/7/23


Hi Soren,
Yes, XOOPS is awesome indeed, I tried about 10 other CMS style management systems, and XOOPS was by far the easiest to use and set up.

There is a hack that will allow your users to log in automatically when they visit, and it also allows you to set the duration they will be able to autologin. You can get it here.

Im not sure how to code it, but there are a few themes that display Welcome "Username", I know for sure that 7dana-jane theme has it. You can download this theme from their website: 7dana.

There is no telling what will be overwritten when you upgrade to new versions of xoops. Most of the more popular mod authors keep thier work up to date with the newest XOOPS code. Im quite sure that the CVS files are always available prior to updates, so you will always have good notice of at least the types of changes that will be taking place, and plan accordingly. (of course there is always a chance that any changes won't make it into the final release)

3
ackbarr
Re:Welcome *name* block

SorenBeck - if you want this in a XOOPS block you can create a new custom block like this:
Content Type: PHP
Cache lifetime: No Cache
Content:
global $xoopsUser;
if (
$xoopsUser) {
  
//User is logged in, display welcome message
  
$uname $xoopsUser->getVar('uname');
  echo(
"Welcome, $uname");
} else {
  return 
false;
}

If you want to display this information within your theme, XOOPS prefills a couple of handy smarty variables for you:
Quote:

{$xoops_isuser} - Page requested by a XOOPS user?
{$xoops_uname} - User name of current XOOPS user (empty if not XOOPS user)

So to add a section to your theme welcoming the current user:
<{if $xoops_isuser}>Welcome, <{$xoops_uname}><{/if}>

should do the trick.

There are more helpful smarty variables available to you. To see a full list, turn on smarty debugging in System -> Preferences -> General Settings and then view your XOOPS home page in a browser. A pop-up window will be displayed that displays all current smarty variables and their values.

4
ackbarr
Re:Welcome *name* block

also whenever you are developing a theme, turn on "Update module template .html files from themes/your theme/templates directory?" in System -> Preferences -> General Settings. This forces smarty to reparse your theme template when it is changed. If left off, smarty caches your theme and your changes will not be displayed.

5
SorenBeck
Re:Welcome *name* block
  • 2004/11/10 19:48

  • SorenBeck

  • Just popping in

  • Posts: 3

  • Since: 2004/11/7


Thanks guys - that solved the problems I had.

1. I was not informed via email that anyone had responded to my post - why is that?

2. I was told that:
Quote:
{$xoops_uname} - User name of current XOOPS user


But the pop up I get says that
Quote:

{$user}

Array (4)
avatar => empty
id => 1
name => sbe
joindate => 2004/11/7


So - how would I access the user name? Like this:
{$user['name']}

Just trying to understand :)

If the developers are reading this: I suggest that you in the core code include a file called "user_include.php" that way users like myself could write specific functions etc. that would never be changed when updating the core application. I have been forced to write mine in the header.php file and now I have to remember not to update that file when a new version of XOOPS is out.

6
poiinthepark
Re:Welcome *name* block

Hey Soren.

It works just the same if you add

<{if $xoops_isuser}>Welcome: <{$xoops_uname}><{/if}>
in your theme.html , that way you dont have to worry about changing your core files when you update them.

I've just done it to mine so i know it works fine, just some thing i wanted to keep from nuke and bring it to the new site.

enjoy.

7
coopersita
Re:Welcome *name* block

What if you don't want to use something other than the user name, let's say location (user_from)? And you didn't want to use a block?

How would you show the location in the theme?

8
ackbarr
Re:Welcome *name* block

you couldn't - only because the XOOPS core doesn't create the appropriate smarty variable to hold this information. The only user information that is supplied to smarty by the XOOPS core is:

xoops_isuser - Page requested by a logged in user?
xoops_uname - Current user's username
xoops_isadmin - Page requested by a site/module admin
xoops_userid - Current user's user id (uid)

These were the most common variables. If additional variables are needed, list which ones you are interested in, and we'll look at adding a patch to support them.

9
poiinthepark
Re:Welcome *name* block

Though i should contribute the code that i used for my website.

<{if $xoops_isuser}>Welcome: <{$xoops_uname}> 
                
to YOURSITE!!. Today is: <{/if}> 
                <!-- 
code for today's date -->
<SCRIPT language=javascript>



var day = new Object();

var mon = new Object();

date=new Date();

var y2000 = date.getFullYear();



day[0]="Sunday";

day[1]="Monday";

day[2]="Tuesday";

day[3]="Wednesday";

day[4]="Thursday";

day[5]="Friday";

day[6]="Saturday";

mon[0]="January";

mon[1]="February";

mon[2]="March";

mon[3]="April";

mon[4]="May";

mon[5]="June";

mon[6]="July";

mon[7]="August";

mon[8]="September";

mon[9]="October";

mon[10]="November";

mon[11]="December";





jahr=date.getFullYear();



document.write('
<font face=verdana size=1>' +day[date.getDay()]+", "+mon[date.getMonth()]+" "+date.getDate()+", " +jahr + '</font>&nbsp;&nbsp;');</SCRIPT>
                  &nbsp;&nbsp; </div>
        </form>


Just a little some thing, if people are like me and work all hours god send 7 days a week, then you forget what day it is!
enjoy, hope some one finds that helpful.

Login

Who's Online

241 user(s) are online (135 user(s) are browsing Support Forums)


Members: 0


Guests: 241


more...

Donat-O-Meter

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

Latest GitHub Commits