Skip to:
Content
Pages
Categories
Search
Top
Bottom

How do you ‘Find and Replace’ a word in the BP Activity table in the Database?

  • @rossagrant

    Participant

    Basically, I have changed my admin’s display name on my site and this changes the display name EVERYWHERE but in past activity stream posts.

    I can manually change the name in each post in the activity table in the DB but there are 141 instances.

    Is there a way to search and replace the name automatically?

    Thanks

    Ross :)

Viewing 7 replies - 1 through 7 (of 7 total)
  • @rossagrant

    Participant

    Any ideas on this people? I see there are strings of SQL to achieve things like this.

    @anonymized-96400

    Inactive

    That would be something like this:
    `UPDATE [tablename] SET [fieldname] = replace([fieldname],'[string_to_find]’,'[string_to_replace]’);`

    You’ll need to substitute stuff like [tablename] with the correct values.

    @rossagrant

    Participant

    @travel-junkie Cheers Boris! Gonna have a play around on a test DB to see if I can get this to work! :)

    @rossagrant

    Participant

    Hmm… tried this but am told the syntax is wrong

    UPDATE [wp_bp_activity]
    SET [action] = replace([action],'[admin1]’,'[admin2]’);

    I’m trying to change all mentions of the admin’s original name, with the new name in the wp_bp_activity table to display the new name in old stream items.

    Anything obviously wrong with that?

    Does filedname refer to the column the string is found in the DB? That’s what I’ve used.

    @anonymized-96400

    Inactive

    Don’t include the [ ] in the syntax :)

    So it’d be like this:
    `UPDATE wp_bp_activity SET action = replace(action,’admin1‘,’admin2‘);`

    @rossagrant

    Participant

    Hahaha, nice one Boris! I’ll test it out! ;)

    @rossagrant

    Participant

    @travel-junkie Cheers Boris, just got around to testing this, and it works a treat without brackets!

    Changed 145 rows in under a second! Saved me A LOT OF TIME!

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How do you ‘Find and Replace’ a word in the BP Activity table in the Database?’ is closed to new replies.
Skip to toolbar