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: Welcome Message  (Read 5757 times)

0 Members and 1 Guest are viewing this topic.

Andy Frogman

  • Coppermine novice
  • *
  • Country: au
  • Offline Offline
  • Gender: Male
  • Posts: 22
    • Ultima-Java: Creative Media
Welcome Message
« 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.

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Welcome Message
« Reply #1 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.
Logged

Andy Frogman

  • Coppermine novice
  • *
  • Country: au
  • Offline Offline
  • Gender: Male
  • Posts: 22
    • Ultima-Java: Creative Media
Re: Welcome Message
« Reply #2 on: August 15, 2011, 03:54:07 pm »

It won't show... This is my code:

Code: [Select]
<!-- 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 -->

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Welcome Message
« Reply #3 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
Code: [Select]
$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.
Logged

Andy Frogman

  • Coppermine novice
  • *
  • Country: au
  • Offline Offline
  • Gender: Male
  • Posts: 22
    • Ultima-Java: Creative Media
Re: Welcome Message
« Reply #4 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

Code: [Select]
$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?

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Welcome Message
« Reply #5 on: August 15, 2011, 05:04:56 pm »

So where in this file do I then place the new code?
It doesn't matter as long you put it somewhere between
Code: [Select]
<?phpand
Code: [Select]
?>

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.
Logged

Andy Frogman

  • Coppermine novice
  • *
  • Country: au
  • Offline Offline
  • Gender: Male
  • Posts: 22
    • Ultima-Java: Creative Media
Re: Welcome Message
« Reply #6 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?

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Welcome Message
« Reply #7 on: August 15, 2011, 05:14:27 pm »

Please use the zip format if possible (it's much more compatible than rar).
Logged

Andy Frogman

  • Coppermine novice
  • *
  • Country: au
  • Offline Offline
  • Gender: Male
  • Posts: 22
    • Ultima-Java: Creative Media
Re: Welcome Message
« Reply #8 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

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Welcome Message
« Reply #9 on: August 15, 2011, 05:59:01 pm »

Use the version which is attached to this post.
Logged

Andy Frogman

  • Coppermine novice
  • *
  • Country: au
  • Offline Offline
  • Gender: Male
  • Posts: 22
    • Ultima-Java: Creative Media
Re: Welcome Message
« Reply #10 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?

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Welcome Message
« Reply #11 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.
Logged

Andy Frogman

  • Coppermine novice
  • *
  • Country: au
  • Offline Offline
  • Gender: Male
  • Posts: 22
    • Ultima-Java: Creative Media
Re: Welcome Message
« Reply #12 on: August 15, 2011, 07:24:19 pm »

Cool, thanks very much :)
Pages: [1]   Go Up
 

Page created in 0.027 seconds with 20 queries.