Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Question User_name function  (Read 2614 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.02 seconds with 19 queries.