1. 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

Discussion in 'XenForo Development Discussions' started by Dadparvar, Apr 17, 2016.

  1. Dadparvar

    Dadparvar Well-Known Member

    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?

  2. Chris D

    Chris D XenForo Developer Staff Member

    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: Apr 17, 2016
  3. Dadparvar

    Dadparvar Well-Known Member

    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:
    public static function template_create($templateName, array &$paramsXenForo_Template_Abstract $template)
        switch (
    $templateName) {
  4. Chris D

    Chris D XenForo Developer Staff Member

    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 likes this.
  5. Dadparvar

    Dadparvar Well-Known Member

    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.
  6. Chris D

    Chris D XenForo Developer Staff Member

    Include the TM details
  7. Dadparvar

    Dadparvar Well-Known Member

    Here you are

    Attached Files:

  8. Chris D

    Chris D XenForo Developer Staff Member

    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.
  9. Dadparvar

    Dadparvar Well-Known Member

    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.
  10. Chris D

    Chris D XenForo Developer Staff Member

    I apologise, I misread your screenshot.

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

    Dadparvar Well-Known Member

    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!

Share This Page