More Member info in Header

I know this has probably been asked, but I cant find it (and yes MyDatery, I used the search entire forum option)

But I want to know if there is a simple way to show more member information in the header, where it says "Hello, Member"

I know there is the links to My Account, My Mail, etc, but is there a way to have it, maybe, show how many mail messages you have, or if you have a friend request, or more detailed info like that.

I thought I saw something on Expertzzz, but that site is a little hard to navigate and I cant find it again.

Thanks for the help.

Cory

Quote · 16 Aug 2009

I think what I am realy looking for is a way to have the "Contacts" block in My Account show in the header under the Hello Member text.

Something like this:

Thanks.

Cory

Quote · 17 Aug 2009

I GOT IT!!!

In tmpl_uni/scripts/functions.php

After: <span><a href="<?= $site['url'] ?>logout.php?action=member_logout"><?= _t('_Log Out2') ?></a></span>

Insert:

<table width="300" align="right" cellpadding="1" cellspacing="0" class="control_panel_table">
<tr class="table">
<td class="control_panel_td_1_first" valign="top" align="left"><? echo _t( "_Messages" ); ?>:</td>
<td class="control_panel_td_2_first" valign="top" align="left"><?
if ( $mess )
echo _t( "_ATT_MESSAGE", $mess, $sSiteUrl );
else
echo _t( "_ATT_MESSAGE_NONE", $sSiteUrl );?>
</td>
</tr>
<tr class="table">
<td class="control_panel_td_1" valign="top" align="left"><? echo _t( "_Kisses" ); ?>:</td>
<td class="control_panel_td_2" valign="top" align="left"><?
if ( $vkiss )
echo _t( "_ATT_VKISS", $sSiteUrl );
else
echo _t( "_ATT_VKISS_NONE", $sSiteUrl );?>
</td>
</tr>
<tr class="table">
<td class="control_panel_td_1" valign="top" align="left"><? echo _t( "_Friends" ); ?>:</td>
<td class="control_panel_td_2" valign="top" align="left"><?
if ( $frd )
echo _t( "_ATT_FRIEND", $sSiteUrl );
else
echo _t( "_ATT_FRIEND_NONE", $sSiteUrl );?>
</td>
</tr>
</table>

Needs some formatting, but it seems to work.

Cory

Quote · 17 Aug 2009

Ok, still missing something, not updating if user gets an email or friend request.

Quote · 17 Aug 2009

Ok, I tried adding:

<?     // new messages attention
$new_mess_arr = db_arr( "SELECT ID FROM `Messages` WHERE Recipient = {$iChMemberID} AND New = '1' ORDER BY Date DESC LIMIT 1" );
if ( $new_mess_arr )
$mess = $new_mess_arr[ID];

// new kisses attention
$new_kiss_arr = db_arr( "SELECT ID FROM `VKisses` WHERE Member = {$iChMemberID} AND New = '1' LIMIT 1" );
if ( $new_kiss_arr )
$vkiss = 1;

// new friends attention
$new_friend_arr = db_arr( "SELECT `ID` FROM `FriendList` WHERE `Profile` = {$iChMemberID} AND  `Check` = '0' LIMIT 1" );
if ( $new_friend_arr )
$frd = 1;

ob_start();

?>

But keep getting error:

Database query error
Query:
SELECT ID FROM `VKisses` WHERE Member = AND New = '1' LIMIT 1
Mysql error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND New = '1' LIMIT 1' at line 1

Again, I am not a programmer, just someone who can copy and paste.

Any help would be great.

Thanks.

Cory
Quote · 17 Aug 2009

{$iChMemberID} is not getting replaced with the member id.

You may want to set a php var with the member id like so.

$curMemID=(int)$_COOKIE['memberID'];

Then use that $curMemID variable where ever you need the member id.

Also you may prefer to return a count of the VKisses or messages instead of just one as you have it now.

Try a query like this.

$new_kiss_arr = db_arr("SELECT COUNT(`ID`) AS `count_VK` FROM `VKisses` WHERE `Member` = '$curMemID' and `New` = '1'");

$totalVKisses=intval($new_kiss_arr['count_VK']);

https://www.deanbassett.com
Quote · 17 Aug 2009

{$iChMemberID} is not getting replaced with the member id.

You may want to set a php var with the member id like so.

