miniBB ®
 
miniBB Community Forum
 | Forums | File Bank | Sign Up | Reply | Search | Statistics | Manual |
Forums Checker addon for miniBB Check-up your forums instantly without missing any new posting using the Forums Checker add-on!
Custom Tutorials and Modifications miniBB Community Forum / Custom Tutorials and Modifications /
Short link for this topic:

Avatar on every page (in header)

Author Vodicka
Forums Member
#1 | Posted: 16 Jan 2009 16:46
Would somebody know how to show avatar in the header on every page?
Author Paul
CEO
#2 | Posted: 19 Jan 2009 02:57
I personally don't even understand the nature of question.
Author Vodicka
Forums Member
#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
CEO
#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
Forums Member
#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
CEO
#6 | Posted: 20 Jan 2009 03:07 | Edited by: Paul
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
Forums Member
#7 | Posted: 20 Jan 2009 09:23
OK, you've got mail :-)
Author Paul
CEO
#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
Forums Member
#9 | Posted: 21 Jan 2009 05:36 | Edited by: Vodicka
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
CEO
#10 | Posted: 21 Jan 2009 07:31
Yes.
Author joe88
Forums Member
#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 Community Forum / Custom Tutorials and Modifications / Avatar on every page (in header) Top
Your Reply Click this icon to move up to the quoted message

» Username  » Password 
You are welcome to post anonymously by entering a nickname with no password (if that nickname has not been taken by another member) or by leaving both fields empty. If you have a forums membership account, you can also sign in from this page without posting a message, or sign in and post at once.


Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.

 
miniBB Community Forum Powered by Free Forum Software miniBB ® Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contacts