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

MG 1.1 After upgrading my custom template modification is gone!

Discussion in 'Media Gallery Support' started by imthebest, Sep 24, 2015.

  1. imthebest

    imthebest Formerly Super120

    When I was on MG 1.1.0 I created a template modification in the template "member_card" (additional to the 2 that come as stock). I have just upgraded to 1.1.1 and noticed that my template modification is gone! IIRC, during an upgrade the system will overwrite the stock template modifications of the add-on however I'm not sure if it is also normal to have those extra template modifications deleted.
     
    Last edited: Sep 24, 2015
  2. CyclingTribe

    CyclingTribe Well-Known Member

    I would have expected it to warn you and give you the option to merge the changes (assuming the gallery templates are treated the same way as the core forum templates?).
     
  3. imthebest

    imthebest Formerly Super120

    Please note that I'm not talking about templates but about template modifications. To make it more clear:

    demo.jpg
     
    CyclingTribe likes this.
  4. CyclingTribe

    CyclingTribe Well-Known Member

    Ooops, sorry, I misunderstood ... I took 'template modification' to mean you'd edited a template - completely forgetting about the actual template modification system. :oops: :)
     
  5. Brogan

    Brogan XenForo Moderator Staff Member

    Any template modifications you create should be linked to your own custom add-on, not the existing add-on.

    Otherwise they will be removed when upgrading.
     
  6. Mike

    Mike XenForo Developer Staff Member

    You tagged your template modification as being part of the add-on. It is totally expected that it is removed when you upgraded the add-on. You can't modify parts of an add-on and expect it to persist an upgrade to the add-on. There's a very good reason why you can only do this in debug mode.

    If you really want to do this via a template modification, don't apply it to an add-on (or create your own add-on to contain your changes).
     
    imthebest likes this.
  7. Liam W

    Liam W Well-Known Member

    If template mods weren't removed, then if a dev removed a template mod from an add-on, it would still be there on your install, causing issues...
     
    imthebest likes this.
  8. imthebest

    imthebest Formerly Super120

    Since I don't know how to create add-ons, I'm currently deciding between these two places at admin.php?template-modifications/add:

    Add-on: (blank)
    Add-on: XenForo

    I guess that if I choose XenForo then my custom template modification is also going to get lost after I upgrade XenForo, right? So at the end I should leave the "Add-on" field untouched (i.e. blank), right?
     
  9. Chris D

    Chris D XenForo Developer Staff Member

    Right. But, seriously, just edit the template directly. With the frequency we actually change the member card template I can't even envisage you'd ever be in a situation where it becomes outdated.
     
  10. imthebest

    imthebest Formerly Super120

    Well, here is my problem.

    On XenForo, at the template member_card I have changed the following (on the template itself, no template modifications here):

    Find:
    Code:
    <a href="{xen:link members, $user}">{xen:phrase profile_page}</a>
    Replace with:
    Code:
    <a href="{xen:link search/member, '', 'user_id={$user.user_id}', 'content=thread'}" rel="nofollow">Threads</a>

    Since the Media Gallery have a template modification against member_card with the following config:

    Find:
    Code:
    <a href="{xen:link members, $user}">{xen:phrase profile_page}</a>
    Replace with:
    Code:
    $0
    <xen:include template="xengallery_member_card_links" />

    I need it to look for my custom:
    Code:
    <a href="{xen:link search/member, '', 'user_id={$user.user_id}', 'content=thread'}" rel="nofollow">Threads</a>
    Instead of the stock:
    Code:
    <a href="{xen:link members, $user}">{xen:phrase profile_page}</a>

    This is why I need to use a template modification. And I need to use a custom one because if I edit your own then with every MG upgrade I'll lose the changes.

    Is there an easier way to achieve what I'm looking for?
     
    Last edited: Sep 24, 2015
  11. imthebest

    imthebest Formerly Super120

    Just figured out that it was as easy as adding what is below $0 directly into the template. I feel embarrased :(

    Thanks Chris!
     
    CyclingTribe likes this.

Share This Page