Script to display username or name..
- flazai
- Joomla! Fledgling
- Posts: 4
- Joined: Fri Dec 19, 2008 8:59 am
- Contact:
Script to display username or name..
Hi guys,
Just asking whether u can tell me a session code or any script on how to display username at my custom page after logon at main page. I did a wrapper link in my Joomla!.
my Joomla! version is 1.5.
Thanks..
Just asking whether u can tell me a session code or any script on how to display username at my custom page after logon at main page. I did a wrapper link in my Joomla!.
my Joomla! version is 1.5.
Thanks..
-
- Joomla! Explorer
- Posts: 331
- Joined: Mon Aug 04, 2008 8:00 am
- Location: India
- Contact:
Re: Script to display username or name..
$user =& JFactory:;getUser();
echo $user->username;
you can create a module....and insert it in your page
echo $user->username;
you can create a module....and insert it in your page
Sumeet Shroff
PSD to Joomla, Joomla Custom Template Design and Virtuemart Shopping Cart
http://www.prateeksha.com http://www.joomlawebsitedesigners.com
PSD to Joomla, Joomla Custom Template Design and Virtuemart Shopping Cart
http://www.prateeksha.com http://www.joomlawebsitedesigners.com
- flazai
- Joomla! Fledgling
- Posts: 4
- Joined: Fri Dec 19, 2008 8:59 am
- Contact:
Re: Script to display username or name..
Dear Prateeksha,
Thanks for your help..
Thanks for your help..
-
- Joomla! Enthusiast
- Posts: 135
- Joined: Fri May 02, 2008 11:57 pm
Re: Script to display username or name..
I did just that.
I downloaded a php module that can display php code. I set that to a new userlocation and did the moduleposition command in joomla to be put inside an article. Here is the code I used:
And here is what is shown on the screen in joomla:
and this is what I get
Also the following code just produces a blank spot
Any ideas what I am missing here?
I downloaded a php module that can display php code. I set that to a new userlocation and did the moduleposition command in joomla to be put inside an article. Here is the code I used:
Code: Select all
$user =& JFactory:;getUser();
echo $user->username;
I also use a different approach and actually put in the php codes here:Welcome
$user =& JFactory:;getUser(); echo $user->username;
Code: Select all
<?php
$user =& JFactory:;getUser();
echo $user->username;
?>
Parse error: syntax error, unexpected ':', expecting T_PAAMAYIM_NEKUDOTAYIM in /home/p242rp0j/public_html/modules/mod_jumi/tmpl/default.php(12) : eval()'d code on line 2
Also the following code just produces a blank spot
Code: Select all
<?php echo $name->username; ?>
-
- Joomla! Explorer
- Posts: 331
- Joined: Mon Aug 04, 2008 8:00 am
- Location: India
- Contact:
Re: Script to display username or name..
yes...my mistake... there was a ; (semicolon) instead of a :colon near getUser();
try this
<?php
$user =& JFactory::getUser();
echo $user->username;
?>
try this
<?php
$user =& JFactory::getUser();
echo $user->username;
?>
Sumeet Shroff
PSD to Joomla, Joomla Custom Template Design and Virtuemart Shopping Cart
http://www.prateeksha.com http://www.joomlawebsitedesigners.com
PSD to Joomla, Joomla Custom Template Design and Virtuemart Shopping Cart
http://www.prateeksha.com http://www.joomlawebsitedesigners.com
-
- Joomla! Enthusiast
- Posts: 135
- Joined: Fri May 02, 2008 11:57 pm
Re: Script to display username or name..
There is a line break above and below the actual username. IS there a formatting issue in the php code, or my module inside my article?
- ivan_mef
- Joomla! Fledgling
- Posts: 2
- Joined: Wed Sep 23, 2009 3:00 am
- Location: Split, Croatia
- Contact:
Re: Script to display username or name..
Hi!
My english is not so good, sorry.
I have question for you, for experts!
I have joomla 1.5 on hosting server, everithings worg great but now I make one upload php script and upload them to my server with static (public) IP adress (now i live in one student campus, admin geave me that adress). These two server separated!!! Upload script, when user upload file, send email to admin (me) with informations about file (filesize, extenzion, filename...). Problem is here: Only log in users have permisions for uploading files (upload page put in joomla with wrapper. When user login, upload page shown in menu). I need to my external ''upload'' php script use, when sending mail to admin, joomla variable ''$user->username'', and when send mail to admin, send ''who'' upload file->''username'' with other data.
P.S. Neither joomla upload plugin or module doesnt fits our needs!! Only work with thath php script.
Thanks!!!
My english is not so good, sorry.
I have question for you, for experts!
I have joomla 1.5 on hosting server, everithings worg great but now I make one upload php script and upload them to my server with static (public) IP adress (now i live in one student campus, admin geave me that adress). These two server separated!!! Upload script, when user upload file, send email to admin (me) with informations about file (filesize, extenzion, filename...). Problem is here: Only log in users have permisions for uploading files (upload page put in joomla with wrapper. When user login, upload page shown in menu). I need to my external ''upload'' php script use, when sending mail to admin, joomla variable ''$user->username'', and when send mail to admin, send ''who'' upload file->''username'' with other data.
P.S. Neither joomla upload plugin or module doesnt fits our needs!! Only work with thath php script.
Thanks!!!
-
- Joomla! Apprentice
- Posts: 5
- Joined: Sun Dec 20, 2009 12:27 am
Re: Script to display username or name..
OK, so I've been able to get it to echo the username, name, id, etc. successfully, but I'm wondering if there is a way to use that username variable when calling a module. For example, I'm a photographer and I'd like to show clients their proofs using the YOOgallery module. When user bobandmarie logs in, it should show all the images in the /clients/proofs/bobandmarie folder. The syntax for calling the module is {yoogallery src=[/clients/proofs/username]} I want it to replace "username" with the username of whoever is currently logged in (in this example bobandmarie). How do I do that? I've tried:
$user =& JFactory::getUser();
$row->text = str_replace('username', $user->username, $row->text);
but that doesn't seem to do anything at all. Please help!
P.S. As a disclaimer, I only know enough PHP to get myself into trouble.
$user =& JFactory::getUser();
$row->text = str_replace('username', $user->username, $row->text);
but that doesn't seem to do anything at all. Please help!
P.S. As a disclaimer, I only know enough PHP to get myself into trouble.
-
- Joomla! Apprentice
- Posts: 31
- Joined: Thu May 16, 2013 7:42 am
Re: Script to display username or name..
Which file do put the code into? could you please explain in details as I am new in this. thanks heaps
-
- Joomla! Fledgling
- Posts: 3
- Joined: Wed Jun 19, 2013 10:39 am
Re: Script to display username or name..
You must install an extension which can display php code. normal html module cannot make it...