Add-on Want to get an idea of an add-on development

Aayush

Well-known member
This is pretty simple. If you have an idea about coding, I can send you the instructions on how you want to do it.
I saw your post yesterday but forgot to reply to it.
 

abdfahim

Well-known member
@Aayush That would be awesome, I was actually hoping for some guidance initially. I have relatively good experience in PHP/MySql, but I have a limited experience in XF structure. Basically, in XF, I have done few template modifications and wrote a couple of PHP call back functions to use with a custom page.

Really appreciate your response.
 
Last edited:

Aayush

Well-known member
Here is what you have to do:

1. Extend the XenForo_ControllerPublic_Account class using Code Event Listeners. You can read more about extending XenForo classes here https://xenforo.com/community/threads/part-3-creating-a-add-on-to-insert-tabs-in-profile-page-using-hooks.21289/.
Although this uses template hooks. I would advise you not to use that and instead you should use Template modifications.

2. Add a custom method in your extended class with a signature like
Code:
public function actionCustomField()
Now try loading http://yourxfinstall.com/account/custom-field
If you see default XenForo page loaded with an error in between which indicates you that you need to return something then you are on the right track. You would need to return a response view from the function that you just created. You can read the XenForo_ControllerPublic_Account file to find out how other pages work.

3. You'll need to create a new template in XenForo Admin area. You can do that by going on the page which lists all the templates in Admin area and clicking the "Create a template" button there. You need to return this template from the function wrapped in a responseView method from the function you just created in the previous step.

4. Add Template modifications for public facing templates. You'd can do that from http://yourxfinstall.com/admin.php?template-modifications/
You need to add template modifications to the following templates:
account_wrapper - To add a link to your new page in the sidebar.
navigation_visitor_tab - To add a link to the popup when you hover over your username.

I think that should be it for your needs and you can figure the rest out once you get the basic idea of XF Structure.
 
Top