PDA

View Full Version : Miscellaneous Hacks - Forum Home and Forumdisplay avatars (like XF)


kotkerk
08-23-2011, 10:00 PM
yes, i know =)
exists similar mods, but they produce mount of SQL queries on forum home page and forumdisplay page
i'm tried to create one product, that has no additional queries and save server resources
debug from my test forum (vbkerk.com)
No hack
====
Homepage
Page Generation 0.02608 seconds Memory Usage 1,558KB Queries Executed 10
Forumdisplay (Has threads)
Page Generation 0.03031 seconds Memory Usage 1,878KB Queries Executed 14
Forumdisplay (No threads - Category)
Page Generation 0.02724 seconds Memory Usage 1,832KB Queries Executed 8

Hack installed
====
Homepage
Page Generation 0.02612 seconds Memory Usage 1,600KB Queries Executed 10
Forumdisplay (Has threads)
Page Generation 0.03360 seconds Memory Usage 1,912KB Queries Executed 14
Forumdisplay (No threads - Category)
Page Generation 0.02957 seconds Memory Usage 1,855KB Queries Executed 8

Important Note!
avatar files must be in the File System! Not in Data Base!
and users used custom avatars, not uploaded by admin

====
I will no support this product
I don't know, how forum will work with this mod and mods, that used hooks:
cache_ordered_forums
forumdisplay_query
becouse, if you use hook cache_ordered_forums, you can not add fields, unless unsetting one variable ($counter_select) before

my english is bad, блин =)
live DEMO (http://vbkerk.com/forum/index.php)

Hornstar
08-24-2011, 09:23 AM
I may give this a go later, thanks for sharing your work :)

ShawneyJ
08-25-2011, 12:58 AM
tagged for now thanks, nice demo "Sorry. The administrator has banned your IP address" lol.

kotkerk
08-25-2011, 12:39 PM
administrator has banned your IP address
probably your IP address was used by some spam bots
ok, I removed all banned IP's

Tyran1
08-26-2011, 07:33 PM
Icon and Avatar to Avatar and Icon its better ;-)

Artes_Marciales
09-01-2011, 04:32 AM
Great mod! : D

Artes_Marciales
09-01-2011, 07:05 AM
does not work in new results or search :confused:

kotkerk
09-02-2011, 12:08 PM
does not work in new results or search
in mod description not promised, that mod would work in search results =)
look at thread title:
Forum Home and Forumdisplay avatars
ok, if you want to add this feature, add new module in:
1.
Plugins & Products
Add New Plugin =>
===
Product = XFAvatar
Hook Location = search_results_query_threads
Title = XFAvatar - search_results_query_threads
Execution Order = 5 (default)
Plugin PHP Code:

if(file_exists(DIR . '/krscripts/xfavatar/search_results_query_threads.php'))
{
require_once(DIR . '/krscripts/xfavatar/search_results_query_threads.php');
}


2.
Create new file called search_results_query_threads.php
put php code in this file:

<?php
if(!is_object($vbulletin))
{
exit;
}
$hook_query_fields = ",
post_user.userid AS lastposterid, post_user.avatarrevision AS avatarrevision, user.avatarrevision AS post_avatarrevision,
customavatar.width AS avwidth, customavatar.height AS avheight,
post_customavatar.width AS post_avwidth, post_customavatar.height AS post_avheight,
NOT ISNULL(post_customavatar.userid) AS post_customavatar,
NOT ISNULL(customavatar.userid) AS hascustom
";
$hook_query_joins = "
LEFT JOIN " . TABLE_PREFIX . "user AS post_user ON(post_user.username = thread.lastposter)
LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON(avatar.avatarid = user.avatarid)
LEFT JOIN " . TABLE_PREFIX . "avatar AS post_avatar ON(post_avatar.avatarid = post_user.avatarid)
LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON(customavatar.userid = user.userid)
LEFT JOIN " . TABLE_PREFIX . "customavatar AS post_customavatar ON(post_customavatar.userid = thread.postuserid)
";
?>

upload this file to your server into folder *your_forum*/krscripts/xfavatar/

https://vborg.vbsupport.ru/external/2011/09/62.png

Artes_Marciales
09-02-2011, 01:05 PM
Amazing!!!
Nominated, I love this mod!
Thanks kotkerk!!!

Artes_Marciales
09-03-2011, 05:45 AM
Sorry to bother you again.
It seems that some users without avatar avatars are not displayed correctly, there is no apparent reason for this failure.
The problem is that the image looks in the folder but they are users without avatars avatar.
The image should have this route images/misc/unknown.gif but somehow find a route in the folder customavatars.
For this error they must have at least 10 new messages in 5 for example you may not see the error :o
example: http://www.foroartesmarciales.com/search.php?do=getdaily

I wonder if you could review the code for a solution. Thank you very much for your patience and apologize for any inconvenience.

PL: apologize for my English

kotkerk
09-03-2011, 07:33 AM
for example, this file does not exists in directory customavatars
_http://www.foroartesmarciales.com/customavatars/avatar18354_2.gif
"Page not found"
==
check it on your server =)

Artes_Marciales
09-03-2011, 07:50 AM
for example, this file does not exists in directory customavatars
_http://www.foroartesmarciales.com/customavatars/avatar18354_2.gif
"Page not found"
==
check it on your server =)
sure, the user never had an avatar.
The mod should not seek that route (avatar_userID_2), the mod should look images/misc/unknown.gif
Example: http://www.foroartesmarciales.com/search.php?do=getdaily

the error is random, sometimes it is about other users other (always without avatar).
That happens in every forum I installed the hack (4 forums).
Thanks for check!

Artes_Marciales
09-04-2011, 08:16 AM
Another example of error in the image

These errors happen only in new messages.

Best Regards!! : )

kotkerk
09-06-2011, 12:03 AM
yep... =)
i confirm, it's bug...
but give me some time, i'll fix this...

Artes_Marciales
09-06-2011, 04:27 AM
Thanks!!! : D

kotkerk
09-07-2011, 04:08 AM
Artes_Marciales,
download attachment from first post
reupload file search_results_query_threads.php from archive to your server
code of sql query in one file (search_results_query_threads.php) rewrited
i think this update will fix the problem =)
on my local test forum i was not detect this problem

Artes_Marciales
09-07-2011, 05:21 AM
Now works fine! : D
Great Mod!
THANKS!!!!

Alfa1
09-12-2011, 01:11 AM
Please add an option to place the avatar in the position where the thread icons are now. This is how XenForo does it.
Please add the option / setting to not display the avatar of the last poster. XenForo does not display it either and I think that is best.

* tagged for future use.

kotkerk
09-18-2011, 10:06 AM
Alfa1, this is a simple mod, writen out of hours =)
if u want to not display last poster avatar, just remove the code from template
it's simple like bolacha "Maria" :D
in case to place avatar in the position of thread icons, move the code

TerryMason
10-06-2011, 08:03 PM
Thanks, this works great!

I did have one problem though. I use another mod named Geek Article Review (gar), and it causes errors with this mod. Specifically:

MySQL Error : Unknown column 'ga.synopsis' in 'field list'

Is the an easy way to keep this mod from running on forums where that plugin is active? Something like


if($vbulletin->userinfo['userid'] AND in_coventry($vbulletin->userinfo['userid'], true) OR is forum 4,5,6 )
{
// do nothing
}else{

TerryMason
10-07-2011, 01:59 AM
I figured out my own question if anyone wants to know.

In plugin manager - xfavatar - forumdisplay_query

replace the plugin php code with this, changing the forumids to the forums you don't want this plugin in.


if( $foruminfo[forumid]==32 || $foruminfo[forumid]==17 || $foruminfo[forumid]==18 || $foruminfo[forumid]==19 || $foruminfo[forumid]==20 || $foruminfo[forumid]==21 || $foruminfo[forumid]==22 || $foruminfo[forumid]==23 || $foruminfo[forumid]==24 || $foruminfo[forumid]==25 || $foruminfo[forumid]==26 || $foruminfo[forumid]==28 ) {

} else {
if(file_exists(DIR . '/krscripts/xfavatar/forumdisplay_query.php'))
{
require_once(DIR . '/krscripts/xfavatar/forumdisplay_query.php');
}
}

TitanJeff
10-29-2011, 03:55 PM
I'm very interested in adding this. Is the avatar size adjustable? I'd like to somehow find a way for the text to all be the right of the avatar as well.

kotkerk
10-29-2011, 11:10 PM
Is the avatar size adjustable?
you can change avatar size in the template (see install instructions)
width="30" height="30"
change this values... pronto =)

TitanJeff
11-02-2011, 09:22 PM
One more question and I fear it's impossible to do easily.

I would like to have all the widths and heights the same. But many of the avatars are of different proportions which means it is stretched or compressed. Is there any way to add code which crops the image?

kotkerk
11-07-2011, 02:01 AM
TitanJeff,
you can remove height="" from template
but in this case avatars will shows ugly on forum =)
==
crop images code need to add to upload (img) vbulletin files
i.e. before showing avatar on the forum

Kolektor
07-23-2012, 01:40 PM
you're doing good mods :)
I like this one also. :)

ChiNa
08-06-2012, 12:06 AM
Not Working fully! In my LAST POST. vBulletin 3.8.6 upgraded to 3.8.7
Sorry I am not home and cant login from other places,

So am with my moderator,and thiss is how his username looks like: WizardBoy" />

You can see the EXTRA " /> at the end..

So I removed this 2 times code:
alt="$lastpostinfo[lastposter]" />And the images are hanging in the middle, either it should be on left or right!
So I added 2 times:
align="left" befor the 2 times:
class="inlineimg"I have attached an image, might help you to update the product!

Thank you was nicely made!

muhakeme
11-04-2012, 11:46 PM
it does not work in vBadvanced. Can you help?

kotkerk
11-05-2012, 05:24 PM
does not work in vBadvanced
you need to modify vbadvanced php module-file, to get info about user avatar from DB

muhakeme
11-05-2012, 07:37 PM
Here is the module. Can you help?

Kolektor
11-30-2012, 01:53 PM
Not Working fully! In my LAST POST. vBulletin 3.8.6 upgraded to 3.8.7
Sorry I am not home and cant login from other places,

So am with my moderator,and thiss is how his username looks like: WizardBoy" />

You can see the EXTRA " /> at the end..

So I removed this 2 times code:
alt="$lastpostinfo[lastposter]" />And the images are hanging in the middle, either it should be on left or right!
So I added 2 times:
align="left" befor the 2 times:
class="inlineimg"I have attached an image, might help you to update the product!

Thank you was nicely made!

can you add this fix? :up:

ye22
09-04-2014, 06:50 PM
- sorry for bumping -

How to make it work in tag search?
works fine in both normal thread/post searches tho :/

solong2
01-14-2015, 03:45 PM
hello

not work withe me

Fethi.dz
02-25-2015, 07:11 PM
Great product,

is there anyway to add avatars in tags page?

Thnaks.

Triky
12-23-2015, 09:01 PM
I'd love to have it displyaing avatars in the gallery too.

webnsn
07-05-2016, 10:06 AM
Hi

I really want like this.

I don't want User Avatar but the Photo which is in the Thread want to show in the Home