Add Instagram as contact field to your forum Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

    Add Instagram as contact field to your forum

    TheCrow
    TheCrow
    Manager
    Manager


    Male Posts : 6921
    Reputation : 795
    Language : Greek, English

    Tutorial Add Instagram as contact field to your forum

    Post by TheCrow November 22nd 2018, 2:28 pm

    Add Instagram as contact field to your forum
    Hello dear all,

    In this tutorial I will show you an easy way, to create an Instagram field for your forum and have it to the contact information with the rest social media information.

    Installation

    Introduction

    First of all, this new field will be exactly like the Facebook field. That means you only have to add the extension to the link. (Example: If my profile is
    Code:
    www.instagram.com/luffy
    then I only add
    Code:
    luffy
    to the field) The rest will be done automatically.

    Field Creation

    First of all we have to create this field. So to do so, we go: Admin Panel > Users & Groups > Users - Profiles (and select the "Contact fields" tab) and press the icon to create a new field. Then you have to fill in the information as below:
    • Name : Instagram (color of your choice)
    • Description : Optional
    • URL icon :
      Code:
      https://i.servimg.com/u/f60/19/06/26/04/insta310.png
      (NOTE! This image url is necessary for our code.)
    • Necessarily filled ? Your decision
    • Display : Tick both Profiles and Messages (if you want the field to be shown on the profiles and in the messages)
    • Display type : Text
    • Who can modify the profile field value ? Tick both Moderators and Member himself (You can tick whatever you want)
    • Display this field for users that are at least : Your choice
    • Type : Web address
    • Default content : (leave blank)

    And finally press the Save button. With that we are done with the profile.

    Javascript Code

    Now all we need, is a Javascript to make the field work as the Facebook field.
    Before that, let's create the javascript. Go to: Admin Panel > Modules > HTML & JAVASCRIPT - Javascript codes management and make sure the Enable Javascript code management : is set to Yes and then press the CREATE A NEW JAVASCRIPT button to create your Javascript. Once you've created your javascript you only have to fill in the information as below to finish your work:
    • Title * : Instagram field addition
    • Placement : In all the pages
    • Javascript Code * : Copy and paste this code in your field:

      Code:
      /* ------------------------------------------------------------------------

      **************** COPYRIGHTS ©️ 2018, LUFFY - FORUMOTION.COM ****************

      - Please do not try to post a new tutorial using this code to your forum.
      - This code is written by Luffy for Forumotion.com forums only.
      - Please ask your questions at https://help.forumotion.com
      - Please do not remove these comments.
      - Tutorial Link: /t156778-add-instagram-as-contact-field-to-your-forum
      --------------------------------------------------------------------------- */

      $(function(){
       
        if(/\/?u(\d+)contact$/.test(location.pathname)) {
          $('dl#field_id1 dd a').attr('title','View the user\'s Instagram account');
          if ($('dl#field_id1 dd a[href*="http://"]')){
            var ifgr_instagram_src = $('dl#field_id1 dd a').attr('href').slice(7);
          }
          if ($('dl#field_id1 dd a[href*="https://"]')){
            var ifgr_instagram_src = $('dl#field_id1 dd a').attr('href').slice(8);
          }
          $('dl#field_id1 dd a').attr('href', 'https://www.instagram.com/' + ifgr_instagram_src);
        }
       
        if (/t(\d+)/.test(window.location.pathname)) {
          $('a[title*="website"]').has('img[src*="https://i.servimg.com/u/f60/19/06/26/04/insta310.png"]').addClass('InstagramPage');
          $('a.InstagramPage').attr('title','View the user\'s Instagram account');
          if ($('a.InstagramPage[href*="http://"]')){
            var ifgr_instagram_src2 = $('a.InstagramPage').attr('href').slice(7);
          }
          if ($('a.InstagramPage[href*="https://"]')){
            var ifgr_instagram_src2 = $('a.InstagramPage').attr('href').slice(8);
          }
          $('a.InstagramPage').attr('href', 'https://www.instagram.com/' + ifgr_instagram_src2);
        }
       
      });


    And then press the SUBMIT button to save the javascript. With this we are officially over.
    BEFORE YOU CLOSE THE TOPIC: Please read the below information just in case something is not working properly.

    Information

    These information are for forums that don't use the English language to their forum or use an other picture for the profile field. Please read the carefully.
    1. If you have created an other field in the Contact fields before then you have to check on the field id to correctly execute the code. This field id is used in the first section of the javascript where it says
      Code:
      $('dl#field_id1 dd a')
      of which the
      Code:
      dl#field_id1
      is the field id. If you have an other id, all you have to do is replace it with yours and you will be fine. Note that this part is SIX times in the first part.
      How to check my field's id:
    2. Then based on your language you should be able to see what it says on your website field on hover. (Example: the default website field says: "Visit poster's website". Now based on your language this text differs. This part, we need it for this part of the code:
      Code:
      $('a[title*="website"]')
      where you have to replace the word website with the word your forum has for the website field.
    3. Next up, right after the above code you will see this part
      Code:
      .has('img[src*="https://i.servimg.com/u/f60/19/06/26/04/insta310.png"]')
      which has the image url I mentioned above. Now if you change the image url to something else, you will have to add the exact url in this code and specifically replace the url
      Code:
      https://i.servimg.com/u/f60/19/06/26/04/insta310.png
      with your new Instagram image url.

    4. Finally if you want to change the text Visit the user's Instagram account that appears when you hover your contact field then all you have to do is change this part
      Code:
      .attr('title','View the user\'s Instagram account');
      and more specifically the
      Code:
      View the user\'s Instagram account
      BE CAREFUL If you will use the
      Code:
      '
      or the
      Code:
      "
      symbols you have to add the escape slash
      Code:
      \
      before it or nothing will work as shown above.



    Result

    Profiles:
    Add Instagram as contact field to your forum Profil10

    Messages:
    Add Instagram as contact field to your forum Messag10


    That's all, and I hope you enjoyed the tutorial. Smile :rose: I love you



    Add Instagram as contact field to your forum Thecro10
    Forum of the Forums

    Forumotion Rules | Tips & Tricks |
    FAQ | Did you forget your password?



    *** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
    No support via PM!

    skouliki likes this post