• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Profile tab problem with profile tab of xpm

Dadparvar

Well-known member
#1
Hi @Chris D ,

I developed an add-on. It adds a new tab in profile. But there is a problem. if in site, xpm be activated, then when users click on licenses tab, content of my add-on's tab will be opened and when they click on my add-on's tab, user's licenses will be appeared.

But when xpm is disabled, everything work fine.

Is this problem with your add-on or mine? What exactly is going on?

Thanks
 

Chris D

XenForo developer
Staff member
#2
This is a general development discussion and does not need to be directed at or answered by me directly (I can't at the moment). As I said in your PM, it's likely your add-on at fault, and you would potentially find the same problem with other add-ons that also add profile tabs.

You may want to post details about how you are adding your tab and content to the member_view template so people can help you more easily.
 
Last edited:

Dadparvar

Well-known member
#3
in my listener.php file I have a template_hook function. where switch between two things:
  • member_view_tabs_heading (that is a template that defines the tab heading)

  • member_view_tabs_content (that is the template to manage the content of the tab of my add-on)
And then I added a code event listener with "template hook" listen to event. Also I added another code event listener in order to pre load the templates, with "template create" listen to event. and this the code of that in listener.php:
PHP:
public static function template_create($templateName, array &$params, XenForo_Template_Abstract $template)
  {
    switch ($templateName) {
      case 'member_view':
        $template->preloadTemplate('dadparvar_profilemusic_mymusicTab');
        $template->preloadTemplate('dadparvar_profilemusic_mymusicTab_content');
        break;
    }
  }
 

Chris D

XenForo developer
Staff member
#4
I strongly recommend you never use template hooks. They are deprecated. You should be using "Template Modifications". Admin CP > Appearance > Template Modifications. You also don't need the template_create event with TMs.
 

Dadparvar

Well-known member
#5
I strongly recommend you never use template hooks. They are deprecated. You should be using "Template Modifications". Admin CP > Appearance > Template Modifications. You also don't need the template_create event with TMs.
Now I did as you said. Their place changed (before, my tab was the last one, now your add-on's tab is the last one)
But still when I click them, they open each other's content.
 

Chris D

XenForo developer
Staff member
#8
Yeah that would lead to an inconsistent placement of your tab and your tab content.

Look at the two TMs for the member_view template under Xen Product Manager. If you follow a similar convention, it should work fine.
 

Dadparvar

Well-known member
#9
Yeah that would lead to an inconsistent placement of your tab and your tab content.

Look at the two TMs for the member_view template under Xen Product Manager. If you follow a similar convention, it should work fine.
I'm confused. They are the same.
Can you please say what exactly is the problem? Because As I see them, they look similar. I also copied your work and changed the templates and key to set it to my add-on. Again the same problem.
 

Chris D

XenForo developer
Staff member
#10
I apologise, I misread your screenshot.

The only thing you need to change, then, is the Execution Order of both of your template modifications.
 

Dadparvar

Well-known member
#11
I apologise, I misread your screenshot.

The only thing you need to change, then, is the Execution Order of both of your template modifications.
I set both of them to 30. Now the tab is after your tab, but still when I click them, they bring each other's content!