iframe not increasing in height

NinjaBeaver
User w
User w
Posts: 12
Joined: Wed Apr 30, 2025 11:55 pm

iframe not increasing in height

Post by NinjaBeaver »

Hi,

Love this plugin, and after a lot of fiddling I've got it running well on a staging site using the GeneratePress theme and Ultimate Member. The one thing I can't seem to get working is the resizing of the iframe. If I go into the ACP while in the iframe on longer pages the bottom is cut off. I may be missing something really obvious so I apologise in advance if that's the case. I haven't been able to add new forums as I can't get to the save button in the ACP.

I've tried assigning 100vh to the iframe ID in 'Additional CSS' in the Customizer, but this didn't help.

Thanks
Sarah
User avatar
axew3
w3all User
w3all User
Posts: 3110
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Skype: axewww

Re: iframe not increasing in height

Post by axew3 »

Hello Sarah: shortcode way or the page-forum?
the overall_footer.html to be added is this (and you have to set phpBB Recompile Stale Template setting into ACP to YES):

Code: Select all

<!-- IF not S_IS_BOT -->
<script type="text/javascript">
// START MANDATORY CHANGES
var w3allAllowDomain = 'https://w3host.com'; // MANDATORY! Set/Change this value to fit the absolute domain (DO NOT ADD/INCLUDE final slash here)
var wordpress_url_page_forum = 'https://w3host.com/forum'; // MANDATORY! (DO NOT ADD/INCLUDE final slash here) Url that point to the wordpress forum page
var w3all_custom_wp_w3fancyurl = 'w3'; // MANDATORY! If changed the default w3 to have 'fancy URL' query string into the related WP plugin admin option, then change this value to match the same as it is the fancy URL setting
// END MANDATORY CHANGES

var w3allappend = false;
var w3all_BoardUrl = "{BOARD_URL}";
w3all_BoardUrl = w3all_BoardUrl.slice(-1) != '/' ? w3all_BoardUrl + '/' : w3all_BoardUrl;

function w3allNormalize_phpBBUrl(href){
// try to 'normalize' passed relative links: needed all after last slash /
// exception are kind of passed urls like: /phpbb323/app.php/help/faq
// and if SEO mods that may assign some different kind of links values
// by the way, SEO absolute urls http(s) should be (all?) already considered here ...
var phpbbRUrl = href.split(/^.+?(\w+.+)$/);
if( href.indexOf('app.php') > -1 ){ // since the previous do not 'normalize' this type of passed value (and may miss something else)
   phpbburl = href.split(/^.+?(app\.php.+)$/);
   w3allappend = phpbburl[1];
 } else if ( /^https?/ig.exec(href) !== null ){ // absolute http(s) passed: try to 'normalize' a possible seo mod
   phpbburl = href.split(w3all_BoardUrl);
   w3allappend = phpbburl[1];
 } else if ( phpbbRUrl[1] && phpbbRUrl[1].length > 1 ){ // 'normalize' any other
   w3allappend = phpbbRUrl[1];
 } else if ( phpbbRUrl[0].length > 1 ){
   w3allappend = phpbbRUrl[0];
   }
// ... if still not normalized
if(/^\W/ig.exec(w3allappend) !== null){
  w3allappend = w3allappend.split(/^.+?(\w+.+)$/);
  if(w3allappend[1]){
    w3allappend = w3allappend[1];
  }
  if ( w3allappend[1] && w3allappend[1].charAt(0) == '/' ){
    w3allappend = w3allappend[1].substr(1);
  }
}
return w3allappend;
}

$(document).on("click", "a", function(e) {
  var href = $(this).attr("href");
  var w3all_onview_attach = (href.indexOf('file.php') > -1);

if( this.getAttribute('target') !== null ){
  e.preventDefault();
  window.open(href,'_blank');
 return;
}

if ( href.charAt(0) == '#' || href.indexOf('\./download\/file\.php') > -1 ){ return; }

// external link?
if ((this.href.indexOf(w3all_BoardUrl) > -1) != true){
 if(/^(f|ht)tps?:\/\//i.test(href))
 {
  e.preventDefault();
  parent.location.replace(href);
 return;
 }
}
// admin ACP?
if ( /\/adm\//ig.exec(href) !== null )
{
  e.preventDefault();
  parent.location.replace(href);
  return;
}

if ( href.indexOf('view=print') > -1 !== false || /\/adm\//ig.exec(href) !== null )
{
 e.preventDefault();
 window.open(href,'_blank');
 return;
}

if ( href.indexOf('quickmod') > -1 ) {
   w3allNOappend = true;
    return;
}

if( /posting\.php\?mode=[reply|post|bump]/ig.exec(href) !== null || /mcp\.php\?/ig.exec(href) !== null ){
  w3allNOappend = true;
}

if(w3all_onview_attach !== false){
 e.preventDefault();
 window.open(href,'_blank');
 return;
}

w3allappend = w3allNormalize_phpBBUrl(href);

if ('parentIFrame' in window){
  if( typeof w3allNOappend == 'undefined' || w3allNOappend == false ){
    window.parentIFrame.sendMessage(w3allappend);
  }
 }
});

// w3all UPDATES for phpBB events

if(window.self !== window.top){

// Lightbox scroll fix, #phpbb_confirm scroll fix, #phpbb_alert scroll fix, #bbcode_wizard + abbc3_button fix
$(".dropdown-contents-cp,.abbc3_button,.postimage,.dropdown-contents li a,#add_files").on("click", function(e) {
  var g = $($(this.getBoundingClientRect().top));
  var t = parseInt(g[Object.keys(g)[0]]);
  $("#bbcode_wizard,#phpbb_alert,#phpbb_confirm").animate({top: t+'px'}, 100);

 const w3LBfixImgs = setInterval(exec_w3LBfixImgs, 500); //1000
 function exec_w3LBfixImgs() {
   var imh  = parseInt($('.lb-image').css("height"));
   var lbOh = parseInt($('#lightboxOverlay').css("height"));
   var totH = imh+t;
    if(totH < lbOh){
      $("#lightbox").animate({top: t+'px'}, 400);
    } else {
      t = parseInt((lbOh-imh)-100);
      $("#lightbox").animate({top: t+'px'}, 400);
    }
   clearInterval(w3LBfixImgs);
 }
});

var pmn = "{PRIVATE_MESSAGE_COUNT}";
var w3all_phpbb_u_logged = "{S_USER_LOGGED_IN}";

var hash = window.location.hash.substr(1);

if( hash == 'unread' ){
 var postN = 1;
 $( "h3 > a" ).each(function (e) {
  ns = this.href.split('#p');
  if( typeof ns != 'undefined' && /viewtopic.php\?p=/ig.exec(this.href) != null ){
   if(ns[1] > postN){
     w3lh = ns[1];
    }
  }
 })

 if( typeof w3lh != 'undefined' ){
  hash = "p" + w3lh;
 }
}

$( document ).ready(function() {
 // fix vertical iframe centered in certain cases
   var bd = document.getElementsByTagName("body");
   var t = document.getElementById(bd[0].getAttribute("id"));

   if( typeof t != 'undefined' || t != false )
   {
         t.setAttribute("style", "position:fixed;top:0;left:0;width:100%;padding:0");
      //t.setAttribute("style", "position:fixed;top:0;left:0;width:100%;");
   }
});

if( typeof w3allNOappend == 'undefined' || w3allNOappend == false )
{
 $( window ).on( "load", function()
 {
  location.hash = "#" + hash;
  if( ! $(window.location.hash).length || location.hash.length < 2 ){
    var w3all_lochash = 0;
  } else {
    var w3all_lochash = $(window.location.hash).offset().top;
  }

  var w3appendevents = '#w3all_phpbbpmcount=' + pmn + '#w3all_phpbb_u_logged=' + w3all_phpbb_u_logged + '#w3all_lochash=' + w3all_lochash;

  window.parent.postMessage(w3appendevents, w3allAllowDomain);

 });
}
} // END if(window.self !== window.top){
</script>
<div data-iframe-size="" style="height:0;max-height:0;border:0;margin:0;padding:0;"><div>
<script type="text/javascript" src="https://forum.w3host.com/iframe-resizer.child.js"></script>
<!-- ENDIF -->
then add the
iframe-resizer.child.js
and into the above added code, change in this line (bottom of the code) the url
<script type="text/javascript" src="https://forum.w3host.com/iframe-resizer ... "></script>
so to point to the file you added into the phpBB root. Use an absolute (https://...) url like it is in the example.
Also, into the code added, follow and set as required for you this starting part:

Code: Select all

// START MANDATORY CHANGES
var w3allAllowDomain = 'https://w3host.com'; // MANDATORY! Set/Change this value to fit the absolute domain (DO NOT ADD/INCLUDE final slash here)
var wordpress_url_page_forum = 'https://w3host.com/forum'; // MANDATORY! (DO NOT ADD/INCLUDE final slash here) Url that point to the wordpress forum page
var w3all_custom_wp_w3fancyurl = 'w3'; // MANDATORY! If changed the default w3 to have 'fancy URL' query string into the related WP plugin admin option, then change this value to match the same as it is the fancy URL setting
// END MANDATORY CHANGES
I have the new code that work without the use of the included external iframe resizer library quite ready: very soon the shorter and faster version completely standalone, the iframe v6 will be released.
If still any problem let know, included the link to your site (pm so i can see what it is wrong, but following the above you should be up and running).
Are you using the shortcode way or the page-forum?
If using the shortcode way, did you activated the shortcode into the PAGE you added it, by adding the name/slug of the page into the related plugin option?

[EDITED]
NinjaBeaver
User w
User w
Posts: 12
Joined: Wed Apr 30, 2025 11:55 pm

Re: iframe not increasing in height

Post by NinjaBeaver »

Hi axew3

Thank you for replying. I'm using the shortcode within a container in a page with the slug "forum". I need to do that as it's behind the member login and is styled to look part of the members area.

Do I need to add all of the below when using the shortcode? I'm OK with editing the style pages but by no means an expert. I'm also using a slightly adapted version of the "CleanSilver" theme, not sure if that makes a difference?

I'm happy to give you access if you want to see the page. I'll have to message you the details though, it's all behind the membership login.

Many thanks
Sarah
User avatar
axew3
w3all User
w3all User
Posts: 3110
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Skype: axewww

Re: iframe not increasing in height

Post by axew3 »

Ok go, i will set it and explain in 2 min
NinjaBeaver
User w
User w
Posts: 12
Joined: Wed Apr 30, 2025 11:55 pm

Re: iframe not increasing in height

Post by NinjaBeaver »

I'm having problems logging in now. I thought I'd solved this. So sorry I probably won't be able to give you a login until I can fix it again. I think it's cookie related. Working on a staging URL is a bit of a pain.

No rush, I'm just grateful for the help.
User avatar
axew3
w3all User
w3all User
Posts: 3110
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Skype: axewww

Re: iframe not increasing in height

Post by axew3 »

Read this:
Shortcode Template integration
if still in trouble let know