vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.7 Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=229)
-   -   Miscellaneous Hacks - Place Avatar in VB and Non-VB Pages (https://vborg.vbsupport.ru/showthread.php?t=186493)

carmichael1973 07-26-2008 10:00 PM

Place Avatar in VB and Non-VB Pages
 
The following is a bit of code I came up with to continue to use the Avatar in Navbar mod by fraghappy. After searching for many hours I decided just to figure it out myself.

On the bright side, none of the plugins and db queries from the old mod are used.

I'll try to support this as much as possible, but I don't foresee anyone having any real issues. It's pretty straight forward.

Don't forget to click the INSTALL

Features in progress

  • Add Auto-Resize for Navbar Only
  • Add AJAX function to expand to original size on mouse over
  • Definable default no avatar images for usergroups
  • AdminCP Options
  • Build as a simple product


You just need to become familiar with the following bit of code:

This will display a users avatar:
Code:

<img src="$vboptions[bbdir]/image.php?u=$bbuserinfo[userid]" alt="Your avatar" border="0" />
and this is what I use in place of the Avatar in Navbar mod:

In navbar template replace:

Code:

<table cellpadding="0" cellspacing="0" align="left" style="margin-top:5px;">
<tr>
<td><a href="profile.php?$session[sessionurl]do=editavatar"><img src="$navbar_ava[0]" alt="Your avatar" border="0" /></a>
</td>

with this:

Code:

<table cellpadding="0" cellspacing="0" align="left" style="margin-top:5px;">
<tr>
<td><a href="$vboptions[bbdir]/profile.php?$session[sessionurl]do=editavatar"><img src="$vboptions[bbdir]/image.php?u=$bbuserinfo[userid]" alt="Your avatar" border="0" /></a>
</td>

In non-vb pages (i.e. vbp_navbar I use vbPortal) I use this code: You must modify this to match your portal or external pages

Code:

<table cellpadding="0" cellspacing="0" align="left" style="margin-top:5px;">
<tr>
<td><a href="$vbpoptions[bbdir]/profile.php?$session[sessionurl]do=editavatar"><img src="$vbpoptions[bbdir]/image.php?u=$bbuserinfo[userid]" alt="Your avatar" border="0" /></a>
</td>

Then just simply assign the noavatar.gif as the default avatar for your usergroups. From then on your users that have not uploaded a custom avatar will be displayed the noavatar.gif

Personally I don't use the no avatar image as the default. I created a custom default avatar for each usergroup.

As for the plugin for the original Avatar on Navbar mod, I don't even use it. With this bit of code it's simple and not needed.

or if you want to call it directly using an http: use this method:

Code:

<table cellpadding="0" cellspacing="0" align="left" style="margin-top:5px;">
<tr>
<td><a href="http://www.yourwebsite/pathtoforums/profile.php?$session[sessionurl]do=editavatar"><img src="http://www.yourwebsite/pathtoforums/image.php?u=$bbuserinfo[userid]" alt="Your avatar" border="0" /></a>
</td>

The user must be logged in to the forums and using cookies to work outside of the forum root. If you are using an integrated portal system you should have no issues!

Enjoy!

07/28/2008 - Added simple screenshot.

FReeSTER 07-27-2008 05:17 PM

Thank you very much, But I have one question, for those who have Big Avatars will this Mod resize the Avatar for what ever pixels want it?

Thank you </installed>

carmichael1973 07-27-2008 05:25 PM

My attempts to contact the author of Show User's Avatar in Navbar v1.1, fraghappy have been unsuccessful. I'll try to make this into a product with <if> functions to call a default avatar if no custom avatar exists.

None of the original authors code is needed using this method so there shouldn't be an issue!

carmichael1973 07-27-2008 05:33 PM

Quote:

Originally Posted by El Intocable (Post 1585360)
Thank you very much, But I have one question, for those who have Big Avatars will this Mod resize the Avatar for what ever pixels want it?

Thank you </installed>

No it doesn't! I am working on adding the resize image function just like when you add a custom avatar through the admincp. At this point I advertise max avatar sizes. My users have been pretty good about resizing thier own images.

I'd like to have it resize just for the navbar only and then add some ajax function to it so that it expands on mouse over.

I'll keep everyone posted on the progress!

FReeSTER 07-27-2008 05:49 PM

Quote:

Originally Posted by carmichael1973 (Post 1585370)
No it doesn't! I am working on adding the resize image function just like when you add a custom avatar through the admincp. At this point I advertise max avatar sizes. My users have been pretty good about resizing thier own images.

I'd like to have it resize just for the navbar only and then add some ajax function to it so that it expands on mouse over.

I'll keep everyone posted on the progress!

Thank you mate, very nice of you

zmmmzz 07-28-2008 04:28 PM

super cool mod

RobbieZ 07-28-2008 04:51 PM

Can we see a demo please..

zmmmzz 07-28-2008 05:38 PM

Quote:

Then just simply assign the noavatar.gif as the default avatar for your usergroups
How do I do this?

Cant wait for the resize image function.

carmichael1973 07-28-2008 10:52 PM

Quote:

Originally Posted by zmmmzz (Post 1586119)
How do I do this?

Cant wait for the resize image function.

1) First Create a separate Avatar Category for each Usergroup:

In your admincp go to Avatars> Avatar Manager> Create New Avatar Category

2) Go to Avatars> Avatar Manager> (Usergroup Category) Avatar Permissions and select "No" for all usergroups except "Administrators" and the usergroup you setup the category for.

Repeat this step for all the other Usergroup Categories you made.

3) Go to Avatars> Upload Avatar and select the image you use as your "NoAvatar" image. Set the Minimum Posts field to "0" and select the category that will use it. Give it a Title and click UPLOAD.

Note: You can use the same image for each usergroup category but you must upload it for each one separately.

Repeat this upload step for each user.

I only use two usergroup categories so and both have individual images.

I hope this helps you out!

zmmmzz 07-29-2008 03:15 AM

thanks for the explanation!

now I'm trying to set an avatar as default so that when a user registers the avatar is already selected in his or her account instead of 'no avatar specified'.

Is this possible?


All times are GMT. The time now is 06:57 PM.

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.01923 seconds
  • Memory Usage 1,750KB
  • 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
  • (5)bbcode_code_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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