miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /  
 

Avatar on every page (in header)

 
Author Vodicka
Partaker
#1 | Posted: 16 Jan 2009 16:46 
Would somebody know how to show avatar in the header on every page?

Author Paul
Lead Developer 
#2 | Posted: 19 Jan 2009 02:57 
I personally don't even understand the nature of question.

Author Vodicka
Partaker
#3 | Posted: 19 Jan 2009 05:59 
I am user.
I uploaded my avatar into my profile.
When I log in I see my (nick)name on every page in the header. ( {$user_usr} )
I want to see also my avatar on every page (in the header for instance).

Author Paul
Lead Developer 
#4 | Posted: 19 Jan 2009 09:12 
This needs to be extended in bb_cookie.php. There you should extend SQL request getting user's data, to have avatar's field. Then if the value of that field is equal to 1, some new variable should be formed, containing IMG tag of user's avatar, and you will need to paste this variable in any template... main_header or so.

Author Vodicka
Partaker
#5 | Posted: 19 Jan 2009 15:25 
Thanks.
How much would that cost if you program it for me?

(There are - unfortunately - two kinds of avatars. One that is unique, and user has to upload it, and other that if preloaded and user select it from list, it is visible from this part of bb_plugins:

if($av!='' and $av!='*') $im="<img src=\"{$GLOBALS['main_url']
}/img/forum_avatars/{$av}\" alt=\"\" />";
elseif($av!='' and $av=='*') $im="<img src=\"{$GLOBALS['avatarUrl']}/{$GLOBALS['cols'][0]}.mbb\" alt=\"\" />";
)

Author Paul
Lead Developer 
#6 | Posted: 20 Jan 2009 03:07 
Vodicka:
One that is unique, and user has to upload it, and other that if preloaded and user select it from list
Correct, such condition should be taken into attention in the code of bb_cookie.php.

$15 - and I think you have my email address. FTP access is also needed, this would be developed straight on your server.

Author Vodicka
Partaker
#7 | Posted: 20 Jan 2009 09:23 
OK, you've got mail :-)

Author Paul
Lead Developer 
#8 | Posted: 21 Jan 2009 04:11 
Ok, here is your solution :-)

1. As mentioned, I've upgraded bb_cookie.php to have the following additions:

in admin's login part, I've added this to have your avatar field ('user_custom1' as by default) readable from the database:

if($row=db_simpleSelect(0,$GLOBALS['Tu'],$GLOBALS['dbUserSheme']['user_sorttopics']
[1].','.$GLOBALS['dbUserSheme']['lang uage'][1].', '.$GLOBALS['dbUserSheme']['num_posts'][1].', user_custom1',$GLOBALS['dbUserId'],'=',1))
and later in the code:

$username=$GLOBALS['admin_usr'];

$av=$row[3];
if($av!='' and $av!='*') $GLOBALS['uAvatar']="<img src=\"{$GLOBALS['main_url']
}/img/forum_avatars/{$av}\" alt=\"\" />";
elseif($av!='' and $av=='*') $GLOBALS['uAvatar']="<img src=\"{$GLOBALS['main_url']
}/shared_files/avatars/1.mbb\" alt=\"\" />";
else $GLOBALS['uAvatar']='';

For regular users:

elseif($row=db_simpleSelect(0,$GLOBALS['Tu'],$GLOBALS['dbUserId'].','. $GLOBALS['dbUserSheme']['user_sorttopics'][1].','. $GLOBALS['dbUserSheme']['language'][1].','. $GLOBALS['dbUserAct'] .','. $GLOBALS['dbUserSheme']['user_password'][1] .', '.$GLOBALS['dbUserSheme']['username'][1].', '.$GLOBALS['dbUserSheme']['num_posts'][1].', user_custom1',$caseComp1.$GLOBALS['dbUserSheme']['username'][1].$caseComp2,'=',$usernameSql,'',1)){
$GLOBALS['user_num_posts']=$row[6];

$av=$row[7];
if($av!='' and $av!='*') $GLOBALS['uAvatar']="<img src=\"{$GLOBALS['main_url']
}/img/forum_avatars/{$av}\" alt=\"\" />";
elseif($av!='' and $av=='*') $GLOBALS['uAvatar']="<img src=\"{$GLOBALS['main_url']
}/shared_files/avatars/{$row[0]}.mbb\" alt=\"\" />";
else $GLOBALS['uAvatar']='';

User's avatar will be associated that way with {$uAvatar} variable. I've put it in main_header.html for your test case, you could put it under user_logged_in.html modifying HTML output as well. For example, add style="height:20px" to the image tag to reduce it in height upon the defined maximum (for better layout compliance), etc.

Let me know if you have further questions, and thank you for paying my dinner in advance ;-)

Author Vodicka
Partaker
#9 | Posted: 21 Jan 2009 05:36 
OK, it seems to work except the default avatar.

Where should I put the path to the default image?

Overhere:?
else $GLOBALS['uAvatar']='path to default image';


(It will be hidden in javasript menu, so it will not screw any design, dont worry :-) )

Checker plus user info incl. avatar

Author Paul
Lead Developer 
#10 | Posted: 21 Jan 2009 07:31 
Yes.

Author joe88
Partaker
#11 | Posted: 21 Feb 2009 03:03 
Hi,
The author has really given the time for this work. I appreciate his work. Well done.

Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /
 Avatar on every page (in header)
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Check out the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