A Personalized Share this page Widget

A Personalized Share this page Widget

frm

Well-known member
frm submitted a new resource:

A Personalized Share this page Widget - Send a customized message with a share to invite someone to your forum.

Marked as Beta due to compatibility issues between 2.2 (earlier versions than 2.2.9, not being able to hide an HTML widget not in advanced mode) and 2.3 (not allowing advanced mode for HTML widgets in the sidebar).

First, create a custom user field userRealName in profile details as a Single-line text box to grab your user's real name (whether first or last). This will help customize the shareable message to personalize it for the receiver.

Then, create the HTML widget.

For...

Read more about this resource...
 
Alternatively, you can use the default share widget to send a personalized message.

Edit template share_page_macros

Find:
Code:
                    <xf:if is="$xf.options.webShare">
                        <a class="shareButtons-button shareButtons-button--share is-hidden" href="#{$id}"
                            data-xf-init="web-share"
                            data-title="{$pageTitle}" data-text="{$pageDesc}" data-url="{$pageUrl}"
                            data-hide=".shareButtons-button:not(.shareButtons-button--share)">

                            <xf:fa icon="far fa-share-alt" />
                            <span>{{ phrase('share') }}</span>
                        </a>
                    </xf:if>

And change it to:
Code:
                    <xf:if is="$xf.options.webShare">
                        <a class="shareButtons-button shareButtons-button--share is-hidden"
                            data-xf-init="web-share"
                            data-text="<xf:if is="$xf.visitor.Profile.custom_fields.userRealName">
    {{ $xf.visitor.Profile.custom_fields.userRealName }} (@{{ $xf.visitor.username }})<xf:elseif is="$xf.visitor.username" />
    @{{ $xf.visitor.username }}<xf:else />
    Someone</xf:if> thought that you would enjoy {{ $xf.options.boardTitle }} — {{ $xf.options.boardDescription }}.

{{ $xf.options.boardTitle }} can be found at: {{ $xf.options.homePageUrl }}

However, they might think that you would be more interested in this:" 
                        data-hide=".shareButtons-button:not(.shareButtons-button--share)">
                            <xf:fa icon="far fa-share-alt" />
                            <span>{{ phrase('share') }}</span>
                        </a>
                    </xf:if>

The purpose of this addon was to make sharing more enticing with a CTA banner as opposed to a Font Awesome icon.

But, having both isn't a bad idea.
 
Back
Top Bottom