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

Variables available for phrases

Discussion in 'XenForo Questions and Support' started by Ryan Mitchell, Sep 26, 2013.

  1. Ryan Mitchell

    Ryan Mitchell Member

    Hi all --

    I'm trying to update some phrases used in email notifications sent out to members for watched forums. Specifically I want the name of the forum included in the subject of the email. I found another phrase (the email footer) using "node_title" but when I tried that in the subject using the "new_thread_in_watched_forum_x", it just skipped over it and included that variable name as is: "{node_title}" (without the quotes). Am I missing something here?
     
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    Variables for phrases are defined when the phrase is called. You'll need to edit the email template to modify the way the phase Is called to insert a variable. If need be, you may need an add-on to fetch said information.
     
  3. Ryan Mitchell

    Ryan Mitchell Member

    Ahh, perfect! Didn't know that's how that worked. Now that I'm looking at the email template it makes sense. Is there a handy guide as to the variables you can use in the email template, then? I ended up creating the node_title by using $thread.node_title - but I only used that because it's used elsewhere in the template so I just copied. (great artists steal, right?) :)
     
  4. Jeremy

    Jeremy XenForo Moderator Staff Member

    Variables (and information) available to templates are defined within the controllers creating the templates. If you need extra information, you'll need to extend these and insert your own variables for use by the template.
     
  5. Ryan Mitchell

    Ryan Mitchell Member

    Right, but where do I find the variables that have been defined - I'm assuming that's at the PHP code level - is that accessible to me?
     
  6. Ryan Mitchell

    Ryan Mitchell Member

    ... and not even the mechanism I'm using to add node_title is working for me now. Is there a process I need to go through in order to "rebuild" the email templates in a cache or something like that?
     
  7. Jeremy

    Jeremy XenForo Moderator Staff Member

  8. Ryan Mitchell

    Ryan Mitchell Member

    Thanks Jeremy - that helps. However, still having some issues getting the change to the email template - which should be creating a variable at this point and passing it into the phrase function - to actually "take". My thought is that maybe I need to rebuild a cache that include email templates, since the phrase is acting like the variable is still undefined. Any thoughts here?
     
  9. hqarrse

    hqarrse Active Member

    @Ryan Mitchell , I want to do the same modification, add the node name to notification emails, did you ever manage to do it and if so can you share the details? Thanks
     
  10. Ryan Mitchell

    Ryan Mitchell Member

    Hi @hqarrse - I think I did but that was before the latest upgrade which I think reset some of those settings. I haven't re-enabled on the new templates at all. The new templates actually have them towards the bottom of the email so that's okay for now, but I'd like to re-enable it when I have the time. Hasn't been a priority for me yet, though. Sorry.
     

Share This Page