$curMemID=(int)$_COOKIE['memberID'];

Then use that $curMemID variable where ever you need the member id.

Also you may prefer to return a count of the VKisses or messages instead of just one as you have it now.

Try a query like this.

$new_kiss_arr = db_arr("SELECT COUNT(`ID`) AS `count_VK` FROM `VKisses` WHERE `Member` = '$curMemID' and `New` = '1'");

$totalVKisses=intval($new_kiss_arr['count_VK']);

Thanks. After changing the $curMemID it seemed to remove the database error, however, it still wont show the number ofnew messages, friends, or other.

When I try to put in the last query you suggested, I get database errors again. What would the "count_VK" be in the new messages or new friends line?

Thanks.

Cory

Quote · 17 Aug 2009

countVK is not in the database, it is used to assign the count value to. Like SELECT COUNT(`ID`) AS `count_VK`


The AS tells it to assign the count AS that array item. then the from is the query.



Show me your code.

https://www.deanbassett.com
Quote · 17 Aug 2009

Actually, where are you editing this.

I know what file your in, but what function?


Should be in function HelloMemberSection()

And this is the origional block of code.


if( $logged['member'] )
{
$memberID = (int)$_COOKIE['memberID'];
$iLet = getNewLettersNum($memberID);
$sNewLet = $iLet > 0 ? '<b>('.$iLet.')</b>' : '' ;
?>
<div class="topMemberBlock">
<?= get_member_icon( $memberID, 'right' ) ?>
<div class="hello_member"><?= _t( '_Hello member', getNickName( $memberID ) ) ?></div>

<div class="hello_actions">
<span><a href="<?= $site['url'] ?>member.php"><?= _t('_My account') ?></a></span>
<span><a href="<?= $site['url'] ?>mail.php?mode=inbox"><?= _t('_My Mail') ?></a><?=' '.$sNewLet;?></span>
<span><a href="<? echo getProfileLink( $memberID ) ?>"><?= _t('_My Profile') ?></a></span>
<span><a href="javascript:void(0);"
onclick="window.open( '<?= $site['url'] ?>presence_pop.php' , 'Presence', 'width=260,height=600,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=0,resizable=1');"
><?= _t('_RayPresence') ?></a></span>
<span><a href="<?= $site['url'] ?>logout.php?action=member_logout"><?= _t('_Log Out2') ?></a></span>
</div>
</div>
<?
}



This is where you should be making your changes.

https://www.deanbassett.com
Quote · 17 Aug 2009

I guess i should also ask what version of dolphin your running. In 6.1.6 the code to show the  number of new emails waiting after the My Mail link is already in there.

https://www.deanbassett.com
Quote · 17 Aug 2009

Yes, running Dolphin 6.16. I see the mail thing, but I wanted friends and greetings in there as well.

I took the code from the Contacts block of members.php and added it to the Hello Member function area of functions.php:

This part put what I wanted into the Hello Members section, but didnt update the mail, friends, or greetings lines. I figured it needed that other code in there as well, but trying to put that in gave me errors.

Again, I am not a programmer, just someone who can copy and paste and do a lot of trial and error.

Quote · 17 Aug 2009

Yes, running Dolphin 6.16. I see the mail thing, but I wanted friends and greetings in there as well.

I took the code from the Contacts block of members.php and added it to the Hello Member function area of functions.php:

This part put what I wanted into the Hello Members section, but didnt update the mail, friends, or greetings lines. I figured it needed that other code in there as well, but trying to put that in gave me errors.

Again, I am not a programmer, just someone who can copy and paste and do a lot of trial and error.

If you tell me what you want in the hello members section i can write the code for you. I kinda need to visulize what the line is to look like before i code it.


https://www.deanbassett.com
Quote · 17 Aug 2009

See Email below

Quote · 17 Aug 2009

Even if it is easier, to have something that will just show an icon if you have a new friend request, or greeting, or mail.

Actually, I will post an image of what I am looking for in a few minutes.

\Cory

Quote · 17 Aug 2009

Something like that, if possible, would be nice. To show the mail and friend icon, and if new requests are pending, have it have a number next to it.

If no new friends or emails, the icons can stay, or maybe have a different icon show up if no new requests. Either way, have the icon link to their Mail and Friend lists, and have the numbers link to the Inbox and New Friend Request page.

These are the two main icons I want, but I guess a new greeting and kiss icon would be nice too.

