Notifications
Clear all

wpForo 1.x.x [Solved] Convert bbPress Quotes to wpForo Quotes

18 Posts
3 Users
5 Likes
1,069 Views
OMTesla
Posts: 217
Topic starter
(@omtesla)
Active Member
Joined: 8 years ago

Hello

I m trying to convert the old bbPress Quotes to the wpForo ones, by doing search replace in the database, this how it is bbPress code and wpForo one.

Check my attachment because it seems wpForo is damaging what I write with codes.

17 Replies
Chris
Posts: 3650
(@chris)
Famed Member
Joined: 3 years ago

Hi @itesla,

What you are doing won't fix your problem. You need  a PHP script to fix the issue with regular expressions, and this is not an easy work with which I could help you here, you will need a Developer for such a work.

And I want to let you know that we have Go2wpForo free tool, which can help to migrate from several forums to wpForo. I would recommend you to check the information about the tool: https://wpforo.com/docs/root/migrate-to-wpforo/

 

 

15 Replies
OMTesla
(@omtesla)
Joined: 8 years ago

Active Member
Posts: 217
Posted by: @chris

Hi @itesla,

What you are doing won't fix your problem. You need  a PHP script to fix the issue with regular expressions, and this is not an easy work with which I could help you here, you will need a Developer for such a work.

And I want to let you know that we have Go2wpForo free tool, which can help to migrate from several forums to wpForo. I would recommend you to check the information about the tool: https://wpforo.com/docs/root/migrate-to-wpforo/

 

 

Hello

My forum is already migrated to wpForo, the developers helped long time ago.

Not sure why Robert did not find a solution for this problem yet, because those quotes are displayed as ordinary text and it's confusing when reading the old replies. I want to keep my website as an archive for the future generations and everything must be proper.

Thank you.

Tutrix
(@tutrix)
Joined: 4 years ago

Noble Member
Posts: 1268

@itesla 

ask for a code on > Stack Overflow
I think you need a code like this > BBCODE, preg_replace and double quotes

OMTesla
(@omtesla)
Joined: 8 years ago

Active Member
Posts: 217

@tutrix 

Where should I add this code?

<?php
$out = '[quote=user1;1] [quote=user0;0]some content herethis is my reply to user0 post';
$cnt = 1;
while($cnt != 0){
    $out = preg_replace('/\[quote\=(.*?);(.*?)\](.*?)\[\/quote\]/ms', '<blockquote>Posted by: \1 at \2.<br/>\3</blockquote>', $out, -1, $cnt);
}
echo $out;

I m sure it's not in functions php.

Thank you for good idea.

Tutrix
(@tutrix)
Joined: 4 years ago

Noble Member
Posts: 1268

@itesla 

This is only an example, this code does not work for your problem.
You must ask there for the correct code.

OMTesla
(@omtesla)
Joined: 8 years ago

Active Member
Posts: 217

@tutrix 

I think it does the same thing I need, I have read that topic, please tell me where it must be added so I test, if it will not work then I will ask them on my problem, thank you.

Tutrix
(@tutrix)
Joined: 4 years ago

Noble Member
Posts: 1268

@itesla 

again

the code above is not complete, and has nothing to do with wpForo, BBPress or Wordpress
if you apply in it will crash the forum

OMTesla
(@omtesla)
Joined: 8 years ago

Active Member
Posts: 217

@tutrix 

Ok I will ask them, but I doubt they will help, I try to solve other plugin problem and they deleted my topic, because that plugin was paid but it was no longer supported.

Thanks.

OMTesla
(@omtesla)
Joined: 8 years ago

Active Member
Posts: 217

@tutrix 

Hello
I asked for help but there is zero reply, it's like people just ignore me, same thing on wordpress,org.
Well i will show them soon who is the daddy.

Tutrix
(@tutrix)
Joined: 4 years ago

Noble Member
Posts: 1268

@itesla 

try this simple code, is without the user ID

<?php
while(preg_match('#\[quote\](.*)\[\/quote\]#isU', $tmpText))
$tmpText = preg_replace('#\[quote\](.*)\[\/quote\]#isU', '<blockquote>$1</blockquote>', $tmpText);
?>
Tutrix
(@tutrix)
Joined: 4 years ago

Noble Member
Posts: 1268

maybe Benjamin has the right code for you 😉 

https://regexland.com/bbcode/

OMTesla
(@omtesla)
Joined: 8 years ago

Active Member
Posts: 217

@tutrix 

Where it must be added?
Thank you.

Tutrix
(@tutrix)
Joined: 4 years ago

Noble Member
Posts: 1268

@omtesla 

I use for code snippets the Code Snippets Plugin

but have you already tested WP BBCodes to HTML Parser

OMTesla
(@omtesla)
Joined: 8 years ago

Active Member
Posts: 217

@tutrix 
I have try your code, then I installed the plugin but does not work, i even edited the plugin file to include a specific number from a reply and it still did not convert it, might be because the plugin is very old and abandoned.
Anyway I will ask some coder for help.

Thanks for all your help, God bless you.

Tutrix
(@tutrix)
Joined: 4 years ago

Noble Member
Posts: 1268

@omtesla 

I have tested this now with 2 quotes from this > topic

you can see it here and also edit >  https://regex101.com/r/sRSOfp/1

but unfortunately do not know how to apply this now via wordpress 😕 

OMTesla
(@omtesla)
Joined: 8 years ago

Active Member
Posts: 217

@tutrix 

I will have a look, maybe learn coding myself, thank you!

OMTesla
Posts: 217
Topic starter
(@omtesla)
Active Member
Joined: 8 years ago

I have solved my issue thanks to my free developer buddy ChatGPT.

First I did this.

Searched in database

[quote quote=

and replaced with

<blockquote data-postid=

On the second run, searched for


and replaced with

</blockquote>

But then I run into another problem: if I search and replace ] with > it'll replace other things in post content as well.

I asked ChatGPT how to replace ] at the end of any =94857] with > so it does not touch other reply content with same ] ending, he reply as below. And I have resolved my issue, converted all old bbPress quotes to wpForo ones, he also provided codes for functions php but they were not showing when i was checking, this is possible because of Forum has cache, so I ended up with search/replace in the database. Of course there are other ways to do it but this is how i solved my old case.

P.s. not sure what is with writing in the forum that i had to edit many times this reply to make it display proper.

You can use the "Search and Replace" feature in phpMyAdmin to replace the "]" character with ">". Here are the steps:

  1. Log in to phpMyAdmin and select the database containing the forum tables.

  2. Click on the table you want to modify.

  3. Click on the "Search" tab at the top of the page.

  4. In the "Find" field, enter the following regular expression:

    (postid=\d+)(])

    This will match any string containing "postid=" followed by one or more digits, followed by a closing bracket "]" character.

  5. In the "Replace with" field, enter the following string:

    $1>

    This will replace the closing bracket "]" character with the ">" character, while keeping the "postid=" and digit string intact.

  6. Select the column(s) you want to modify. For example, if you want to modify the post content, select the "post_content" column.

  7. Check the "Use regular expression" checkbox.

  8. Click the "Go" button to perform the search and replace operation.

Note: Before making any changes to your database, it's always a good idea to create a backup.