Login Issue after Paid Membership Pro Integration

User avatar
axew3
w3all User
w3all User
Posts: 2713
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Login Issue after Paid Membership Pro Integration

Post by axew3 »

Hello!
Paid Memberships Pro
https://github.com/strangerstudios/paid-memberships-pro
is a great plugin, thank you to let me discover that there is a good substitute for memberpress (which do not exist as free version).
I will test (and surely use!) it more deeply asap.

Let fix all. First, i see that you set all ok about the JS code (header and footer) but into the overall_footer.html there is a problem:
why there is two times the same code added into the overall_footer.html?
Seem that you added the same JS code two times, remove the one or the other and leave one in place:

Code: Select all

<script type="text/javascript">
// START MANDATORY CHANGES
var w3allAllowDomain = 'https://www.suicidekingscarclub.com'; // MANDATORY! // Set/Change this value with your WordPress URL (example: https://axew3.com)
var wordpress_url_page_forum = 'https://www.suicidekingscarclub.com/forums'; // MANDATORY! // (DO NOT ADD/INCLUDE final slash here) Url that point to your iframed wordpress forum page
var w3all_custom_wp_w3fancyurl = 'suicidekings'; // MANDATORY! If you 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 boardU = "https://www.suicidekingscarclub.com/forum/";
 
// Lightbox scroll fix:
// remove /* and */ to activate, also more below to complete ...
/*
$(".postimage").on("click", function(event) {
var pos = event.pageY - 100;
 $(parent.window).scrollTop( 200 );
var el = document.getElementById("lightbox");
$("#lightboxOverlay").on("click", function() {
$(parent.window).scrollTop( pos );
});
$(".lb-close").on("click", function() {
$(parent.window).scrollTop( pos );
});
$(".lightbox").on("click", function() {
$(parent.window).scrollTop( pos );
});
});
*/
 
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 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(boardU);
   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(boardU) > -1) != true){
 if(/^(f|ht)tps?:\/\//i.test(href))
 {
  e.preventDefault();
  parent.location.replace(href);
 return;
 }
}
 
if ( /\/adm\//ig.exec(href) !== null )
{
  e.preventDefault();
  parent.location.replace(href);
 return;
}
 
if ( href.indexOf('view=print') > -1 !== false )
{
 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;
}
 
// complete Lightbox correct attachment display // activate removing /* and */
// or used to open on new tab attachments
/*
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){
 
$("#quickmod,.bookmark-link").on("click", function(event) {
var pos = window.scrollY + document.querySelector('#quickmod').getBoundingClientRect().top;
  $(parent.window).scrollTop( 200 );
$("#darkenwrapper").on("click", function() {
  $(parent.window).scrollTop( pos );
});
 $("#darken").on("click", function() {
  $(parent.window).scrollTop( pos );
});
});
 
var pmn = "0";
var w3all_phpbb_u_logged = "";
 
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;
 }
}
 
if( typeof w3allNOappend == 'undefined' || w3allNOappend == false )
{
 $( window ).on( "load", function()
 {
  location.hash = "#" + hash;
  if( location.hash.length < 2 ){
    var w3all_lochash = 0;
  } else {
    var w3all_lochash = $(location.hash).offset().top;
  }
  var w3append = '#w3all_phpbbpmcount=' + pmn + '#w3all_phpbb_u_logged=' + w3all_phpbb_u_logged + '#w3all_lochash=' + w3all_lochash;

   window.parent.postMessage({
    //'func': 'w3all_ajaxup_from_phpbb',
    'message': JSON.stringify(w3append)
   }, w3allAllowDomain);

 // fix vertical iframe centered in certain cases
  var w3iOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);
  if(w3iOS == false)
  {
   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%;margin:0px;");
   }
  }
 });
}
/*if (window.performance){
 if( performance.getEntriesByType("navigation")[0].type == 'back_forward' )
 {
  var w3E = performance.getEntriesByType("navigation");
  var w3ER = w3allNormalize_phpBBUrl(w3E[0].name);
  parent.w3all_phpbb_pushUrlToParentOnBackForward(w3ER);
 }
}*/
} // END if(window.self !== window.top){
</script>
<script type="text/javascript" src="https://www.suicidekingscarclub.com/forum/iframeResizer.contentWindow.min.js" defer></script>
There is no need to add the same two times.
Ok, then i just registered on fly onto your site to try out what it happen and it seem to me that there is a problem with the appended index.php on redirect.
So will be fixed on coming 2.7.5.

So, if using page forum,
open page-forums.php (as you named it) into your active template folder with a text editor and change the following lines please:

Code: Select all

$w3all_url_to_cms_sw .= (substr($w3all_url_to_cms, -1) == '/' ? '' : '/index.php');
change into:

Code: Select all

$w3all_url_to_cms_sw .= (substr($w3all_url_to_cms, -1) == '/' ? '' : '/');
AND line

Code: Select all

document.location.replace('".$w3allhomeurl."/index.php/".$wp_w3all_forum_folder_wp."/');
change into:

Code: Select all

document.location.replace('".$w3allhomeurl."/".$wp_w3all_forum_folder_wp."/');
if using the shortcode template integration, the same need to be done, instead, into the file:
/wp-content/plugins/wp-w3all-phpbb-integration/views/wp_w3all_phpbb_iframe_short.php
OR, if you activated the option for custom files (Use custom files to display Last Topics Widgets, Login Widget and Shortcodes)
and so you copied all /views/ folder files, into/inside the custom created folder
/wp-content/plugins/wp-w3all-custom
then you have to edit the file
/wp-content/plugins/wp-w3all-custom/wp_w3all_phpbb_iframe_short.php.

Give a shot when done.
Let see after this applied what it happen!

[EDITED]
fediddy
User ww
User ww
Posts: 20
Joined: Tue Oct 03, 2023 5:25 pm

Re: Login Issue after Paid Membership Pro Integration

Post by fediddy »

You are very welcome. Make sure you check out all the other repos under their username. All the addons are free as well. I learned that a lot of paid plugins are free on github. Its weird... Anyways... I must of smoked a big fat joint when I pasted and edited the Foot twice. I have changed it to one instance. I deleted the page-forums.php file, I deleted the Forums page, I recreated the page, I regenerated the file, I edited the file as you said. I edited /wp-content/plugins/wp-w3all-phpbb-integration/views/wp_w3all_phpbb_iframe_short.php and I edited /wp-content/plugins/wp-w3all-custom/wp_w3all_phpbb_iframe_short.php just to be safe. Here is what is happening now.

When I go to https://www.suicidekingscarclub.com/forums/ and login as a regular user, the site just keeps refreshing in a loop. If i hit refresh it goes to https://www.suicidekingscarclub.com/home/ with a critical error. When I go to https://www.suicidekingscarclub.com/ after that. It works.

Same thing happens if I log in as an Administrator (first user created)..

I then logged out and tried to use the Iframe on the main page with a regular user. I get a critical error.

I am wondering if I did something else wrong.. What I did was make you an administrator so you can poke around and see what my dumbasss is doing wrong :)


I have one question, after all of this is figured out and from what I see, I think you will have it up and running in no time. How will updating the Wordpress Plugin and the PHPBB Plugin affect the site. Will everything get over written and I have to make a note of what all needs to change in each file? Thank in advance. Also, i'd like to make a small donation for your hard work.. This is freaking impressive.
fediddy
User ww
User ww
Posts: 20
Joined: Tue Oct 03, 2023 5:25 pm

Re: Login Issue after Paid Membership Pro Integration

Post by fediddy »

axew3 wrote: Sun Nov 05, 2023 9:01 am Hello!
Paid Memberships Pro
https://github.com/strangerstudios/paid-memberships-pro
is a great plugin, thank you to let me discover that there is a good substitute for memberpress (which do not exist as free version).
I will test (and surely use!) it more deeply asap.

Let fix all. First, i see that you set all ok about the JS code (header and footer) but into the overall_footer.html there is a problem:
why there is two times the same code added into the overall_footer.html?
Seem that you added the same JS code two times, remove the one or the other and leave one in place:

Code: Select all

<script type="text/javascript">
// START MANDATORY CHANGES
var w3allAllowDomain = 'https://www.suicidekingscarclub.com'; // MANDATORY! // Set/Change this value with your WordPress URL (example: https://axew3.com)
var wordpress_url_page_forum = 'https://www.suicidekingscarclub.com/forums'; // MANDATORY! // (DO NOT ADD/INCLUDE final slash here) Url that point to your iframed wordpress forum page
var w3all_custom_wp_w3fancyurl = 'suicidekings'; // MANDATORY! If you 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 boardU = "https://www.suicidekingscarclub.com/forum/";
 
