vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=246)
-   -   Miscellaneous Hacks - Adding Facebook/Facebook Messenger as a Communication Option (https://vborg.vbsupport.ru/showthread.php?t=326172)

scottkoz20 03-02-2018 10:00 PM

Adding Facebook/Facebook Messenger as a Communication Option
 
1 Attachment(s)
With my forum being a Trading and Buy/Sell Forum, communication is a key and vital for members making deals. This hack is really opening up another mode of communication to allowing my members to communicate.

The hack is adding Facebook Messenger as a communication option to your forum.

NOTE: This does require your members to have a Facebook Account and is using Messenger.

The steps are fairly straight forward, but does require some template and profile hacks as well as image uploads.

1) Download the images and upload them to your forums images/misc directory

1 - Messenger Icon -https://vborg.vbsupport.ru/external/2018/03/1.png


2) Need to add a Profile Fields (Admincp->User Profile Fields->Add New User Profile Field)
Note - I added a Profile Group Called PayPal

Field 1 - Facebook/Messager
Name - Facebook/Facebook Messenger
Description - Add your Facebook (Messenger) username to add on your profile
Field Required - No
Editable - Yes
Private, Searchable, Show on Memberlist - No
Rest leave as default (unless you wish to set this)

Make sure that you jot down the field ID numbers!


There are 2 options that you can use to enable this hack.

Option 1 - User Postbit
Go to Styles & templates->Style Manager->Edit Template of the Style you wish to change

Find the postbit or postbit_legacy template (depends which one you are using for your forum) - Doubleclick to Edit
Note - I used postbit_legacy but this should be the same for postbit

Find the following

Code:

<dt>{vb:rawphrase posts}</dt> <dd>{vb:raw post.posts}</dd>
and below, add the following

Code:

<!-- Facebook/Messenger-->
<br />
<div align="Left">
<vb:if condition="$post['fieldXX']"><a href="https://m.me/{vb:raw post.fieldXX}" target="_blank"><img src="IMAGE FOLDER/messenger.png" alt="Contact {vb:raw post.fieldXX} on Messenger" border="" /></a></vb:if>
</div>
<br />
<!--Facebook/Messenger-->

Note - Make sure you replace the XX's in the fieldXX with your fieldid from the Profile Field setup

Could look as such this when applied

https://vborg.vbsupport.ru/external/2018/03/2.png

FYI - You can use the same type of structure to add other items like Twitter, Facebook, etc...


Test!


Option 2 - Member Action Dropdown

For this option there are 2 ways you can do this

1) Template Hack
2) Plug-in

You don't need both - either one should work

Template Hack

Go to Styles & templates->Style Manager->Edit Template of the Style you wish to change

Find the memberaction_dropdown - Doubleclick to Edit

Find the following

Code:

                               
{vb:rawphrase send_email}
                        </a>
                </li>
                </vb:if>

and below the Ending IF, add the following

Code:

<vb:if condition="$memberinfo['fieldXX']">
                <li class="left">
                        <a href="https://m.me/{vb:raw memberinfo.fieldXX}" target="_blank" class="siteicon_profile">
                                Contact me on FB<BR>Messenger
                        </a>
                </li>
</vb:if>

When applied, your members will see the following

https://vborg.vbsupport.ru/external/2018/03/3.png


Plug-in
Thanks to MarkFL for this. If you choose to you a plug-in, this is the code that would need to be added.

Create a plugin hooked at "memberaction_dropdown" with the PHP code:

Code:

if ($memberinfo['fieldxx'])
{
    $template_hook['memberaction_dropdown_items'] .= '<li class="left">
            <a href="https://m.me/' . $memberinfo['fieldxx'] . '" target="_blank" class="siteicon_profile">
                Contact me on FB <BR> Messenger
            </a>
        </li>';
}

Again, you only need to use 1 of the 2 methods to tie this into the Memberaction_dropdown.


Again, Test


Lastly, alert your members to the change and bask in the praise of your genius (in your members eyes :D )


Notes -
1st release on 3 March 2018

scottkoz20 03-03-2018 09:51 PM

Reserved

AS a point of note - on the Profile fields, you COULD separate Facebook from Facebook Messenger if you decide this is the best route for your site, you would need to get a Facebook Icon and upload it to your Image folder of your choice.

MentorBR 07-05-2022 07:05 PM

Is there a way to do it through whatsapp instead of Facebook Messenger?


All times are GMT. The time now is 09:12 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00961 seconds
  • Memory Usage 1,728KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete