Go Back   vb.org Archive > vBulletin Modifications > vBulletin 5.x Modifications > vBulletin 5.x Template Modifications
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
[vBMods.rocks] Instagram BBCode Details »»
[vBMods.rocks] Instagram BBCode
Version: 1.00, by noypiscripter noypiscripter is offline
Developer Last Online: Sep 2023 Show Printable Version Email this Page

Category: BB Code Enhancements - Version: 5.3.2 Rating:
Released: 09-07-2017 Last Update: Never Installs: 4
Supported
 

One way to integrate social media with forums is to embed posts from Instagram into forum posts.

Go to AdminCP > Custom BB Codes > Add New BB Code and enter the following information:

Title: Instagram
BB Code Tag Name: ig
Replacement:
Code:
<div data-ig-param="{param}"></div>
<script>
!function(){function k(e,t){var a=Element.prototype;return(a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.msMatchesSelector||function(e){return-1!==[].indexOf.call(document.querySelectorAll(e),this)}).call(e,t)}function g(a,c){if(a.closest){return a.closest(c)}
return a?k(a,c)?a:"HTML"===a.tagName?null:g(a.parentNode,c):null}var b="{param}",a,e=document.getElementsByTagName("script"),e=e[e.length-1],f;f=e.parentNode.querySelector('[data-ig-param="{param}"]:empty'),(a=g(f,".js-post"))?a=a.getAttribute("data-node-id"):(a=g(f,".js-post-sm"),a=a.getAttribute("data-nodeid")),a="ig_"+(a||"")+"_"+b,window[a]=function(a){f.innerHTML=a.html;if(!window.instgrm||!window.instgrm.Embeds||!window.instgrm.Embeds.process){a=f.getElementsByTagName("script");for(var c,d=document.getElementsByTagName("head")[0],b=0;b<a.length;b++)a[b].src?(c=document.createElement("script"),c.src=a[b].src,d.appendChild(c)):eval(a[b].textContent)}else{window.instgrm.Embeds.process()}};var h=document.createElement("script");h.src="//api.instagram.com/oembed/?url="+encodeURIComponent("http://instagr.am/p/{param}/")+decodeURIComponent("%26")+"callback="+a,e.parentNode.appendChild(h)}();
</script>
Example: [ig]InstagramPostIdHere[/ig]
Other Options: Select Yes to all starting from "Remove Tag If Empty" option

Button Image (optional): /path/to/instagram/icon.png

You could download this Instagram icon:
Right click and choose "Save image as..." and then upload to your server. Then specify the image path in the Button Image option. If specified, a new button for this BB Code will appear in the editor.


How to Get Instagram Post ID:
While in an Instagram post in an overlay, click the "..." in a post and then click "Go to post". The post will be opened in a new tab/window. The ID is in the URL. If you are already in a post in a new tab/window and not in overlay, then just look for the ID in the URL. The URL has this format:

https://www.instagram.com/p/XXXXXXXXX/

where XXXXXXXXX is the post ID

Demo:

See demo here

Other sites may implement this same Instagram BBCode but the embedded Instagram post may not appear when reply is posted or when editing and saving or when previewing which is all done via AJAX in vB5. This version of mine works in those scenarios.

This mod uses the latest way to embed Instagram posts via the oEmbed endpoint. See more info at https://www.instagram.com/developer/embedding/

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:53 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03420 seconds
  • Memory Usage 2,207KB
  • Queries Executed 15 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete