The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
How can I add plugin for class_block.php
I'm trying to add Gravatar images to forum's sidebar widget for my plugin "Gravatar as default avatar". Unfortunatly there is no hook in \includes\calss_block.php and I need to manually modify the code.
The plugin is really simple, if the avatar url is empty, then it calls the gravatar url. Is there a way to do it via plugin and not with a manual edit? (I'm not asking the code, I just ask if there is a templete hook to use). |
#2
|
||||
|
||||
Maybe parse_templates? If you go into debug mode, then all the hooks that are called on the page are listed on the bottom.
|
#3
|
||||
|
||||
Thank you for the help, but it doesn't work.
I tell you what I need to do: in file /includes/class_block.php at line 481 replace Code:
$userinfo['avatarurl'] = ''; Code:
$userinfo['avatarurl'] = 'http://www.gravatar.com/avatar/'.md5($userinfo['email']).'.png?s='.$this->registry->options['gravatar_dimension'].'&d='.$this->registry->options['gravatar_type'].'&r='.$this->registry->options['gravatar_rating'].''; Then in file /includes/blog_functions.php at line 1219 replace the same code above with: Code:
$userinfo['avatarurl'] = 'http://www.gravatar.com/avatar/'.md5($userinfo['email']).'.png?s='.$vbulletin->options['gravatar_dimension'].'&d='.$vbulletin->options['gravatar_type'].'&r='.$vbulletin->options['gravatar_rating'].''; Code:
$this->response['avatarurl'] = 'http://www.gravatar.com/avatar/'.md5($this->response['email']).'.png?s='.$this->registry->options['gravatar_dimension'].'&d='.$this->registry->options['gravatar_type'].'&r='.$this->registry->options['gravatar_rating'].''; Code:
$userinfo['avatarurl'] = 'http://www.gravatar.com/avatar/'.md5($userinfo['email']).'.png?s='.$vbulletin->options['gravatar_dimension'].'&d='.$vbulletin->options['gravatar_type'].'&r='.$vbulletin->options['gravatar_rating'].''; Any chance to do it? |
#4
|
||||
|
||||
Is your forum sideblock a php block? If so, just modify it in there. If it isn't a php block, then what type of block is it?
|
#5
|
||||
|
||||
They are the standard widget for sidebar, you can only choose between Blog Entries, CMS Articles, Forum Threads, New Forum Posts. You can't modify the php in the control panel because they are called from a default template located at includes\block\. But the avatar images are controlled by the file \includes\calss_block.php.
Is there a way to make a xml product that can modifiy the files on server? Something like "search and replace" (and the undo option when someone uninstall the product) Thanks |
#6
|
||||
|
||||
So you are trying to change the avatar in *any* block basically?
You cannot edit files through a product. |
#7
|
||||
|
||||
yes, I want to change avatar everywhere avatarurl is empty. Take a look at my forum 1e2.it/forum.
I' have aready done it on thread, memberlist, profile. But now to do it on sidebar and on Blog I can't find a way other than manual edit. |
#8
|
||||
|
||||
I don't think you will be able to do it without a code edit. I know you will need to edit \includes\api\1\api_getnewtop.php manually (I had to write a product to change the avatars on my site for the mobile app).
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|