vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Show User's Avatar in Navbar v1.1 (https://vborg.vbsupport.ru/showthread.php?t=83053)

fraghappy 06-13-2005 10:00 PM

Show User's Avatar in Navbar v1.1
 
This is my first plugin for vB. It took me awhile to figure things out, but, once I polished it down, it was a piece of cake. If you encounter any problems or have any suggestions, please let me know, thanks!

IF YOU HAVE VERSION 1.0 INSTALLED, please update to the most recent version (1.1). This is because of a necessary bugfix needed to prevent users who do not have avatars from having image problems!

-------------------

[3.5.x] Show User's Avatar in Navbar

Designed and Coded by: Thorne N. Melcher ("Frag")
Version: 1.1 (released 6/14/05)
Screenshots: 1; included in the .zip file.
Description: This hack will display the user's avatar next to the "Welcome, {username}" message in the navbar at the top of every page. If there is no user presently logged in, the plugin will not bother to query the database, and the avatar will not display.
Plugin ?2005 The Whispering Realms Studios.

Performance and Installation Specs
Supports vB versions: 3.5.x
New Queries: 1 per pageload, IF the user is logged in.
New Hook Calls: 1 (global_start)
New Files: 1 (/images/misc/noavatar.gif)
Template Modifications: 1 ('navbar')
File Edits: none

Included Files
avatar_on_navbar.xml - Plugin file
README.html - Installation instructions.
screenshot.jpg - Screenshot of the plugin in action.
/UPLOAD/images/misc/noavatar.gif - Default "No Avatar" image.
Version History
v1.1 (6.14.05) - A bug was indentified where, if the user viewing the page did not have an avatar uploaded/selected, it would try to display his or her avatar anyway.
New files: /images/misc/newavatar.gif
Changed files: /avatar_on_navbar.xml

v1.0 (6.14.05) - The first public release, complete with all necessary features.

Please click "Install" if you decide to use this plugin! Thank you!

FleaBag 06-14-2005 03:40 PM

Very nice! Have been wanting something to make the navbar look a little less boring for some time. Will surely install when I make the leap to 3.5. :)

dreck 06-14-2005 03:57 PM

Yes, very nice! This will come in handy when i upgrade to 3.5.

Also would be nice to have new & subscribed posts below the private messages.
Just a thought!

Thanks!

Benj 06-14-2005 05:09 PM

nice

M1th 06-14-2005 05:11 PM

You could get rid of that one query per page by simply adding:

PHP Code:

define('AVATAR_ON_NAVBAR'1); 

to the /includes/config.php file

Chris M 06-14-2005 05:27 PM

That would take away the point of this being a "plugin" though ;)

Satan

M1th 06-14-2005 05:31 PM

Quote:

Originally Posted by hellsatan
That would take away the point of this being a "plugin" though ;)

Satan

Exactly, but you its always better to avoid adding unneeded queries. ;)

I would release my version of this hack in the coding section if fraghappy doesnt mind. :)

fraghappy 06-14-2005 07:52 PM

Quote:

Originally Posted by dreck
Yes, very nice! This will come in handy when i upgrade to 3.5.

Also would be nice to have new & subscribed posts below the private messages.
Just a thought!

Thanks!

I'll create a plugin based off of this called "Navbar Plus" or something. Look for it later tonight/early tomorrow.

Quote:

Originally Posted by M1th
Exactly, but you its always better to avoid adding unneeded queries. ;)

I would release my version of this hack in the coding section if fraghappy doesnt mind. :)

I'm really uptight about people stealing my work and not giving me credit. Thank you for asking, that really makes the difference to me. Please, in your post on vB.org and in the hack, please give mention of both me and this hack. I really don't mind people editing what I do, that's what's nice about open-source language. I'm just glad that you aren't going to steal me work and take the credit. :D Go for it!

Kirk Y 06-14-2005 09:04 PM

When the user logged in doesn't have an avatar set, it shows that lovely red x box, would there be anyway to set it to go to a certain say, No Avatar Selected Image, if the user doesn't have an avatar set?

