TheCrow 3 Posted December 20, 2018 Add Instagram as contact field to your forumHello 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. InstallationIntroductionFirst 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 CreationFirst 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 : OptionalURL 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 decisionDisplay : Tick both Profiles and Messages (if you want the field to be shown on the profiles and in the messages)Display type : TextWho 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 choiceType : Web addressDefault content : (leave blank)And finally press the Save button. With that we are done with the profile.Javascript CodeNow 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 additionPlacement : In all the pagesJavascript 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.InformationThese 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.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:Step 1: Press Right Click on the Instagram picture you just created and then click Inspect ElementThen a new window will open where you have to see what field_id is written above the marked part that is shownThen you replace that field id number in your javascript.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.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 urlCode:https://i.servimg.com/u/f60/19/06/26/04/insta310.pngwith your new Instagram image url.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 partCode:.attr('title','View the user\'s Instagram account');and more specifically theCode:View the user\'s Instagram accountBE CAREFUL If you will use theCode:'or the Code:"symbols you have to add the escape slashCode:\before it or nothing will work as shown above.ResultProfiles:Messages:That's all, and I hope you enjoyed the tutorial. Official tutorial link of English Support Forum: https://help.forumotion.com/t156778-add-instagram-as-contact-field-to-your-forum© forumotion.com 1 Share this post Link to post Share on other sites