Login Problem
-
Hi,
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.
-
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 2 months 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
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('/<\/p>/i', "\n\n", $html);
$html = preg_replace('/<p[^>]*>/i', '', $html);
// headings
$html = preg_replace('/<h[1-6][^>]*>(.*?)<\/h[1-6]>/is', "[b]$1[/b]\n\n", $html);
// formatting
$html = preg_replace('/<(strong|b)[^>]*>(.*?)<\/\1>/is', '[b]$2[/b]', $html);
$html = preg_replace('/<(em|i)[^>]*>(.*?)<\/\1>/is', '[i]$2[/i]', $html);
$html = preg_replace('/<u[^>]*>(.*?)<\/u>/is', '[u]$1[/u]', $html);
$html = preg_replace('/<(s|del)[^>]*>(.*?)<\/\1>/is', '[s]$2[/s]', $html);
// links & images
$html = preg_replace('/<a\s+href=["\']([^"\']+)["\'][^>]*>(.*?)<\/a>/is', '[url=$1]$2[/url]', $html);
$html = preg_replace('/<img\s+src=["\']([^"\']+)["\'][^>]*>/is', '[img]$1[/img]', $html);
// lists
$html = preg_replace('/<ul[^>]*>/i', '[list]', $html);
$html = preg_replace('/<\/ul>/i', '[/list]', $html);
$html = preg_replace('/<ol[^>]*>/i', '[list=1]', $html);
$html = preg_replace('/<\/ol>/i', '[/list]', $html);
$html = preg_replace('/<li[^>]*>(.*?)<\/li>/is', '[*]$1', $html);
// quotes & code
$html = preg_replace('/<blockquote[^>]*>(.*?)<\/blockquote>/is', '[quote]$1[/quote]', $html);
$html = preg_replace('/<(pre|code)[^>]*>(.*?)<\/\1>/is', '[code]$2[/code]', $html);
$html = strip_tags($html);
$html = html_entity_decode($html, ENT_QUOTES, 'UTF-8');
// normalize spacing
$html = preg_replace("/\n{3,}/", "\n\n", $html);
return trim($html);
}
/* ---------- phpBB PDO (SELECT ONLY) ---------- */
function wp_phpbb_pdo(): PDO {
static $pdo;
if ($pdo) return $pdo;
$pdo = new PDO(
'mysql:host=' . PHPBB_DB_HOST . ';dbname=' . PHPBB_DB_NAME . ';charset=utf8mb4',
PHPBB_DB_USER,
PHPBB_DB_PASS,
[PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]
);
return $pdo;
}
/* ---------- phpBB user_id by email ---------- */
function wp_phpbb_get_user_id_by_email(string $email): ?int {
$pdo = wp_phpbb_pdo();
$stmt = $pdo->prepare(
'SELECT user_id FROM ' . PHPBB_DB_PREFIX . 'users WHERE user_email = :email LIMIT 1'
);
$stmt->execute(['email' => $email]);
$id = $stmt->fetchColumn();
return $id ? (int)$id : null;
}
/* =====================================================
CREATE — NEW WP POST => NEW phpBB TOPIC
===================================================== */
add_action('publish_post', 'wp_phpbb_publish_create', 10, 2);
function wp_phpbb_publish_create($post_id, $post) {
if ($post->post_type !== 'post') return;
if (wp_is_post_revision($post_id) || wp_is_post_autosave($post_id)) return;
global $wpdb;
// Zaten var mı?
$exists = $wpdb->get_var(
$wpdb->prepare("SELECT phpbb_topic_id FROM wp_phpbb_topic_map WHERE wp_post_id = %d", $post_id)
);
if ($exists) return;
$lock = 'wp_phpbb_lock_' . $post_id;
if (get_transient($lock)) return;
set_transient($lock, 1, 60);
$author = get_user_by('id', $post->post_author);
if (!$author) return;
$phpbb_user_id = wp_phpbb_get_user_id_by_email($author->user_email);
if (!$phpbb_user_id) return;
// CREATE
$response = wp_remote_post(WP_PHPBB_BRIDGE_URL, [
'timeout' => 20,
'body' => [
'secret' => WP_PHPBB_BRIDGE_SECRET,
'mode' => 'post',
'user_id' => $phpbb_user_id,
'forum_id' => WP_PHPBB_FORUM_ID,
'subject' => $post->post_title,
'message' => html_to_bbcode_phpbb($post->post_content),
],
]);
if (is_wp_error($response)) return;
// ID’yi SELECT ile al
$pdo = wp_phpbb_pdo();
$stmt = $pdo->prepare("
SELECT topic_id, topic_first_post_id
FROM " . PHPBB_DB_PREFIX . "topics
WHERE forum_id = :forum
AND topic_poster = :user
AND topic_title = :title
ORDER BY topic_time DESC
LIMIT 1
");
$stmt->execute([
'forum' => WP_PHPBB_FORUM_ID,
'user' => $phpbb_user_id,
'title' => $post->post_title,
]);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
if (!$row) return;
$wpdb->insert('wp_phpbb_topic_map', [
'wp_post_id' => $post_id,
'phpbb_topic_id' => (int)$row['topic_id'],
'phpbb_first_post_id' => (int)$row['topic_first_post_id'],
'wp_author_id' => $author->ID,
'phpbb_author_id' => $phpbb_user_id,
'created_at' => current_time('mysql'),
'updated_at' => current_time('mysql'),
]);
delete_transient($lock);
}
/* =====================================================
UPDATE — WP POST UPDATE => phpBB EDIT
===================================================== */
add_action('post_updated', 'wp_phpbb_publish_update', 10, 3);
function wp_phpbb_publish_update($post_id, $post_after, $post_before) {
if ($post_after->post_type !== 'post') return;
if ($post_before->post_status !== 'publish') return;
if (wp_is_post_revision($post_id) || wp_is_post_autosave($post_id)) return;
global $wpdb;
$map = $wpdb->get_row(
$wpdb->prepare("SELECT * FROM wp_phpbb_topic_map WHERE wp_post_id = %d", $post_id)
);
if (!$map) return;
$author = get_user_by('id', $post_after->post_author);
if (!$author) return;
$phpbb_user_id = wp_phpbb_get_user_id_by_email($author->user_email);
if (!$phpbb_user_id) return;
wp_remote_post(WP_PHPBB_BRIDGE_URL, [
'timeout' => 20,
'body' => [
'secret' => WP_PHPBB_BRIDGE_SECRET,
'mode' => 'edit',
'user_id' => $phpbb_user_id,
'forum_id' => WP_PHPBB_FORUM_ID,
'topic_id' => (int)$map->phpbb_topic_id,
'post_id' => (int)$map->phpbb_first_post_id,
'subject' => $post_after->post_title,
'message' => html_to_bbcode_phpbb($post_after->post_content),
],
]);
$wpdb->update(
'wp_phpbb_topic_map',
['updated_at' => current_time('mysql')],
['wp_post_id' => $post_id]
);
}We can transfer WordPress comments using a similar method. I think it can be sent via HTTP POST.
-
This reply was modified 2 months ago by
You must be logged in to reply to this topic.