I guess something like (I am not a programmer, but somewhat of a schematic layout here?):

If New Mail

then Display number of messages new and new_mail.jpg

else display mail.jpg

Same for friends, greetings, kiss, etc.

It would be amazing if you can get this to work for me. I will probably be having a lot of these kind of little features added as my site progresses, and if I can find someone who can do them, there will be a budget to do so eventually. Right now the site is just getting going, so as you probably know, there isnt any money coming in for it, but I suspect there will be soon.

Quote · 17 Aug 2009

Oh, and I will create the icons, just need the code.

Quote · 17 Aug 2009

Did you increase the height of the topmember block already to make room for those icons under it?

https://www.deanbassett.com
Quote · 17 Aug 2009

I did, it is actually the same height as the sample image, so there is plenty of room.

Cory

Quote · 17 Aug 2009

Ok. I'll design it to use 8 icons.

4 grayed icons for nothing pending.

4 Normal icons for pending messages.

I will set them up in the following order.

Mail Messages

Friend Requests

Greetings

Vkisses.

I'll let you know when it's done. Should not take long. It's rather simple.

https://www.deanbassett.com
Quote · 17 Aug 2009

Oh, and what size icons you going to use.

Standard sizes are

16x16

22x22

24x24

32x32

48x48

72x72

128x128

I recommend no larger than 24x24 would be best without looking to bulky. But it's your choice.

https://www.deanbassett.com
Quote · 17 Aug 2009

Lets go 32x32, I want them to be somewhat large, but as you said, not to bulky.

Thanks again.

Cory

Quote · 17 Aug 2009

I changed it to 4 icons. Something has come up, and i am out of time. But this should give you enough to go by.

The areas marked is the code i added.



