coppermine-gallery.com/forum

Support => cpg1.5.x Support => cpg1.5 themes (visuals) => Topic started by: Andy Frogman on August 13, 2011, 08:29:12 PM

Title: Welcome Message
Post by: Andy Frogman on August 13, 2011, 08:29:12 PM
I've done some very rigorous searching throughout the forum, however I've not been able to find an answer to this question, as similar as it may seem to others.

I want to add a welcome message, simply these two messages:

Guest User: "Welcome Guest!"
Registered User: "Welcome back, [username]!"

Now, simply manipulating the theme.php file I have been able to make the welcome messages change, however my problem is, I can't get the user name to display. I have a pair of screen shots here that demonstrate this. (Please note this is still under development.)

http://storage.ultima-java.com/frogman/misc/coppermine/loggedin.png

http://storage.ultima-java.com/frogman/misc/coppermine/loggedout.png

I need that [username] tag to actually become a the members user name. I know it's possible, because there is already a call for the username on the "logout" link.

Title: Re: Welcome Message
Post by: Αndré on August 15, 2011, 10:59:16 AM
The current user ID is always stored in the constant USER_ID. You can use it to get the user name from the database.
Title: Re: Welcome Message
Post by: Andy Frogman on August 15, 2011, 03:54:07 PM
It won't show... This is my code:

<!-- BEGIN contact -->
<tr>
<td align="center" colspan="2" style="font-size: 11px;">
Welcome back, {USER_ID}!
</td>
</tr>
<tr>
<td align="left" width="20px">
<img src="themes/creative_ver0.1/images/icon_mini_message.gif" border="0" />
</td>
<td align="right" style="font-size: 11px;">
<a href="{CONTACT_TGT}" title="{CONTACT_TITLE}"><span>{CONTACT_LNK}</span></a>
</td>
</tr>
<!-- END contact -->
Title: Re: Welcome Message
Post by: Αndré on August 15, 2011, 04:19:55 PM
That's not the way how it works. If you add a new token (that's what you did actually), you need to replace it within the function theme_main_menu in your theme.php file. Use something like
$cpg_udb->get_user_name(USER_ID)
or grab the user name with your own SQL query. The user ID stored in the constant USER_ID is just a number, not the user name.
Title: Re: Welcome Message
Post by: Andy Frogman on August 15, 2011, 04:45:09 PM
I'm sorry, could you explain that a bit better, I don't quite grasp what your saying. This is what I think you are telling me:

I can see that I've done something wrong and in order to get my token {USER_ID} or whatever I want it to be, to work, I have to add

$cpg_udb->get_user_name(USER_ID)

into the theme.php file. In order to do this I have to copy the data from themes.inc.php that deals with the main menu functions.

I imagine that is the one labelled "**Section <<<theme_main_menu>>> - START".

So where in this file do I then place the new code? Or have I misunderstood you?
Title: Re: Welcome Message
Post by: Αndré on August 15, 2011, 05:04:56 PM
Quote from: Andy Frogman on August 15, 2011, 04:45:09 PM
So where in this file do I then place the new code?
It doesn't matter as long you put it somewhere between
<?php
and
?>


I don't know how your theme looks like nor what you've already modified. If you need further assistance please attach your theme as zip file to your next reply.
Title: Re: Welcome Message
Post by: Andy Frogman on August 15, 2011, 05:09:21 PM
Ah that's a good point :P I haven't really made any major mods, and though the appearance has changed drastically, it's based off the Water Drop theme. It's still got a lot of work to go on it.

is .rar ok?
Title: Re: Welcome Message
Post by: Αndré on August 15, 2011, 05:14:27 PM
Please use the zip format if possible (it's much more compatible than rar).
Title: Re: Welcome Message
Post by: Andy Frogman on August 15, 2011, 05:20:05 PM
It's all good, I just had a .rar file already uploaded.

Here it is: http://storage.ultima-java.com/frogman/misc/creative_ver0.1.zip
Title: Re: Welcome Message
Post by: Αndré on August 15, 2011, 05:59:01 PM
Use the version which is attached to this post.
Title: Re: Welcome Message
Post by: Andy Frogman on August 15, 2011, 06:12:28 PM
Thanks very much. I appreciate that!

I can see what you've done here, would it be the same process to call the Avatar from the phpBB3.x forums? Or will that require a totally new query?
Title: Re: Welcome Message
Post by: Αndré on August 15, 2011, 07:20:57 PM
I doubt that a function exists that get the avatar from the database, but I simply don't know. Have a look at the appropriate bridge file. If not, you have to query the database to get the user avatar path.
Title: Re: Welcome Message
Post by: Andy Frogman on August 15, 2011, 07:24:19 PM
Cool, thanks very much :)