forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Miscellaneous => Topic started by: h3lium on January 14, 2005, 06:45:16 pm

Title: variable for the username
Post by: h3lium on January 14, 2005, 06:45:16 pm
hello,
first of all sorry for my english ;-) i'm a german, but i try to do my best...

im currently working on a guestbook for my gallery.
everything is working, exept of one thing, the user have to enter their names manually.
thats what i want to change.
but i dont know how to get the username.
does somebody know how to handle that?
i just need to set the current variable ($name - which the user have to fill in by a form) to the variable of the gallery...

it would be very cool if somebody could help me, cuz spend many hours for this allready :)

greeting
christian
Title: Re: variable for the username
Post by: Joachim Müller on January 14, 2005, 06:50:08 pm
this has been asked only recently - search the forum (for "guestbook").

Joachim
Title: Re: variable for the username
Post by: h3lium on January 14, 2005, 07:10:08 pm
sorry, i allready searched, and tried it again now, but i didnt found anything that could match...
thats also why i registered :) , usually i try to find anything befor i register...

in SMF (simply machines forum) its just a simple thing. like "$context['user']['name']"
and thats it...
is there nothing like this in coopermine?
Title: Re: variable for the username
Post by: Nibbler on January 14, 2005, 07:13:27 pm
If you can include init.inc.php then you have USER_NAME available. If you can't include it then you can use the authentication mod to give you the same.
Title: Re: variable for the username
Post by: h3lium on January 14, 2005, 07:19:04 pm
i included it...
 - require('include/init.inc.php');

and i'm using "$user['user_name']" but that doesn't work ...
i dont know why :(
Title: Re: variable for the username
Post by: Nibbler on January 14, 2005, 07:20:20 pm
Because there is no such variable! - that's why I said to use USER_NAME :)
Title: Re: variable for the username
Post by: h3lium on January 14, 2005, 07:24:53 pm
that doesnt work too :(
i donna why...


here is a small part of the code:

Code: [Select]
...
    <tr>
     <td><b>';
echo 'Name:';
     echo'</b></td>
     <td>';
echo $USER_NAME;
echo'</td>
    </tr>
    <tr>
...

Code: [Select]
require('include/init.inc.php');
Title: Re: variable for the username
Post by: Nibbler on January 14, 2005, 07:34:02 pm
I don't understand why you refuse to use USER_NAME

Code: [Select]
<?
define('IN_COPPERMINE', 1);
include 'include/init.inc.php';
echo USER_NAME;
?>
Title: Re: variable for the username
Post by: h3lium on January 14, 2005, 07:52:14 pm
uff...
now its working... :) thanks alot!!!
you really helped me!
problem is solved :)

greetings
chris
Title: Re: variable for the username
Post by: Joachim Müller on January 16, 2005, 05:01:29 am
you just found out what a php constant is ;) - see http://www.php.net/manual/en/language.constants.php

Joachim