Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Question User_name function  (Read 2615 times)

0 Members and 1 Guest are viewing this topic.

Schryvers

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 30
Question User_name function
« on: November 15, 2012, 02:02:34 am »

I have an Email form,

And i want the Username of the logged in person inserts automatically in the hidden input field.

So what i did:

On the page where the mailform is, i include Functions.inc.php

And the value of the hidden input is set on <? echo= $user_name ?>

Then, nothing gets there when i check it.

What i need to do?
Logged

Jeff Bailey

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1322
  • Fishing relaxes me.
    • Bailey Family Co.
Re: Question User_name function
« Reply #1 on: November 16, 2012, 02:39:12 am »

Please post the code that you have.
Logged
Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Question User_name function
« Reply #2 on: November 20, 2012, 10:58:50 am »

You don't need to include include/functions.inc.php, it's always included. However, the variable $user_name doesn't exist as you already noticed.

Instead, use $USER_DATA['user_name']. If that also doesn't work, add
Code: [Select]
global $USER_DATA;somewhere above.
Logged

GGFix

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Question User_name function
« Reply #3 on: December 30, 2012, 07:27:20 pm »

This is a useless thread since the code was excluded and is of no help to anyone???

Might have actually been of help to others ???
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Question User_name function
« Reply #4 on: January 02, 2013, 01:19:06 pm »

There hasn't been excluded anything from the thread. However, I think my post explains exactly how to get the current user's name.
Logged
Pages: [1]   Go Up
 

Page created in 0.023 seconds with 19 queries.