function HelloMemberSection()
{
global $logged;
global $site;

global $tmpl;  /* Deano Mod Add */

ob_start();

if( $logged['member'] )
{
$memberID = (int)$_COOKIE['memberID'];
$iLet = getNewLettersNum($memberID);
$sNewLet = $iLet > 0 ? '<b>('.$iLet.')</b>' : '' ;

/* Deano Mod Add Begin */
$sqlQuery = "SELECT COUNT(`Recipient`) FROM `Messages` WHERE `Recipient`='$memberID' AND `New`='1'";
$iFreqNum = db_value($sqlQuery);
$sqlQuery = "SELECT COUNT(`Profile`) FROM `FriendList` WHERE `Profile`='$memberID' AND `Check`='0'";
$iGreetNum = db_value($sqlQuery);
$sqlQuery = "SELECT COUNT(`Member`) FROM `VKisses` WHERE `Member`='$memberID' AND `New`='1'";
$iVkissNum = db_value($sqlQuery);
/* Deano Mod Add End */


?>
<div class="topMemberBlock">
<?= get_member_icon( $memberID, 'right' ) ?>
<div class="hello_member"><?= _t( '_Hello member', getNickName( $memberID ) ) ?></div>

<div class="hello_actions">
<span><a href="<?= $site['url'] ?>member.php"><?= _t('_My account') ?></a></span>
<span><a href="<?= $site['url'] ?>mail.php?mode=inbox"><?= _t('_My Mail') ?></a><?=' '.$sNewLet;?></span>
<span><a href="<? echo getProfileLink( $memberID ) ?>"><?= _t('_My Profile') ?></a></span>
<span><a href="javascript:void(0);"
onclick="window.open( '<?= $site['url'] ?>presence_pop.php' , 'Presence', 'width=260,height=600,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=0,resizable=1');"
><?= _t('_RayPresence') ?></a></span>
<span><a href="<?= $site['url'] ?>logout.php?action=member_logout"><?= _t('_Log Out2') ?></a></span>
</div>

<!-- Deano mod add begin -->
<div style="padding-left: 100px">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<img border="0" src="<?= "{$site['url']}templates/tmpl_$tmpl/images/icons/email.png" ?>">
</td><td>&nbsp;(<?php echo $iLet ?>)</td><td width="10">&nbsp;</td><td>
<img border="0" src="<?= "{$site['url']}templates/tmpl_$tmpl/images/icons/friends.png" ?>">
</td><td>&nbsp;(<?php echo $iFreqNum ?>)</td><td width="10">&nbsp;</td><td>
<img border="0" src="<?= "{$site['url']}templates/tmpl_$tmpl/images/icons/greetings.png" ?>">
</td><td>&nbsp;(<?php echo $iGreetNum ?>)</td><td width="10">&nbsp;</td><td>
<img border="0" src="<?= "{$site['url']}templates/tmpl_$tmpl/images/icons/vkisses.png" ?>">
</td><td>&nbsp;(<?php echo $iVkissNum ?>)</td><td width="10">&nbsp;
</td>
</tr>
</table>
</div>
<!-- Deano mod add end -->



</div>
<?
}




This should get you started.

https://www.deanbassett.com
Quote · 18 Aug 2009

Dean, YOU ARE A GENIOUS!!!!!!!!

Thank you so much, that is exactly what I have been looking for. Thank you thank you thank you!!

Cory

Quote · 18 Aug 2009

You are an evil genius, but one problem, the images or numbers cant be clicked on. I will see if I can figure it out, but if you ever have time to revisit this, that would be great.

Cory

Quote · 18 Aug 2009

I just ended up linking the images to their respective areas, works fine.

Quote · 18 Aug 2009

Yea, i forgot to add links.

I will show you one real quick. This one.

<img border="0" src="<?= "{$site['url']}templates/tmpl_$tmpl/images/icons/email.png" ?>">

Change to this.

<a href="mail.php?mode=inbox"><img border="0" src="<?= "{$site['url']}templates/tmpl_$tmpl/images/icons/email.png" ?>"></a>

Repeat for each icon image making sure the link has the correct page.

https://www.deanbassett.com
Quote · 18 Aug 2009

See, quite easy. Guess you did not need my help there.


https://www.deanbassett.com
Quote · 18 Aug 2009

Thanks again Dean.

Maybe you can also help in in another question I have been trying to figure out?

I want certain areas in the header, footer and custom HTML in the promo block to have things that are available only for members to see. Basically some links and images, simple stuff.

For instance:

If a guest, I want links like "Why Join Our site" in the topmost menu (not the main menu I can control in the admin area). But if a member, I dont want that link. I have other things that are graphical and such, but basically just looking if there is a code I can put before the link or image that tells it:

If member

then Show image or link

else show another image or link. Or show nothing

I will have this in several places like the header, footer, and a stationary bottom bar (like Dolphin 7 has) that I actually figured out how to implement myself. So am hoping there is an easy code I can copy and paste into various areas and replace what image or link to show as member or guest.

Cory

Quote · 18 Aug 2009

If the area allows PHP code the yes. If only html is allowed such as the html promo area, then no.


For PHP areas you just need to read the cookie

if ((int)$_COOKIE['memberID'] > 0) {

// Code if member is logged in.

} else {

// Code if guest

}




https://www.deanbassett.com
Quote · 19 Aug 2009

 

I know this has probably been asked, but I cant find it (and yes MyDatery, I used the search entire forum option)

 

But I want to know if there is a simple way to show more member information in the header, where it says "Hello, Member"

 

I know there is the links to My Account, My Mail, etc, but is there a way to have it, maybe, show how many mail messages you have, or if you have a friend request, or more detailed info like that.

 

I thought I saw something on Expertzzz, but that site is a little hard to navigate and I cant find it again.

 

Thanks for the help.

 

Cory

 

 

 Wow!  Looking to pick issues as soon as you ask a question.  That's a way to get help.

 

Now, moving on to your latest question.  How to enable it to identify items for logged/non-logged members (after all, the system won't know who is a member and who is a guest until a member logs in)

 

You could simply create a nice little function for the item that you want that would start with an if IDMember Logged... string, this would order the system to identify and respond.  As far as whether the section enables php or not, if it's a php or html file, then it will enable php, run the check and move on from there. 

 

Of course you will have to include in that a nice little db res query for it to check the system, but I'm sure you knew that already.

 

But then again, according to your e-mail to me... What do I know? 

Quote · 19 Aug 2009

Haha, thanks Mydatery. But if you read the email I said I thought you knew a lot about dolphin and coding and called you an expert, so not sure where you are coming from there.

I have also pointed out on almost all my posts that I am not a programmer and don't know how to do a db res query, which is why I ask the experts here at Boonex Forums. Experts like Dean.

Thanks again Dean for the great solution.k

Quote · 19 Aug 2009
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.