x
Toggle Content    Register or Login  -  October 19, 2018, 3:55 am  
Toggle Content Commercial Themes
This is an opportunity for you to preview TCD commercial themes. All themes seen here can be purchased from the store.
Toggle Content User Info

Welcome Anonymous

Toggle Content Navigation
Toggle Content Project Status
Support Forums » DragonflyCMS » Tips & Tricks » Avatar or Private Messages in Header
Please use the forum search before making a post. Your question might have been previously answered.

Avatar or Private Messages in Header
Some of the best non-standard tricks for your site all in one location.


Post new topic   Reply to topic    Forum Index » Tips & Tricks Printer Friendly Page

View previous topic :: View next topic  
Author Message
Lead Developer


PostPosted: Mon Jul 10, 2006 9:12 pm Reply with quote

In Theme.php under function themeheader assign a global variable for $userinfo and $maincfg. So it would look something like this.

PHP:
function themeheader() {
global $slogan, $sitename, $banners, $mainindex, $adminindex, $cpgtpl, $site_logo, $userinfo, $CPG_SESS, $MAIN_CFG;

This goes in theme.php directly above $cpgtpl->assign_vars(array(
Code:
	$pm_active = is_active('Private_Messages');
		if ($pm_active) {
		$pm = $userinfo['user_new_privmsg']+$userinfo['user_unread_privmsg'];
		}
		// User Avatar 
		if ($userinfo['user_id'] > 1) {
			if ($userinfo['user_avatar_type'] == 1) {
			$avatar = $MAIN_CFG['avatar']['path'].'/'.$userinfo['user_avatar'];
			} else if ($userinfo['user_avatar_type'] == 2) {
			$avatar = $userinfo['user_avatar'];
			} else if ($userinfo['user_avatar_type'] == 3) {
			$avatar = $MAIN_CFG['avatar']['gallery_path'].'/'.$userinfo['user_avatar'];
			}
		} else {
		$avatar = 'images/avatars/gallery/blank.gif';
		}

Define the variable in theme.php
PHP:
	'T_PM_NUM'     => $pm,
'T_AVATAR' => $avatar,

In header.html or ANY template file ending with .html
Code:
<!-- IF S_IS_USER -->
		<a href="index.php?name=Your_Account&edit=avatar">
<img src="{T_AVATAR}" border="0" alt="Avatar" title="Edit Your Avatar"></a><br />
Private Messages: 
<a href="index.php?name=Private_Messages">{T_PM_NUM}</a>
		<!-- ELSE -->
		<img src="{T_AVATAR}" border="0" alt="Missing Image" title="Guest">
		<!-- ENDIF -->


_________________



Last edited by Devon on Wed Dec 29, 2010 2:32 am; edited 1 time in total
Back to top
View user's profile Photo Gallery
Lead Developer


PostPosted: Mon Aug 06, 2007 1:38 pm Reply with quote

A new addition has been created due to a request for customizable private message notification message. This is for the private message part only.

You can replace the standard "You have 0 messages" with a custom message such as "Read My Lips: No New Messages." Change the message to whatever you want.

Code:
	// New Private Messages?
		$pm_active = is_active('Private_Messages');
		if ($pm_active) {
		$pma = $userinfo['user_new_privmsg']+$userinfo['user_unread_privmsg'];
		}
		if ($userinfo['user_new_privmsg']+$userinfo['user_unread_privmsg']==0){
		$pm ="Read My Lips: No New Messages";
		} else {
		$pm= "You have ".$pma." new messages!";
		}


_________________

Back to top
View user's profile Photo Gallery
Newbie


PostPosted: Fri Oct 31, 2014 1:06 am Reply with quote

Can't believe it took someone that long to point that mistake out. The code I wrote would just spit you out to nowhere. Thanks for bringing it up. Of course when I wrote that for my own site I created it correctly. Translation can get messy sometimes.



______________________________


Back to top
View user's profile
  Page 1 of 1All times are GMT - 5 Hours

Post new topic   Reply to topic    Forum Index » Tips & Tricks Printer Friendly Page

  
  
  
 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


RSS-News
RSS-Downloads
RSS-Forums
RSS-KnowledgeBase
Valid CSS!
Valid HTML 4.01!

Site Search | Support | Contact | Payments | Link to Us
All TCD logos and trademarks in this site are property of TreasureCoastDesigns.com
Interactive software released under GNU GPL, Code Credits, Privacy Policy
TCD_Natural © T.C.D.