1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.4 Update legacy likes to preserve anonymity

Discussion in 'XenForo Questions and Support' started by Gossipy, Oct 13, 2014.

  1. Gossipy

    Gossipy Member

    We imported a VB board into XF recently. All the VB "reputations" (aka 'karma') were imported into XF as "likes". On the VB board, reputation was anonymous. However now, all the "likes" are associated with the user that gave them, so if a user cares enough they can go back and figure out who gave them negative/positive reputation. We haven't yet activated the "likes" feature on XF for users.

    We considered just deleting all the likes to preserve privacy, but that seemed extreme. Then my helper suggested that we can "execute a MySQL query that would go through the XF DB and assign all historical likes to the existing anonymous userID."

    We actually have an account that is anonymous; it's used for anonymous posts. Is there an easy SQL query we can execute that would assign ALL previous 'likes' to that user? To make it look like they all came from that anonymous user?

    Thanks in advance!! :)
  2. Mouth

    Mouth Well-Known Member

    UPDATE xf_liked_content SET like_user_id = xx;

    where xx = the user id of your 'anonymous' account
    Gossipy likes this.
  3. Gossipy

    Gossipy Member

    Thank you, @Mouth. We just tried your suggestion and got an error:

    Failed to execute SQL : SQL UPDATE xf_liked_content SET like_user_id = 88; failed : Duplicate entry 'post-17145-119' for key 'content_type_id_like_user_id'
  4. Mouth

    Mouth Well-Known Member

    Sorry, cannot help with that. Not sure why it would throw an index error for like_user_id. Perhaps you have duplicate data from import?
  5. Mike

    Mike XenForo Developer Staff Member

    A person can only like a post once, so that's expected. There isn't really a way to make likes anonymous. Removing the likes is really the only recommendation I could make (and I would have to do that by not running that step in the importer rather than by editing the DB).
  6. Gossipy

    Gossipy Member

    Wow, that stinks. The site's been running on XF for a month or two now (with likes turned off) and so there's really no way to re-import (we'll lose 2+ months of activity if we re-import from VB). I guess we need to figure out a way to just delete all the likes.... :(
  7. AndyB

    AndyB Well-Known Member

  8. Gossipy

    Gossipy Member

  9. AndyB

    AndyB Well-Known Member

    Yes use phpMyAdmin.
  10. Mouth

    Mouth Well-Known Member

    CREATE TABLE xf_liked_content_bak LIKE xf_liked_content;
    INSERT xf_liked_content_bak SELECT * FROM xf_liked_content;
    TRUNCATE xf_liked_content;
    Gossipy likes this.

Share This Page