Skip to:

Social Networking: Link Problem

  • Michael



    I seem to be having many problems with my forum, most of them being mine.

    So here goes the next one:

    I am in the process of creating an additional item on the topic page that lets the member share the topic on Facebook, Twitter, and the like. I do not wan’t to use SocialIt as it puts it on every post, which starts to look messy. I have a neat forum.

    So, I opened topic.php in my template’s directory and found the place where I need to add the code to achieve this.

    At first, I added this, which worked: (bb_current_page_url is my own function)

    <li><?php printf(__('Share this topic on <a target="_blank" href="$s">Facebook</a>'), bb_current_page_url() ?></li>

    Then I wanted to add a title as per Facebook’s Sharer specifications. This means that I must add &t=<the-title>, where I put the cutom title in <the-title>.

    So I did this:

    <li><?php printf(__('Share this topic on <a target="_blank" href="$s&t=%2$s">Facebook</a>'), bb_current_page_url(), topic_title()) ?></li>

    and it returned this:

    DataSets and DataTableAdaptersShare this topic on Facebook

    <string>Note: If you hover your mouse over “Facebook”, you’ll see that the URL has been cut off – which is why the title appears before the entire printf() function.

    It should return this:

    Share this topic on Facebook

    I’m obviously doing something wrong with printf(), but I doubt it as it’s literally a copy-paste from the other printf()’s on that page.

    I also want to stick to printf() as I will have multiple sites to link to, and I do not want to keep repeating things. I just want to refer to %1$s and %2$s for each entry.

    Could anyone help me get out of this mess?


Viewing 3 replies - 1 through 3 (of 3 total)

  • Michael


    By the way – this is not actually a mess, it’s just a hassle. I could easily go without the titles as most social networking sites get the page title automatically.

    It would just be nice to know where my problem lies so I don’t stumble into it again.

    Ben L.


    Add get_ before topic_title.



    Thanks! :) :)

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar