WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.7 is now available!


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • I am clearly incredibly dumb but...
  • Print
Pages: [1]   Go Down

Author Topic: I am clearly incredibly dumb but...  (Read 5508 times)

Offline david doc watson

  • Posts: 88
I am clearly incredibly dumb but...
« on: February 20, 2011, 02:54:21 PM »
I want to create a simple Droplet and can't work out the Syntax.

I simply want to show the logged in user's name on the page. I've worked out that the variable I need is:
$_SESSION['USERNAME'].  But what exactly to I put into the drplete box?

return $_SESSION['USERNAME']

or something else.

Thanks
Logged

NorHei

  • Guest
Re: I am clearly incredibly dumb but...
« Reply #1 on: February 20, 2011, 04:42:53 PM »
Hmm, if variable is the right one i guess you forgot the ";" at the end  :-D

Code: [Select]
return $_SESSION['USERNAME'];
I would extend this a little bit.
Code: [Select]
if (isset($_SESSION['USERNAME'])) {return $_SESSION['USERNAME'];}
else {return 'Guest';}


As a session is only created if a user is logged in, you wil get an error messabe if the variable does not exist.
Logged

Offline david doc watson

  • Posts: 88
Re: I am clearly incredibly dumb but...
« Reply #2 on: February 21, 2011, 10:13:34 AM »
Genius,

Thank you so much, the semi-colon did the trick.

Thanks for the idea about the non-logged in user - in this case the page is within the 'client area' but your code will be really useful in the future.

Thanks
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • I am clearly incredibly dumb but...
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2