Re-link previous owned post on BOB to your current profile

Hello,

@bernard_timbal was asking to me last week if it’s possible to re-link the posts he have created previously on BOB to his current profile (instead of the default @system user actually).

During the migration process we have decided with @DaveRathbun that it will be too much work to do it during the migration (ask for each user etc…), but I think it can be possible now. I just want to check if some are interested in such process, and I will spend some time on it.

Thanks for your vote !

Do you want to re-link old posts to your current profile ?
  • Yes
  • No

0 voters

That’d be really useful.And it’s probably not doable to link old posts to new, is it? Only I frequently google stuff which points to the old forum, which is now a dead end …

Debbie

1 Like

Yes, I am interested in it.

Thanks.

1 Like

I have a work in progress regarding changing internal links (old ur to new url). But I can’t change google or other sites :wink: But slowly old links will be dereferenced by google and new url will be foundable on google. It will take just time.

2 Likes

Hi Julien,

I think we need this, I’m not able to open a link to any of the old questions on the old forum, it asks for my username and password (which I lost and reset) and the temp password I got in the email doesn’t work.

Thanks,
Mohammed

HI @Mohammed
Previous forums have been shutdown so topics are not available anymore. I have a work in progress to replace old link to new url, if you have some expertise on regex + postgresql I can use it :smiley: (the topic id are the same!):

https://bobj-board.org/t/254765 -> https://bobj-board.org/t/254765

I would love to relink older posts to my username. Heck I even have the same username hehe.
Also, if there is a way to re-route google results of older BOB forum to this new one?

1 Like

Unfortunately, this is not planned. But as the old BOB forum is not serving the content anymore, I hope it will be slowly replaced by bobj-board links (when I see the activity level of bot user, I think google and others already know each page of this site :crazy_face: )

1 Like

And it’s finally here !

Reference ruby script
cd /var/discourse
./launcher enter app
rails c
def relink_posts(user_id, bob_login)
  regex = /\n\n---\n\n\*\*#{bob_login}\*\* (:\w+: |)_\(BOB member since (\d{4}-\d{2}-\d{2})\)_/
  posts = Post.where("raw ~ ?", '\n\n---\n\n\*\*' + bob_login + '\*\* (:\w+: |)_\(BOB member since \d{4}-\d{2}-\d{2}\)_')
  post_modified = 0
  since = nil
  
  # Reaffect posts
  posts.find_each do |post|    
    puts "work on #{post.topic_id} #{post.id} #{post.created_at}"
    post.raw.match(regex) do |m|
      since = m[2]
      new_raw = post.raw.gsub(m[0], "")
      post.update_column(:user_id, user_id)
      post.update_column(:raw, new_raw)
      post.update_column(:baked_version, nil)
      post_modified = post_modified + 1
    end
  end
  
  # Set user creation date
  user = User.find_by_id(user_id)
  user.update_column(:created_at, since)
  
  post_modified
end

# how to use ?
relink_posts(NEW_USER_ID, 'olduser')

I have a little rails script that can:

  • re-link content from system user to your new Discourse user, based on the signature at the end of the post
  • remove this signature (as it is correctly linked to your user)
  • set the user creation date based on the creation date in BOB (still relying on the signature)

This is a manual process to run the script. I will not run this script for every single user, you will have to ask for it. Here is the steps:

  • Send a message to @admins requesting to ‘relink previous owner post on BOB to my current profile’ with following info:
    • your old profile name
    • I will already have your new profile info
  • Then wait. I am not providing any deadline for running the script. It is a manual script I do it when I can :slight_smile: Do not hesitate to participate (if lots of profiles I will choose profiles with most interactions )
  • When the script will be launched for your user I will warn you by direct message.

:partying_face:

1 Like

And I can confirm that it works. :mrgreen:

1 Like