XF 2.0 Permalink/direct link window gone

adamDFKC

Member
Before I updated my forum to 2.0, users were able to click on the post number on a post and a window would pop up to let them copy a link directly to that post. Now when you click the post number, it just reloads the page and targets that post number. Is there a way to get that window back to make it easier for them to copy a link directly to a post?
 
Is there a way to make it copy the url to clipboard instead of reloading the page at that new url? I'm failing to think of a scenario where someone would want to click on the post number and have the page reload. I can easily think of a scenario where someone would want to click on the post number in order to share that post.
 
Old Xenforo and current vBulletin have a window pop up when you click on the post number and the pop up includes instructions about sharing that particular post. This works very well because many of my users aren't figuring out that they can right click (or press and hold on mobile) on the page number and copy the link to share that post.

Instead of my users posting links directly to posts they want to share, I'm getting a lot of: "Check out post number 72 on this other thread..."

I guess all I'm getting at is your solution is not intuitive so it is not being done by my users. I wish there was some way to bring back the Share Post pop up or even make it to where when they left click (or tap on mobile) the post number, it automatically copies the link address and gives a little text notification that says "Link copied to clipboard."
 
If what you want is a copy to clipboard feature on each post, it seems to be is possible to do this with a template modification to post_macros. I've included an example below which adds a small copy post url button next to the post number. However, it needs a visible text input to work properly (which I've tried to hide without totally hiding it ;)). A hidden input field will throw a javascript error.

This is what the example looks like on the default XF2 style:
xenforo2-post-url-copy-to-clipboard.webp

In post_macros, find:
Code:
<a href="{{ link('threads/post', $thread, {'post_id': $post.post_id}) }}" class="u-concealed" rel="nofollow">#{{ number($post.position + 1) }}</a>

Add below:
Code:
<form style="display:inline" data-xf-init="share-input">
    <input type="text" class="shareInput-input js-shareInput" style="width: 8px; border: none; opacity: 0.05" readonly="readonly" value="{{ link('canonical:threads/post', $thread, {'post_id': $post.post_id}) }}" />
    <a class="u-concealed is-hidden">
        <span class="fa fa-chain js-shareButton" style="cursor:pointer" data-xf-init="tooltip" title="{{ phrase('copy_to_clipboard')|for_attr }}"></span>
    </a>
</form>

<xf:js>
    jQuery.extend(XF.phrases, {
    text_copied_to_clipboard: "{{ phrase('link_copied_to_clipboard')|escape('js') }}"
    });
</xf:js>

This code is just an example. Perhaps you (or someone else) can modify/improve it to work as a button without the textbox form element. :)
 
@adamDFKC Nevermind my basic example above, as something more elaborate is coming as standard in XenForo 2.1 :D:

Per post share controls

In XF 1 we used to have an overlay that could be accessed by clicking on the post position number that gave you various share controls.

We're bringing back something similar in XF 2.1 but hopefully in a more useful and accessible way.

As well as being able to share directly to various social media outlets, you can also copy a link to the content directly to the clipboard.

What's better is that this share control is written in a fairly generic way so should add-on developers want to add this to their own add-ons it is very simple to do so.

From HYS thread XF2.1 Content bookmarks and the return of per-post share controls.
 
Top Bottom