// Lightbox scroll fix:
// remove /* and */ to activate, also more below to complete ...
/*
$(".postimage").on("click", function(event) {
var pos = event.pageY - 100;
 $(parent.window).scrollTop( 200 );
var el = document.getElementById("lightbox");
$("#lightboxOverlay").on("click", function() {
$(parent.window).scrollTop( pos );
});
$(".lb-close").on("click", function() {
$(parent.window).scrollTop( pos );
});
$(".lightbox").on("click", function() {
$(parent.window).scrollTop( pos );
});
});
*/
 
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 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(boardU);
   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(boardU) > -1) != true){
 if(/^(f|ht)tps?:\/\//i.test(href))
 {
  e.preventDefault();
  parent.location.replace(href);
 return;
 }
}
 
if ( /\/adm\//ig.exec(href) !== null )
{
  e.preventDefault();
  parent.location.replace(href);
 return;
}
 
if ( href.indexOf('view=print') > -1 !== false )
{
 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;
}
 
// complete Lightbox correct attachment display // activate removing /* and */
// or used to open on new tab attachments
/*
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){
 
$("#quickmod,.bookmark-link").on("click", function(event) {
var pos = window.scrollY + document.querySelector('#quickmod').getBoundingClientRect().top;
  $(parent.window).scrollTop( 200 );
$("#darkenwrapper").on("click", function() {
  $(parent.window).scrollTop( pos );
});
 $("#darken").on("click", function() {
  $(parent.window).scrollTop( pos );
});
});
 
var pmn = "0";
var w3all_phpbb_u_logged = "";
 
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;
 }
}
 
if( typeof w3allNOappend == 'undefined' || w3allNOappend == false )
{
 $( window ).on( "load", function()
 {
  location.hash = "#" + hash;
  if( location.hash.length < 2 ){
    var w3all_lochash = 0;
  } else {
    var w3all_lochash = $(location.hash).offset().top;
  }
  var w3append = '#w3all_phpbbpmcount=' + pmn + '#w3all_phpbb_u_logged=' + w3all_phpbb_u_logged + '#w3all_lochash=' + w3all_lochash;

   window.parent.postMessage({
    //'func': 'w3all_ajaxup_from_phpbb',
    'message': JSON.stringify(w3append)
   }, w3allAllowDomain);

 // fix vertical iframe centered in certain cases
  var w3iOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);
  if(w3iOS == false)
  {
   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%;margin:0px;");
   }
  }
 });
}
/*if (window.performance){
 if( performance.getEntriesByType("navigation")[0].type == 'back_forward' )
 {
  var w3E = performance.getEntriesByType("navigation");
  var w3ER = w3allNormalize_phpBBUrl(w3E[0].name);
  parent.w3all_phpbb_pushUrlToParentOnBackForward(w3ER);
 }
}*/
} // END if(window.self !== window.top){
</script>
<script type="text/javascript" src="https://www.suicidekingscarclub.com/forum/iframeResizer.contentWindow.min.js" defer></script>
There is no need to add the same two times.
Ok, then i just registered on fly onto your site to try out what it happen and it seem to me that there is a problem with the appended index.php on redirect.
So will be fixed on coming 2.7.5.

So, if using page forum,
open page-forums.php (as you named it) into your active template folder with a text editor and change the following lines please:

Code: Select all

$w3all_url_to_cms_sw .= (substr($w3all_url_to_cms, -1) == '/' ? '' : '/index.php');
change into:

Code: Select all

$w3all_url_to_cms_sw .= (substr($w3all_url_to_cms, -1) == '/' ? '' : '/');
AND line

Code: Select all

document.location.replace('".$w3allhomeurl."/index.php/".$wp_w3all_forum_folder_wp."/');
change into:

Code: Select all

document.location.replace('".$w3allhomeurl."/".$wp_w3all_forum_folder_wp."/');
if using the shortcode template integration, the same need to be done, instead, into the file:
/wp-content/plugins/wp-w3all-phpbb-integration/views/wp_w3all_phpbb_iframe_short.php
OR, if you activated the option for custom files (Use custom files to display Last Topics Widgets, Login Widget and Shortcodes)
and so you copied all /views/ folder files, into/inside the custom created folder
/wp-content/plugins/wp-w3all-custom
then you have to edit the file
/wp-content/plugins/wp-w3all-custom/wp_w3all_phpbb_iframe_short.php.

Give a shot when done.
Let see after this applied what it happen!

[EDITED]


Any word brother?
User avatar
axew3
w3all User
w3all User
Posts: 2713
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Login Issue after Paid Membership Pro Integration

Post by axew3 »

Ehy!
Sorry for the delay, just a shot to let you know that i am alive :)
and just away from home, and very busy, but finally today (right now) i had a little time to turn on my pc when finally at home!
Ok let see tomorrow, i will return in reply asap!

p.s did you set something that set that page as redirect for some reason?
fediddy
User ww
User ww
Posts: 20
Joined: Tue Oct 03, 2023 5:25 pm

Re: Login Issue after Paid Membership Pro Integration

Post by fediddy »

I dont recall having any redirects set. I have tried to search but cannot find them. I gave you full admin access. Also there is a file browser plugin on wordpress.
fediddy
User ww
User ww
Posts: 20
Joined: Tue Oct 03, 2023 5:25 pm

Re: Login Issue after Paid Membership Pro Integration

Post by fediddy »

So, i disabled the Wordfence plugin and I swear it started working on my PC but not on the iphone. I remembered that the page I use as my homepage is name ‘Home’. I changed the name of it to ‘index’, deleted cache on wordpress, logged out on my iphone and tried again logging in through the forum page via the forum. Believe it or not, it worked. I am going to reenable the Wordfence plugin later and check.
Post Reply