Template / hook help? - Printable Version +- MyBB Community Forums (https://community.mybb.com) +-- Forum: Extensions (https://community.mybb.com/forum-201.html) +--- Forum: Plugins (https://community.mybb.com/forum-73.html) +---- Forum: Plugin Development (https://community.mybb.com/forum-68.html) +---- Thread: Template / hook help? (/thread-171937.html) |
Template / hook help? - Soyabean - 2015-06-14 Hello! I am all a bit new to plugin development. I am trying to modify the avatar template to add a secondary image next to it. But i cannot seem to find the right hook or something along those lines. this is what i'm trying to do:
Template: postbit_avatar
I don't know how easy that is to follow, but i'd really appreciate the help, i don't quite get the eval thing haha. plus it's getting late and i've been working for quite a while now haha. Thank you in advance RE: Template / hook help? - Omar G. - 2015-06-14 Exactly where do you want to add the image in? Want you to replace the avatar image, add a new one besides it, or a new avatar field in posts? The code you show displays attempts to hook into different places (UserCP, post bit). RE: Template / hook help? - Soyabean - 2015-06-14 I'm looking at adding an image next to the avatar image. i was looking at the hooks page and there didn't seem to be a straight forward hook for just all places the avatar appears RE: Template / hook help? - Omar G. - 2015-06-15 Indeed, there is no just one hook for all places where an avatar is displayed. For the postbit you will need to hook to postbit (only for threads, for example. RE: Template / hook help? - marcus123 - 2015-06-15 You need to hook to postbit and then in the function you have to mention $post and use $post['whatever'] in the template!
RE: Template / hook help? - Soyabean - 2015-06-15 (2015-06-15, 11:52 AM)marcus123 Wrote: You need to hook to postbit and then in the function you have to mention $post and use $post['whatever'] in the template! Thank you marcus This seems to be getting closer! i mean when i do a print_r($post['logo']); exit(); after the eval there seems to be the logo in there, but on the template where i'm trying to use it {$post['logo']} returns nothing. Is there something i am missing? Wait i think i am mistaken to how i should be using this all T_Tdamn i'm new to this haha. Right i was mistaken to what i was trying to do! eval("\$post['logo'] = \"".$templates->get("postbit_avatar")."\";"); <---- this would make $post['logo'] equal the template. but what i want to do is make it so the template can use {$post['logo']} as an image source. but $post['logo'] = $avatar['logo']; does not seem to output anything before the template is made. But when the function is called $post['logo'] is equal to something. So what i need to work is $post['logo'] to be equal to something as the template is being called. Aha! i have fixed the issue : (finally) The issue was i needed to re-call the useravatar template, so that it could use the $post['logo'] after it was set!I think explaining it out on the forum helped to solve my issue aha. Thanks guys. |