fraghappy 06-14-2005 09:17 PM

Quote:

Originally Posted by acidburn0520
When the user logged in doesn't have an avatar set, it shows that lovely red x box, would there be anyway to set it to go to a certain say, No Avatar Selected Image, if the user doesn't have an avatar set?

I'll update it for you later tonight. Thanks for letting me know about that.

Kirk Y 06-14-2005 09:19 PM

No problem. Thanks for updating! :)

fraghappy 06-14-2005 11:34 PM

Version 1.1 has been released in order to address the following bug:

Quote:

Originally Posted by acidburn0520
When the user logged in doesn't have an avatar set, it shows that lovely red x box, would there be anyway to set it to go to a certain say, No Avatar Selected Image, if the user doesn't have an avatar set?

The .zip file has been updated and includes everything that you'll need to upgrade to the latest version. Thank you for showing so much interest in my hack. If you find any other bugs or have any other suggestions, please let me know!

ThorstenA 06-15-2005 08:40 AM

Very nice.

Suggestions:
* smaller image size that fits to navbar & nice blue border: <img ..... height="37" border="1">
* put image and text more together: <table cellpadding="1" ...>

mholtum 06-16-2005 02:33 AM

Quote:

Originally Posted by acidburn0520
Thank you for the update. I used a different "No Avatar" image than the provided one. If anyone would like to use mine, see the attached image. Also, I didn't like the way the avatar was positioned, it stretched my forum's header too much, instead of the html provided for the "navbar" template, I placed the avatar in a seperate table. For whatever reason the avatar was displayed above the userinfo, instead of beside it. So I used this html:

HTML Code:

        <if condition="$bbuserinfo['userid']">
                <td class="alt2" valign="left" nowrap="nowrap">

<a href="profile.php?$session[sessionurl]do=editavatar"><img src="$navbar_ava[0]" alt="Your avatar" border="0" /></a></td>
<td class="alt2" valign="right" nowrap="nowrap">
                <div class="smallfont">
                        <strong><phrase 1="$bbuserinfo[username]">$vbphrase[welcome_x]</phrase></strong><br />
                        <phrase 1="$pmbox[lastvisitdate]" 2="$pmbox[lastvisittime]">$vbphrase[last_visited_x_at_y]</phrase>
                        <if condition="$show['pmstats']"><br /><phrase 1="$vbphrase[unread_x_nav_compiled]" 2="$vbphrase[total_x_nav_compiled]" 3="$session[sessionurl]">$vbphrase[private_messages_nav]</phrase></if>
                </div>
                </td>

I've also attached a screenshot of what my html looks like on the navbar.

Thanks again for the hack, Frag.

I would like to use your code but I get this error:
Code:

The following error occurred when attempting to evaluate this template:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/mholtum/public_html/test/includes/adminfunctions_template.php(3515) : eval()'d code on line 181

This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.


fraghappy 06-16-2005 04:55 PM

Quote:

Originally Posted by mholtum
I would like to use your code but I get this error:
Code:

The following error occurred when attempting to evaluate this template:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/mholtum/public_html/test/includes/adminfunctions_template.php(3515) : eval()'d code on line 181

This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.


He missed an </if> at the end of his code. Add it in, and it should work. ;)

Jaxx 06-16-2005 04:59 PM

Not sure why, but all I'm getting for this is the following. My other admin says its working fine for him though.

dsboyce8624 06-16-2005 05:05 PM

Is there something like this for 3.0.x? Don't seem to find anything on searching.

mholtum 06-16-2005 05:07 PM

Quote:

Originally Posted by fraghappy
He missed an </if> at the end of his code. Add it in, and it should work. ;)

I figured that, does it matter where I put it?

fraghappy 06-16-2005 08:41 PM

Quote:

Originally Posted by Jaxx
Not sure why, but all I'm getting for this is the following. My other admin says its working fine for him though.

