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

XF 1.5 How to make a 'start a conversation' link?

Discussion in 'XenForo Questions and Support' started by empire, Nov 11, 2015.

  1. empire

    empire Well-Known Member

    We tried this:

    [url=http://denofangels.com/conversations/add?to={$visitor.username}] Start a Conversation [/url]
    But it doesn't work on usernames with a space. The working URLs (as on the member profile) convert the space to a '+'. Is there a way to make this work so that we can add links like this to posts?
  2. Chris D

    Chris D XenForo Developer Staff Member

    It's a bit unclear how you're wanting to do this as the concepts are a little mixed here.

    You're demonstrating using template syntax inside BB code which isn't a scenario that would likely work.

    Where is this code being used?
  3. empire

    empire Well-Known Member

    We're using Simple Forms to make classified ads and want to include a link at the end to start a conversation directly. So it would be bbcode, and it actually does work, just not with names that have spaces.

    (I asked the Simple Forms developer and he said it was a general xf question, so I asked here.)
  4. Chris D

    Chris D XenForo Developer Staff Member

    Well, it's easy to say that, but it's not quite a general XF question. You're talking about somehow using template parameters inside BB code which is literally a situation that is impossible in XF itself.

    Presumably the add-on supports replacing {$visitor.usernme} with the username, but obviously in terms of the add-on we have no idea what else it supports or doesn't support.

    Putting that to one side, though, this is generally expected. The process of adding a + or %20 in a URL in place of a space is done by a function called url_encode. If the add-on can support url_encode on the visitor username, then that's what needs to be done. If not, then there's no solution. If the add-on supports {xen:link} syntax then that will handle it automatically.

    That all said, most browsers will handle it gracefully anyway, so it should work with just a space.
    empire likes this.

Share This Page