Conversation
supportHi, Notice: your username, IP or email is currently banned into our forum. Please contact an administrator. I’ve been getting this error message for a long time now. For some reason, sometimes the WP login page comes, and when I try to log in, I’m not allowed to. It used to redirect to the WP login page after logging into phpBB, but I haven’t experienced that in a long time, so I think it’s resolved.
Hello Halil! The problem with phpBB bans is about that it can be issued by username, email, IP. The plugin code use just a simple function done years ago to check, when an user login into WordPress, if one of the above is on the ban list On file class.wp.w3all-phpbb.php The function about it is public static function w3_phpbb_ban($phpbb_uid = '', $uname = '', $uemail = ''){ and it do the check about all the possibilities only when an user login in WP or the WP login flow fire. It normally DO NOT run when an user is already logged in, because in this case, the ban check is done in private static function verify_phpbb_credentials(){ within the query that check for user’s session. In this case the check is done each time the WP load but the ban check, is done only in this way as explained // Banned Deactivated trick // +- the same is done into w3_check_phpbb_profile_wpnu() // Check for ban_id: if not empty $phpbb_user_session[0]->ban_id then almost a ban by IP or EMAIL or USERNAME exists // Do not know if there is some other ban row that can exists into 'banlist', because only the first found retrieved into the query above // The complete ban check is done when user login in wordpress, because on the above main query this has been removed // REMOVED //OR ". $w3all_config["table_prefix"] ."banlist.ban_email = ". $w3all_config["table_prefix"] ."users.user_email AND ban_exclude = 0 //OR ". $w3all_config["table_prefix"] ."banlist.ban_ip = ". $w3all_config["table_prefix"] ."sessions.session_ip AND ban_exclude = 0 // THESE ARE ONLY EXECUTED, WHEN USER LOGIN (ON WP) // LIKE PHPBB DO: to cause an immediate user logout, the user in phpBB NEED to be banned by username! (so it is stored as ban_userid value) if( !empty($phpbb_user_session[0]->ban_id) && !defined("W3BANCKEXEC") ){ if( $current_user->ID > 1 ) { if( $phpbb_user_session[0]->ban_end == 0 OR $phpbb_user_session[0]->ban_end > time() ){ // no further check necessary, the only one ban value retrieved here, is a ban that never expire or that is still active setcookie ("w3all_set_cmsg", "phpbb_ban", 0, "/", $w3cookie_domain, false); //$wpdb->query("UPDATE $wpu_db_utab SET meta_value = 'a:0:{}' WHERE user_id = '$wp_user_data->ID' AND meta_key = 'wp_capabilities'"); self::w3all_wp_logout('wp_login_url'); } # NOTE TODO: could be set the bruteforce record for this user (also) here, so at next time, the code flow will stop more above without wasting resources until here # If a ban exist, even if expired, check by the way this user for bans # w3_phpbb_ban() function will remove expired bans: so the next time we'll be here up and running, in case if( self::w3_phpbb_ban($phpbb_u, $phpbb_user_session[0]->username, $phpbb_user_session[0]->user_email) === true && $phpbb_user_session[0]->group_name != 'ADMINISTRATORS' OR $phpbb_user_session[0]->ban_userid > 2 && $phpbb_user_session[0]->group_name != 'ADMINISTRATORS' ) { setcookie ("w3all_set_cmsg", "phpbb_ban", 0, "/", $w3cookie_domain, false); self::w3all_wp_logout('wp_login_url'); } } } // end ban Said that i have in mind many improvements so if you note some problem just report please! On October i will be (though) ready to publish some code about how to make phpBB so to looks like Discourse. The Posts Reply code, to me require to be changed in favor of something that display all posts within the topic, also into the normal flow, and not removing them until not added as replies into the post due to a click into Show replies button. I am not sure but seem that DIscourse works like this. To do this, i should change the code so to assign a different post ID to those that appears as posts replies when Show Replies button is clicked. This because, the idea is to let it work all together: Vertical Views, Posts Slider, Posts Replies. To make it work Posts Replies with the other two, the code require to be changed and it can be changed in several way so to accomplish with any result. Let see what i can do with the time i have or finally i will GIthub all so to check if some smart guy can help on improve! This reply was modified 10 months ago by axew3 .
I received complaints from a few people, they weren’t banned, but they did say they received a warning. As a temporary solution, I edited the language files as follows: I think I can edit the code too. Thank you.
But the problem occurs in WordPress while logging in to phpBB.
When I log in to phpBB and go to WordPress, it redirects me to the wp-admin page. Do you know about this problem?
I’m not sure, but I think if the url is sid, it redirects to wp-admin.
Hello Halil i suppose is due to the last change into file class.wp.w3all-phpbb.php private static function verify_phpbb_credentials(){ where there is this code: # if all the above failed on redirect if ( empty( $_REQUEST['redirect_to'] ) OR empty($redirect_to) ) { wp_redirect( admin_url() ); exit(); } change admin_url() with? admin_url( 'profile.php' ) ?? home_url() ?? home_url( '/my-page?id=123') ?? it should not interfere with the redirects flows so the code maybe have to be changed a little. It fire when a NOT logged in WP user, come in WP side with a valid phpBB session cookie and so, the user being logged in on fly in WP when private static function verify_phpbb_credentials(){ fire
But as said, it should not interfere with the redirects flow when it fire. Thinking on what could be… the solution?
Thank you. if ( empty( $_REQUEST['redirect_to'] ) OR empty($redirect_to) ) { wp_redirect( admin_url() ); exit(); } This was the guilty. I removed this code. I think this is what should happen. Personally, I did the following. I created a WP role called Member. It has no permissions. This is because phpBB’s profile and login system is more robust. Users have no use in the WP-Admin page. If they need to access it, I’ll already show them the necessary links. I think you should remove this code. I use the following href for WP as login url: .../forums/ucp.php?mode=login&redirect=<?php echo esc_url( home_url( $_SERVER['REQUEST_URI'] ?? '/' ) ); ?> It does what I want and it’s great. ___ edit: I also removed the “function w3_phpbb_ban” code for now. This reply was modified 9 months, 3 weeks ago by Halil .
if( isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], 'wp-login.php') OR isset($_SERVER['SCRIPT_NAME']) && strpos($_SERVER['SCRIPT_NAME'], 'wp-login.php') OR isset($_SERVER['PHP_SELF']) && strpos($_SERVER['PHP_SELF'], 'wp-login.php') OR isset($_SERVER['SCRIPT_FILENAME']) && strpos($_SERVER['SCRIPT_FILENAME'], 'wp-login.php') ) { wp_redirect( admin_url() ); exit(); } # if all the above failed on redirect if ( empty( $_REQUEST['redirect_to'] ) OR empty($redirect_to) ) { # WILL BE REMOVED # wp_redirect( admin_url() ); exit(); } This remove the problem and redirect the user to the profile just in case the page the user is on after the session have been set and the user logged in (based on the presented session phpBB cookie) is wp-login.php (because WP default do not redirect if a logged in user visit the wp-login.php page). But ok it is just a plus. On next version will be so fixed/removed. Just remove it in the while. w3_phpbb_ban () only run when strictly necessary and do not impact the site performance so why you removed the function w3_phpbb_ban ? And how? Just placing a return false; in it, or removing the call to it? This reply was modified 9 months, 3 weeks ago by axew3 .
Sorry for the late reply. Personally, I keep everything related to membership on the phpBB side. All logins and registrations also happen on phpBB. Therefore, if a user is banned, they won’t be able to log in anyway. So, I don’t think there’s any need for extra checks on the WP side. As I mentioned in this thread, these checks can malfunction. btw, Vertical Views looks nice. It doesn’t fit my usage scenario, but people might want to use it. I’ve been working on wp-phpbb topic/post syncing with AI before, but I haven’t quite achieved my goal. But you started doing this before. Is there any progress? My request is simple. When a post is published on WP, it will also be added as a topic in phpBB. It’s by the same author. I’ll prevent bots from accessing the forumview where these WP posts are added, so SEO won’t suffer and the content will be valuable on WP. When a comment is written to that post in WP, it will be added as this post to the same topic in phpBB. When a post is added to that topic in phpBB, the same will be added as a comment to that post in WP. I think need to set the wp comment and phpBB posting form submission events. Same authors, because there is member synchronization. However, in order to redirect, I must be able to place topic and comennt/phpbb post id’s in wp. An article is published in WP. -> A topic with the same title and content is created in the specified forum in phpBB. When a user comments on this article in WP, they also reply to the topic in phpBB. While the comment is added to the WP article, it is also added as a post to the topic in phpBB. When a post is posted to this topic in phpBB, it is also considered a comment to the post in WP. I need information for redirecting URLs: In WP, the topic ID, the post ID of the phpBB equivalent of the comments, and in phpBB, the WP post ID. When I also want to use the phpBB notification system… So, the goal is to add information to both databases in phpBB and WP using a single form. Even if this is done from a single location, it should be done as if it were done through the respective forms. We need to discuss some details. What kind of fe3 would you like for this?
Do you think it makes sense?
Helo Halil! Forgive me you then this time. I will be in hospital tomorrow for a surgery of my inguinal hernia that i take with me since 2016. These days i was not ok due to an episode that will constrain me to the tomorrow step. I return just now online, and in the while i did a thing offline on my time. Let see if something has been added so to be used with easy and achieve what you want. I will have probably the time to do it on next week since my situation and if all will be ok! In the while i have think to… A never seen way to be secure that our messages are not read by anyone. And that we can be sure it is. Are you sure that your privacy is complete and a secret is a secret online? With this the answer is yes …i did an HTML/JS code implementing this: https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API that bring an unparalleled security in the way it is done. Substantially, will be no way for anyone without keys to read an encrypted message that we can exchange after it has been encrypted. I am surprised that no one have never think to something like. Or i never seen around. So i like to present to the world 🙂 the unique way be secure that a message can be seen only by the people that own private and public keys. It is done in pure HTML and JS and run without any server involvement, all works within the browser ( i hope the most will use firefox 😉 ) so even offline, into any device. It is super secure using RSA 4096 bit encryption. Even with a properly sized quantum computer, the big O for Shor’s is O(N3) and would take 45 years to crack one key. There is no way to break into this concept. https://github.com/axew3/deApps see online working example here that can be used by anyone. As can be seen when used on browser, it DO NOT send anything to the server. Imagine to use it as Private mode, and much more. It is a single html js file. Unparalleled security for anyone 🙂 https://www.w3it.org/deApps/w3mypgp.html This reply was modified 7 m...
Hello Halil! The problem with phpBB bans is about that it can be issued by username, email, IP. The plugin code use just a simple function done years ago to check, when an user login into WordPress, if one of the above is on the ban list On file class.wp.w3all-phpbb.php The function about it is public static function w3_phpbb_ban($phpbb_uid = '', $uname = '', $uemail = ''){ and it do the check about all the possibilities only when an user login in WP or the WP login flow fire. It normally DO NOT run when an user is already logged in, because in this case, the ban check is done in private static function verify_phpbb_credentials(){ within the query that check for user’s session. In this case the check is done each time the WP load but the ban check, is done only in this way as explained // Banned Deactivated trick // +- the same is done into w3_check_phpbb_profile_wpnu() // Check for ban_id: if not empty $phpbb_user_session[0]->ban_id then almost a ban by IP or EMAIL or USERNAME exists // Do not know if there is some other ban row that can exists into 'banlist', because only the first found retrieved into the query above // The complete ban check is done when user login in wordpress, because on the above main query this has been removed // REMOVED //OR ". $w3all_config["table_prefix"] ."banlist.ban_email = ". $w3all_config["table_prefix"] ."users.user_email AND ban_exclude = 0 //OR ". $w3all_config["table_prefix"] ."banlist.ban_ip = ". $w3all_config["table_prefix"] ."sessions.session_ip AND ban_exclude = 0 // THESE ARE ONLY EXECUTED, WHEN USER LOGIN (ON WP) // LIKE PHPBB DO: to cause an immediate user logout, the user in phpBB NEED to be banned by username! (so it is stored as ban_userid value) if( !empty($phpbb_user_session[0]->ban_id) && !defined("W3BANCKEXEC") ){ if( $current_user->ID > 1 ) { if( $phpbb_user_session[0]->ban_end == 0 OR $phpbb_user_session[0]->ban_end > time() ){ // no further check necessary, the only one ban value retrieved here, is a ban that never expire or that is still active setcookie ("w3all_set_cmsg", "phpbb_ban", 0, "/", $w3cookie_domain, false); //$wpdb->query("UPDATE $wpu_db_utab SET meta_value = 'a:0:{}' WHERE user_id = '$wp_user_data->ID' AND meta_key = 'wp_capabilities'"); self::w3all_wp_logout('wp_login_url'); } # NOTE TODO: could be set the bruteforce record for this user (also) here, so at next time, the code flow will stop more above without wasting resources until here # If a ban exist, even if expired, check by the way this user for bans # w3_phpbb_ban() function will remove expired bans: so the next time we'll be here up and running, in case if( self::w3_phpbb_ban($phpbb_u, $phpbb_user_session[0]->username, $phpbb_user_session[0]->user_email) === true && $phpbb_user_session[0]->group_name != 'ADMINISTRATORS' OR $phpbb_user_session[0]->ban_userid > 2 && $phpbb_user_session[0]->group_name != 'ADMINISTRATORS' ) { setcookie ("w3all_set_cmsg", "phpbb_ban", 0, "/", $w3cookie_domain, false); self::w3all_wp_logo...
I received complaints from a few people, they weren’t banned, but they did say they received a warning. As a temporary solution, I edited the language files as follows: I think I can edit the code too. Thank you.
But the problem occurs in WordPress while logging in to phpBB.
When I log in to phpBB and go to WordPress, it redirects me to the wp-admin page. Do you know about this problem?
I’m not sure, but I think if the url is sid, it redirects to wp-admin.
Hello Halil i suppose is due to the last change into file class.wp.w3all-phpbb.php private static function verify_phpbb_credentials(){ where there is this code: # if all the above failed on redirect if ( empty( $_REQUEST['redirect_to'] ) OR empty($redirect_to) ) { wp_redirect( admin_url() ); exit(); } change admin_url() with? admin_url( 'profile.php' ) ?? home_url() ?? home_url( '/my-page?id=123') ?? it should not interfere with the redirects flows so the code maybe have to be changed a little. It fire when a NOT logged in WP user, come in WP side with a valid phpBB session cookie and so, the user being logged in on fly in WP when private static function verify_phpbb_credentials(){ fire
But as said, it should not interfere with the redirects flow when it fire. Thinking on what could be… the solution?
Thank you. if ( empty( $_REQUEST['redirect_to'] ) OR empty($redirect_to) ) { wp_redirect( admin_url() ); exit(); } This was the guilty. I removed this code. I think this is what should happen. Personally, I did the following. I created a WP role called Member. It has no permissions. This is because phpBB’s profile and login system is more robust. Users have no use in the WP-Admin page. If they need to access it, I’ll already show them the necessary links. I think you should remove this code. I use the following href for WP as login url: .../forums/ucp.php?mode=login&redirect=<?php echo esc_url( home_url( $_SERVER['REQUEST_URI'] ?? '/' ) ); ?> It does what I want and it’s great. ___ edit: I also removed the “function w3_phpbb_ban” code for now. This reply was modified 9 months, 3 weeks ago by Halil .
if( isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], 'wp-login.php') OR isset($_SERVER['SCRIPT_NAME']) && strpos($_SERVER['SCRIPT_NAME'], 'wp-login.php') OR isset($_SERVER['PHP_SELF']) && strpos($_SERVER['PHP_SELF'], 'wp-login.php') OR isset($_SERVER['SCRIPT_FILENAME']) && strpos($_SERVER['SCRIPT_FILENAME'], 'wp-login.php') ) { wp_redirect( admin_url() ); exit(); } # if all the above failed on redirect if ( empty( $_REQUEST['redirect_to'] ) OR empty($redirect_to) ) { # WILL BE REMOVED # wp_redirect( admin_url() ); exit(); } This remove the problem and redirect the user to the profile just in case the page the user is on after the session have been set and the user logged in (based on the presented session phpBB cookie) is wp-login.php (because WP default do not redirect if a logged in user visit the wp-login.php page). But ok it is just a plus. On next version will be so fixed/removed. Just remove it in the while. w3_phpbb_ban () only run when strictly necessary and do not impact the site performance so why you removed the function w3_phpbb_ban ? And how? Just placing a return false; in it, or removing the call to it? This reply was modified 9 months, 3 weeks ago by axew3 .
Sorry for the late reply. Personally, I keep everything related to membership on the phpBB side. All logins and registrations also happen on phpBB. Therefore, if a user is banned, they won’t be able to log in anyway. So, I don’t think there’s any need for extra checks on the WP side. As I mentioned in this thread, these checks can malfunction. btw, Vertical Views looks nice. It doesn’t fit my usage scenario, but people might want to use it. I’ve been working on wp-phpbb topic/post syncing with AI before, but I haven’t quite achieved my goal. But you started doing this before. Is there any progress? My request is simple. When a post is published on WP, it will also be added as a topic in phpBB. It’s by the same author. I’ll prevent bots from accessing the forumview where these WP posts are added, so SEO won’t suffer and the content will be valuable on WP. When a comment is written to that post in WP, it will be added as this post to the same topic in phpBB. When a post is added to that topic in phpBB, the same will be added as a comment to that post in WP. I think need to set the wp comment and phpBB posting form submission events. Same authors, because there is member synchronization. However, in order to redirect, I must be able to place topic and comennt/phpbb post id’s in wp. An article is published in WP. -> A topic with the same title and content is created in the specified forum in phpBB. When a user comments on this article in WP, they also reply to the topic in phpBB. While the comment is added to the WP article, it is also added as a post to the topic in phpBB. When a post is posted to this topic in phpBB, it is also considered a comment to the post in WP. I need information for redirecting URLs: In WP, the topic ID, the post ID of the phpBB equivalent of the comments, and in phpBB, the WP post ID. When I also want to use the phpBB notification system… So, the goal is to add information to both databases in phpBB and WP using a single form. Even if this is done from a single location, it should be done as if it were done through the respective forms. We need to discuss some details. What kind of fe3 would you like for this?
Do you think it makes sense?
Helo Halil! Forgive me you then this time. I will be in hospital tomorrow for a surgery of my inguinal hernia that i take with me since 2016. These days i was not ok due to an episode that will constrain me to the tomorrow step. I return just now online, and in the while i did a thing offline on my time. Let see if something has been added so to be used with easy and achieve what you want. I will have probably the time to do it on next week since my situation and if all will be ok! In the while i have think to… A never seen way to be secure that our messages are not read by anyone. And that we can be sure it is. Are you sure that your privacy is complete and a secret is a secret online? With this the answer is yes …i did an HTML/JS code implementing this: https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API that bring an unparalleled security in the way it is done. Substantially, will be no way for anyone without keys to read an encrypted message that we can exchange after it has been encrypted. I am surprised that no one have never think to something like. Or i never seen around. So i like to present to the world 🙂 the unique way be secure that a message can be seen only by the people that own private and public keys. It is done in pure HTML and JS and run without any server involvement, all works within the browser ( i hope the most will use firefox 😉 ) so even offline, into any device. It is super secure using RSA 4096 bit encryption. Even with a properly sized quantum computer, the big O for Shor’s is O(N3) and would take 45 years to crack one key. There is no way to break into this concept. https://github.com/axew3/deApps see online working example here that can be used by anyone. As can be seen when used on browser, it DO NOT send anything to the server. Imagine to use it as Private mode, and much more. It is a single html js file. Unparalleled security for anyone 🙂 https://www.w3it.org/deApps/w3mypgp.html This reply was modified 7 months, 2 weeks ago by axew3 .
I hope everything fine for you, I wish you a good recovery.
/** Submit Post @todo Split up and create lightweight, simple API for this. */ function submit_post($mode, $subject, $username, $topic_type, &$poll_ary, &$data_ary, $update_message = true, $update_search_index = true) { Hello Halil, as i can see it has not been adapted to be a simple API, nor into phpBB 4 at this moment (do not know at the moment of his release if it will be). Anyway, it is very easy to trick the phpBB to act like an API so to use/fire this function on request using cURL within WP and few lines of code into an extension in phpBB. These kind of things can be easily accomplished like i did for users deletion in phpBB when users are deleted in WP. It is also easy to protect the task from unwanted uses. The problem is the fact that is quite impossible to translate the formatted html that can be done into WP editor, and the (at max) bb code of a forum post. If you mean to post just a post that’s pure text this is very easy. Well it could be used my HTML on posts extension maybe to be used together so to have the html entirely parsed on posts. Mhhh… So instead, since you asked it by long time, why not…. i think to… why not to have instead the possibility to load an iframe that display the WP post, inside a phpBB post/topic? I mean, not all the WP page, but just the body content as iframe, fully visible, inside a post. It look crazy or awesome? This reply was modified 7 months, 1 week ago by axew3 .
Hello Alessio, I’m not sure how much sense it makes to use the API or pretend it exists. But here are the things I think about: * When a WP Post is published, it should be as if a new topic was published in phpBB, for example, in the forum with id 15. But when a topic is posted in phpBB, several tables and columns are affected. But it seems doable: https://www.phpbb.com/community/viewtopic.php?p=13089331#p13089331 * When a comment is written to this WP post, the post will be added to the topic in phpBB with submit_post. * Only logged in users can write, since users are integrated… I think it is possible to determine the member’s identity with the extension. So the posters are the same. * I need to be able to use the id of topics and posts added to phpBB in WP so that I can create dynamic urls such as full editor and “see in forum”. * Isn’t it possible to create code that properly converts HTML to the phpBB database instead of an iframe? Perhaps some fine-tuning is necessary. * Posts written to the topic in phpBB should also be added as wp post comments…. I admit, it’s harder than I thought. I don’t know if I should give up.
function w3_removeAllExceptBody() { echo '<script> jQuery(document).ready(function() { var a = jQuery( ".entry-content" ).clone(); jQuery("body > div:gt(0)").remove(); jQuery("#wpadminbar").remove(); jQuery("body").append(a); }); </script>'; } function w3all_jqueryLIB() { wp_enqueue_script("jquery"); } add_action('wp_enqueue_scripts', 'w3all_jqueryLIB'); add_action( 'wp_head', 'w3_removeAllExceptBody' ); the js code that can be added on the header remove all the document tags except the body, and after cloning wanted elements (in this case the .entry-content), then re-add the element. To automate this, maybe adding the needed js code only when needed, can be done considering if the post belong to specified category, or is done by specified user with specified capabilities into a specified category, or if tagged in some way, or more hard custom additions maybe adding options or any kind but the mentioned to maintain it very simple seem very good solutions. The result can se so added as iframe into the phpBB post, which will display the entire content of WP post without header and footer. You could specify an easy template to be used for posts into a specific category. Possibilities are really infinite and quite easy to be done, even if yes it require little work to be done. I used my raw html on phpBB extension to show you a possible very basic result as intended. The whole joke can be easily automated. I will take a look to the html extension i did, i will improve right now a little, adding the possibility for example, to add rules (admin, global moderators) allowed to post HTML content and a look if something can be improved again someway. Result https://files.fm/u/bcfkxdmvah#/view/yc3b97y7sc https://files.fm/u/bcfkxdmvah#/view/33rd6mamha This reply was modified 7 months, 1 week ago by axew3 .
Ps the post in phpBB with the HTML on posts extension active look like this [HTMLMARKUP] <iframe id="inlineFrameExample" title="Inline Frame Example" width="100%" height="650px" src="https://myw3host.com/a-post-for-phpbb/"> </iframe> the height need to be automated to be correct automatically. Maybe this is the most tricky part of the js code if all require to be automated. It is quite easy anyway tp be achieved adding some ajax line of code.
I don’t think the iframe is necessary. I did a test below. function html_to_bbcode($html) { $html = stripslashes($html); $html = preg_replace('/<strong[^>]*>(.*?)<\/strong>/is', '$1', $html); $html = preg_replace('/<b[^>]*>(.*?)<\/b>/is', '$1', $html); $html = preg_replace('/<h[1-6][^>]*>(.*?)<\/h[1-6]>/is', '[b]$1[/b]', $html); $html = preg_replace('/<strong[^>]*>(.*?)<\/strong>/is', '[b]$1[/b]', $html); $html = preg_replace('/<b[^>]*>(.*?)<\/b>/is', '[b]$1[/b]', $html); $html = preg_replace('/<em[^>]*>(.*?)<\/em>/is', '[i]$1[/i]', $html); $html = preg_replace('/<i[^>]*>(.*?)<\/i>/is', '[i]$1[/i]', $html); $html = preg_replace('/<u[^>]*>(.*?)<\/u>/is', '[u]$1[/u]', $html); $html = preg_replace('/<s[^>]*>(.*?)<\/s>/is', '[s]$1[/s]', $html); $html = preg_replace('/<del[^>]*>(.*?)<\/del>/is', '[s]$1[/s]', $html); $html = preg_replace('/<a\s+href=["\']([^"\']+)["\']\s*title=["\']([^"\']*)["\'][^>]*>(.*?)<\/a>/is', '[url=$1]$3[/url]', $html); $html = preg_replace('/<a\s+href=["\']([^"\']+)["\'][^>]*>(.*?)<\/a>/is', '[url=$1]$2[/url]', $html); $html = preg_replace('/<img\s+src=["\']([^"\']+)["\'][^>]*alt=["\']([^"\']*)["\'][^>]*>/is', '[img]$1[/img]', $html); $html = preg_replace('/<img\s+src=["\']([^"\']+)["\'][^>]*>/is', '[img]$1[/img]', $html); $html = preg_replace('/<ul[^>]*>/is', '[list]', $html); $html = preg_replace('/<ol[^>]*>/is', '[list=1]', $html); $html = preg_replace('/<\/ul>/is', '[/list]', $html); $html = preg_replace('/<\/ol>/is', '[/list]', $html); $html = preg_replace('/<li[^>]*>(.*?)<\/li>/is', '[*]$1', $html); $html = preg_replace('/<blockquote[^>]*>(.*?)<\/blockquote>/is', '[quote]$1[/quote]', $html); $html = preg_replace('/<code[^>]*>(.*?)<\/code>/is', '[code]$1[/code]', $html); $html = preg_replace('/<pre[^>]*>(.*?)<\/pre>/is', '[code]$1[/code]', $html); $html = preg_replace('/<hr\s*\/?>/is', "\n---\n", $html); $html = preg_replace('/<p[^>]*>(.*?)<\/p>/is', '$1' . "\n\n", $html); $html = preg_replace('/<br\s*\/?>/is', "\n", $html); $html = preg_replace('/<div[^>]*>(.*?)<\/div>/is', '$1' . "\n\n", $html); $html = strip_tags($html); $html = html_entity_decode($html, ENT_QUOTES, 'UTF-8'); $html = preg_replace('/[ \t]+/u', ' ', $html); $html = preg_replace('/\n\n\n+/u', "\n\n", $html); $html = trim($html); return $html; } add_filter('the_content', function($content) { if (is_single() && !is_admin()) { $bbcode = html_to_bbcode(get_the_content()); $output = $content; $output .= '<div style="margin-top: 30px; border: 1px solid #ddd; padding: 20px; background-color: #f9f9f9; border-radius: 5px;">'; $output .= '<h3 style="margin-top: 0;">BBCode Formatı</h3>'; $output .= '<p style="font-size: 12px; color: #666;">Bu içeriğin BBCode formatı (phpBB forumunda kullanmak için):</p>'; $output .= '<textarea readonly style="width: 100%; height: 300px; font-family: monospace; padding: 10px; border: 1px solid #ccc; border-radius: 3px; font-size: 12px;">' . esc_textarea($bbcode) . '</textarea>'; $output .= '<p style="font-size: 12px;"><button oncl...
+++ I added post_parent to phpBB post database. I’m currently working on this function. But It’s for WP. We can find the comment_parent version of the comment in wp using the post_parent id in phpBB, right? This reply was modified 7 months, 1 week ago by Halil .
++ I’m having some trouble getting post_parent into the database. How does your extension do this? I can’t seem to see it right now.
If you want published the posts replies extension i will prepare it and release in short asap. Anyway the extension do not create automatically the table into the database, i did not added the related code so this require to be done manually into the phpBB db CREATE TABLE phpbb_posts_replies ( post_id int NOT NULL, topic_id int NOT NULL, pid_reply int NOT NULL ) ALTER TABLE phpbb_posts_replies ADD PRIMARY KEY ( post_id ), ADD KEY topic_id ( topic_id ), ADD KEY pid_reply ( pid_reply ); i waited to release because i would have liked it to work together with this: https://www.axew3.com/www/phpbb4/viewtopic.php?t=2 the vertical views and posts scroller, that can be of course adjusted after then
I tried to keep it simpler. I added a column to the post table with this query. ALTER TABLE phpbb_posts ADD post_parent INT(11) NOT NULL DEFAULT 0; I used this button: <a href="#" class="post-reply-link" data-postid="{postrow.POST_ID}" data-replyto="Reply to the post #{postrow.POST_NUMBER}"><span>Reply</span></a> I added this to the quick reply editor <input type="hidden" name="post_parent" id="post_parent" value="0"> I made it change with a js. However, I was not able to process it in the database. I also added a url parameter for the Full editor page, but I left it there.
I did it. public function save_parent($event) { global $request; $post_parent = $request->variable('post_parent', 0); $sql_data = $event['sql_data']; if (isset($sql_data[POSTS_TABLE]['sql']) && $post_parent > 0) { $sql_data[POSTS_TABLE]['sql']['post_parent'] = (int) $post_parent; } $event['sql_data'] = $sql_data; } Now I can add the parents to the post table correctly. In WordPress, the comment parent is located in the comment_parent column in the wp_comments table. So, while synchronizing “WPPostComment =phpBBTopicPost”, it is necessary to ensure that *_parent are also synchronized. Come to think of it, I think we should create two separate tables: WP Post ID and its phpBB Topic ID equivalent, and WP Comment ID and its phpBB Post ID equivalent. posttopic table: wordpress_id / phpbb_id commentpost table: wordpress_id / wordpress_parent_id / phpbb_id / phpbb_parant_id Do it make sense? But should these tables be in the WordPress database, the phpBB database, or both? Can the necessary information be provided after submitting the form? Does it get complicated when you think about it a little? When a phpBB post is published, it will go to WP. If there is a parent, the parent post’s WP equivalent will be found and sent to WP. What if a comment is submit on WP but on phpBB it needs to be approved by a moderator first, or if the user is banned/limited? (I think the sample code in the link I sent also checks user permissions.) When a WP comment is submitted, should it be checked in phpBB first? If it’s subject to approval, it won’t be published in WP first. However, once it’s approved in phpBB, it goes to WP. Does that make sense? Maybe we should add an “approved” column to the commentpost table. 0/1 Did you try the BBcode converter code I sent you? I think it makes sense. When a WP post is published or updated, it is converted to bbcode and shared on forum id14 on behalf of the author. WP post id and phpBB topic id are added to the posttopic table. When a comment is written on WP, it is sent to the topic in phpBB on behalf of the user, and if it is published as visible, it is also published on WP. When written to the topic in phpBB, if it’s visible, it’s also added to wp. If there’s a parent, the IDs are added to the table and synchronized for two. Is there a need to the “approved” column? There may not be, because if it needs to be approved, the event will happen again in phpBB. Does WPComment=phpBBPost seem more difficult than WPPost=phpBBTopic? I know I’m repeating some things. I’m just trying to reduce the margin of error and make things clear. Best This reply was modified 7 months, 1 week ago by Halil . This reply was modified 7 months, 1 week ago by Halil .
I have achieved somethings in the WP to phpBB step. With author matching and DB injection via email…
With the help of aı, I made progress in the “wp to phpBB” step.
I could only perform SQL injection. I couldn’t use submit_post. SQL seems to work, but standard phpBB events may be missing and BBcode to DB conversion does not occur. add_action('publish_post', 'sync_wp_post_to_phpbb'); add_action('post_updated', 'sync_wp_post_update_to_phpbb', 10, 3); add_action('before_delete_post', 'sync_wp_post_delete_to_phpbb'); add_action('comment_post', 'sync_wp_comment_to_phpbb', 10, 3); add_action('edit_comment', 'sync_wp_comment_update_to_phpbb'); add_action('delete_comment', 'sync_wp_comment_delete_to_phpbb'); function sync_wp_post_to_phpbb($post_id) { $post = get_post($post_id); if ($post->post_status !== 'publish' || $post->post_type !== 'post') { return; } $author = get_user_by('id', $post->post_author); if (!$author) return; $phpbb_user_id = get_phpbb_user_by_email($author->user_email); if (!$phpbb_user_id) return; global $wpdb; $existing = $wpdb->get_row($wpdb->prepare( "SELECT * FROM {$wpdb->prefix}phpbb_posts WHERE wp_post_id = %d", $post_id )); if ($existing) return; $bbcode_content = html_to_bbcode_phpbb($post->post_content); $result = create_phpbb_topic($phpbb_user_id, $post->post_title, $bbcode_content); if ($result['success']) { $wpdb->insert("{$wpdb->prefix}phpbb_posts", array( 'wp_post_id' => $post_id, 'phpbb_topic_id' => $result['topic_id'], 'phpbb_first_post_id' => $result['post_id'], 'wp_author_email' => $author->user_email, ), array('%d', '%d', '%d', '%s')); error_log('WP→phpBB: Post ' . $post_id . ' → Topic ' . $result['topic_id'] . ' (Yazar: ' . $author->user_login . ')'); } } function sync_wp_post_update_to_phpbb($post_id, $post_before, $post_after) { $post = get_post($post_id); if ($post->post_status !== 'publish' || $post->post_type !== 'post') { return; } global $wpdb; $sync = $wpdb->get_row($wpdb->prepare( "SELECT * FROM {$wpdb->prefix}phpbb_posts WHERE wp_post_id = %d", $post_id )); if (!$sync) return; $author = get_user_by('id', $post->post_author); if (!$author) return; $phpbb_user_id = get_phpbb_user_by_email($author->user_email); if (!$phpbb_user_id) return; $bbcode_content = html_to_bbcode_phpbb($post->post_content); update_phpbb_post_full($sync->phpbb_first_post_id, $post->post_title, $bbcode_content, $phpbb_user_id); update_phpbb_topic_title($sync->phpbb_topic_id, $post->post_title); update_phpbb_topic_author($sync->phpbb_topic_id, $phpbb_user_id); $wpdb->update("{$wpdb->prefix}phpbb_posts", array('updated_at' => current_time('mysql')), array('wp_post_id' => $post_id) ); error_log('WP→phpBB: Post ' . $post_id . ' güncellendi (Yazar: ' . $author->user_login . ')'); } function sync_wp_post_delete_to_phpbb($post_id) { $post = get_post($post_id); if ($post->post_type !== 'post') return; global $wpdb; $sync = $wpdb->get_row($wpdb->prepare( "SELECT * FROM {$wpdb->prefix}phpbb_posts WHERE wp_post_id = %d", $post_id )); if (!$sync) return; soft_delete_phpbb_topic($sync->phpbb_topic_id); $wpdb->delete("{$wpdb->prefix}phpbb_posts", array('wp_post_id' => $post_id)); error_log('WP→phpBB: Post '...
I do not think it is the right way to do this thing. You go to insert a phpBB post via db instructions that do not accomplish i think with all what it need to be stored into the db, when a new post or topic is inserted. You forget many things like: the search indexing and all the others posts data updates that occurs each time a post/topic is inserted or removed so to maintain topics and posts stored in the correct way into the db. For this reason my suggestion to call the submit_post() via cURL. It is the unique way probably to do this thing without to become crazy because things to be managed are a lot and more than you imagine if you like to insert a post just using DB queries. The call to submit_post simplify the task, and you do not have to re-write half phpBB code to get the result. Unfortunately, maybe AI can propose you a code but AI do not know how to do things like this, it only give you confused pieces of code unified in a way that normally do not works. The unique way i see possible this task is by using cURL or DB queries when an event (insert/update/deletion) occur, and passing data using requests or calling native functions, then leaving to the native WP and phpBB functions to do their work for you about insertion or posts update or deletion. Then you have to instruct WP to display phpBB posts, and phpBB to display WP posts, without going to change the way they store data into the db. Or as said, you are doing something that will not be reliable under many aspects. This reply was modified 7 months ago by axew3 . This reply was modified 7 months ago by axew3 .
I wanted to contact you using the form on your website, but I wonder if the message was not sent?
I just sent one more form. There’s no need for the WP admin page or anything like that. the code I can add to the functions file for WP and the code I can add to my phpBB extension will suffice.
I think I’ve managed to figure out how to send from wp to phpBB(http api). I’ll start working on the function code.
But… I hope you’re okay.
Hello Halil! Much better thank You my dear. Forgive me that i have not been able to answer you also privately. I will do forgive me. Actually i am a day in hospital and another at home with all what it concerns, but all is going to be resolved soon! I read your posts and comments on what you are doing and i can say it is very hard for same reasons i explained in previous posts. I think on it and the way that could be done efficiently but what i still think is that it would be better to resolve your idea using iframes because javascript on 2025 allow to do practically all with good results. This reply was modified 6 months, 3 weeks ago by axew3 .
What about the WP integration code that allow to post in WP a phpBB post? It could so contain replies in WP, that can be displayed in phpBB via iframe into the same topic (maybe closed in phpBB, maybe not). And phpBB replies can be displayed into the WP post. And the contrary: a post in WP that represent the first post iframed into phpBB, which users can reply, and the related result can be showed as result into an iframe, inside the WP post. I think it would be amazing. DO not know if i well explained my though but i will return over it soon This reply was modified 6 months, 3 weeks ago by axew3 . This reply was modified 6 months, 3 weeks ago by axew3 .
Hello! It’s good to hear from you. Health is more valuable. I don’t know why, but iframe doesn’t feel warm to me. I seem to have completed the process of creating a new WordPress post = new phpBB topic using this option, but the update isn’t working. /forum/wp_bridge_submit.php <?php declare(strict_types=1); @ini_set('display_errors', '0'); @ini_set('html_errors', '0'); error_reporting(E_ALL); ob_start(); define('IN_PHPBB', true); $phpbb_root_path = __DIR__ . '/'; $phpEx = 'php'; require_once $phpbb_root_path . 'common.' . $phpEx; require_once $phpbb_root_path . 'includes/functions_posting.' . $phpEx; $user->session_begin(); $auth->acl($user->data); $user->setup(); $request->enable_super_globals(); $SECRET = 'SUPEASasaR_SECsaRET_SAsKASEY'; if (!hash_equals($SECRET, $request->variable('secret', ''))) { ob_end_clean(); echo json_encode(['success' => false]); exit; } $mode = $request->variable('mode', 'post'); $user_id = (int)$request->variable('user_id', 0); $forum_id = (int)$request->variable('forum_id', 0); $topic_id = (int)$request->variable('topic_id', 0); $post_id = (int)$request->variable('post_id', 0); $subject = $request->variable('subject', '', true); $message = $request->variable('message', '', true); $sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE user_id = ' . $user_id; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); if (!$row) exit; $real_userdata = $user->data; foreach ($row as $k => $v) { if (array_key_exists($k, $user->data)) { $user->data[$k] = $v; } } $auth->acl($user->data); $uid = $bitfield = ''; $options = 0; generate_text_for_storage($message, $uid, $bitfield, $options, true, true, false); $data = [ 'forum_id' => $forum_id, 'topic_title' => $subject, 'post_subject' => $subject, 'poster_id' => $user->data['user_id'], 'poster_ip' => $user->ip, 'icon_id' => 0, 'enable_bbcode' => 1, 'enable_smilies' => 0, 'enable_urls' => 1, 'enable_sig' => 1, 'enable_indexing' => 1, 'notify' => 0, 'notify_set' => 0, 'message' => $message, 'message_md5' => md5($message), 'bbcode_uid' => $uid, 'bbcode_bitfield' => $bitfield, 'post_edit_locked' => 0, 'force_approved_state' => true, ]; $poll = []; if ($mode === 'edit') { $data['topic_id'] = $topic_id; $data['post_id'] = $post_id; submit_post('edit', $subject, $user->data['username'], POST_NORMAL, $poll, $data); } else { submit_post('post', $subject, $user->data['username'], POST_NORMAL, $poll, $data); } $user->data = $real_userdata; $auth->acl($user->data); ob_end_clean(); header('Content-Type: application/json'); echo json_encode(['success' => true]); exit; PW functions.php define('WP_PHPBB_BRIDGE_URL', 'https://abc.com/forum/wp_bridge_submit.php'); define('WP_PHPBB_BRIDGE_SECRET', 'SUPEASasaR_SECsaRET_SAsKASEY'); define('WP_PHPBB_FORUM_ID', 24); /* ---------- HTML → phpBB BBCode ---------- */ function html_to_bbcode_phpbb($html) { $html = stripslashes($html); // block → satır $html = preg_replace('/<br\s*\/?>/i', "\n", $html); $html = preg_replace...