Hmm... could it perhaps be a browser issue? Do you use Firefox or Internet Explorer? Once I track down the problem, I release v1.2. After that, though, I probably won't work on this plugin much more, as I'm going to make it one of the features in a more advanced plugin that I'm developing.

Quote:

Originally Posted by dsboyce8624
Is there something like this for 3.0.x? Don't seem to find anything on searching.

Nope. As far as I know, it is an original idea.

Quote:

Originally Posted by mholtum
I figured that, does it matter where I put it?

Just put it at the end of the template code that he posted. ;)

Kirk Y 06-17-2005 04:59 AM

Quote:

Originally Posted by fraghappy
He missed an </if> at the end of his code. Add it in, and it should work. ;)

Strange, I have just that one </if>, my template gave no code errors. Hmm...

Quote:

Originally Posted by dsboyce8624
Is there something like this for 3.0.x? Don't seem to find anything on searching.

Yes, actually there is a hack that was just recently released based off of this plugin.

Use the directions, here: https://vborg.vbsupport.ru/showthread.php?p=668118
But be sure to take a look at this post, to see how to make it work for 3.0.x.:
https://vborg.vbsupport.ru/showpost....24&postcount=9

Hope everything works out for you. :classic:

Dark Riku 06-18-2005 07:24 AM

Yea..So i need some Serious Help lol

http://www.gfxwiz.net/wtf.JPG

works on the navbar..but not near the poster, and now i cant even delete it? lol

(Happening on all my skins, except Default, I Even tryed to reinstall the skins, same thing)

Lostitonce 06-24-2005 03:12 PM

I am having a problem with this plugin - it never showed avatar to begin with , just a red x . Now it has been removed , but , is still showing a red x in my navbar ?

fraghappy 06-24-2005 03:49 PM

Quote:

Originally Posted by Dark Riku
Yea..So i need some Serious Help lol

works on the navbar..but not near the poster, and now i cant even delete it? lol

(Happening on all my skins, except Default, I Even tryed to reinstall the skins, same thing)

That shouldn't have anything to do with this hack, as it doesn't change any of the 'showthread' variables.

Quote:

Originally Posted by Lostitonce
I am having a problem with this plugin - it never showed avatar to begin with , just a red x . Now it has been removed , but , is still showing a red x in my navbar ?

You have to undo the template modifications, because it's still searching for the picture in the navbar. I'm expanding this plugin into a "Navbar Plus" plugin, so I'll try to fix some of these issues then. It would help if I had a bit more information about your forum to understand why it is giving you the red X, as it has worked on 95% of the forums that have installed it. ;)

dsboyce8624 06-25-2005 02:45 AM

Quote:

Originally Posted by fraghappy
Nope. As far as I know, it is an original idea.

I created one. I like the idea.

Lostitonce 06-25-2005 05:53 PM

Quote:

Originally Posted by fraghappy
You have to undo the template modifications, because it's still searching for the picture in the navbar. I'm expanding this plugin into a "Navbar Plus" plugin, so I'll try to fix some of these issues then. It would help if I had a bit more information about your forum to understand why it is giving you the red X, as it has worked on 95% of the forums that have installed it. ;)

I did undo the template modifications , deleted the plugin , and it is still trying to show up , lol .

What kind of info do you need ? My forum is here : http://www.dogeplanet.com/forum/index.php?

jesse 06-28-2005 05:53 AM

Quote:

Originally Posted by Jaxx
Not sure why, but all I'm getting for this is the following. My other admin says its working fine for him though.

I have this problem with ie but not the fox

o0Hubba0o 10-03-2005 03:39 PM

Quote:

Originally Posted by Dark Riku
Yea..So i need some Serious Help lol

Riku, the help you need can't be found on these forums! :p

Mastar 10-22-2005 05:23 PM

I am having this same problem as Jaxx.

hitmanuk2k 01-13-2006 10:44 AM

OK I can't display an image, all that comes up is "Your Avatar" - which is the image alt.

t3aseFP 02-02-2006 05:26 PM

Cool plugin, works nice.

One question, when using vBadvanced, the homepage uses navbar, but the avatar will not show. I'm assuming because there's a variable that's not set when using the vBa based page.

Throughout the vB pages it works fine, though.

Any way you can let me know how to define the variable for vBa or hack it to work? I'll start playing with things in the mean time.

Gripemaster 02-03-2006 12:41 PM

I'm afraid I had to uninstall this one :(

I'm rather liberal with my avatar sizes (150 X 150 and 150KB), and it left a HUGE blank space between my two navbars that just didn't look right. Is there a way of making the script resize the avatar to a smaller size? I would still like to use this product :)

t3aseFP 02-04-2006 01:54 AM

Quote:

Originally Posted by Gripemaster
I'm afraid I had to uninstall this one :(

I'm rather liberal with my avatar sizes (150 X 150 and 150KB), and it left a HUGE blank space between my two navbars that just didn't look right. Is there a way of making the script resize the avatar to a smaller size? I would still like to use this product :)

Code:

<td style="vertical-align: bottom; width: 80px; height: 60px; margin: 0px; padding: 0px;">
  <a href="profile.php?$session[sessionurl]do=editavatar"><img src="$navbar_ava[0]" alt="Your avatar" style="width: 100%; height: 100%;" border="0"/></a>

Just add the td and img style attributes and edit as desired.

Gripemaster 02-04-2006 03:17 AM

Quote:

Originally Posted by t3aseFP
Code:

<td style="vertical-align: bottom; width: 80px; height: 60px; margin: 0px; padding: 0px;">
  <a href="profile.php?$session[sessionurl]do=editavatar"><img src="$navbar_ava[0]" alt="Your avatar" style="width: 100%; height: 100%;" border="0"/></a>

Just add the td and img style attributes and edit as desired.

Excellent!!! Thank you! :)

mploetner 03-07-2006 05:04 PM

Quote:

Originally Posted by hitmanuk2k
OK I can't display an image, all that comes up is "Your Avatar" - which is the image alt.

same to me... any suggestions

gravesend46 04-24-2006 08:39 PM

Thanks, seems to work for me on 3.5.4!

Aken 05-05-2006 08:34 AM

Quote:

Originally Posted by t3aseFP
Cool plugin, works nice.

One question, when using vBadvanced, the homepage uses navbar, but the avatar will not show. I'm assuming because there's a variable that's not set when using the vBa based page.

Throughout the vB pages it works fine, though.

Any way you can let me know how to define the variable for vBa or hack it to work? I'll start playing with things in the mean time.

I'm in the same boat - would love to get this working on VBA as well.

Annapurna 05-25-2006 03:20 PM

Nice hack, installed, but then realized, that is does not work with Firefox (see screenshot)
Attachment 48215

Andreas

Benj 05-29-2006 03:32 PM

is there an easy way to make this the profile picture instead

carmichael1973 06-08-2008 12:22 PM

Quote:

Originally Posted by Aken (Post 967343)
I'm in the same boat - would love to get this working on VBA as well.

I'm stuck with the same issue. I can't get the avatar to show on non-vb pages. Everything else works fine. This is an awesome hack. I've played around with these variables and I get DB errors if I change the fetch_avatar_url.

Quote:

if ($vbulletin->userinfo['userid'])
{
require_once('./includes/functions_user.php'); //make sure we have the function we need
$navbar_ava = fetch_avatar_url($vbulletin->userinfo['userid']);
if (!is_array($navbar_ava))
{
$navbar_ava[] = $vbulletin->options['bburl'] . "/images/misc/noavatar.gif";
}
}

If anyone figures this out, PLEASE post it!
:up:

edgeyveggie 06-13-2008 12:50 AM

How can I do this with 3.6.8? I'd love to know!!


All times are GMT. The time now is 01:30 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01595 seconds
  • Memory Usage 1,859KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)bbcode_html_printable
  • (1)bbcode_php_printable
  • (25)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete