Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to change all the users in the database to be subscribed to specific forums


  • crushdg
    Participant

    @crushdg

    I know this is a little off topic, but what would I look for in the db, to change all the users in the database to be subscribed to category_id 246? Trying to figure out if I can just export the db and do a search and replace or addition. I hope my question makes sense.

Viewing 8 replies - 1 through 8 (of 8 total)

  • Robin W
    Moderator

    @robin-w

    yes, you would be looking in the usermeta table 9noramlly called wp_usermeta at meta-key wp__bbp_subscriptions

    this is comma deliminated, so if I was user ID 3, and was subscribed to topics 10, 12 and 15, and forums 1, 3 and 6, I would see

    user_id 3
    meta_key wp__bbp_subscriptions
    meta_value 1,3,6,10,12,15

    So to add category 246, you would just add this to the end, or create if not there

    Someone cleverer than me out to be able to give you a sql string or two that would do this which you could run on phpmyadmin.

    Logically you’d create two statements, the first would say

    for all the user_id’s if wp_bbp_subscriptions exists, then make the meta_value equal to the meta_value concatenated with ‘,246’
    Then second one
    for all user_id’s if wp_bbp_subscriptions does not exist, make meta_key wp_bbp_subscriptions equal to 246.

    I’m not good enough at sql to code this without lots of checking – anyone good at this stuff?


    crushdg
    Participant

    @crushdg

    Urghhhhh… Ya, I’m not great at it either. If someone could offer advice on what sql query to run, that would be great! Thank you so much @robin-w!


    crushdg
    Participant

    @crushdg

    No ideas? Really need some help with this, if possible. Thanks!


    Robin W
    Moderator

    @robin-w

    I’d suggest that you

    1. create a test site (which everyone should have in nay case !)

    and

    2. Google sql tutorial video, and work out how to code my statements

    3. go into phpmyadmin on your test site and play until you get it right

    4. Come back and post the resultant code to help others

    sorry, but almost all of the stuff I have learn’t has been by spending time googling to find some examples, and then hours getting it to work 🙂


    crushdg
    Participant

    @crushdg

    Understood, appreciate the direction. Hopefully I will be able to find some time over the next several days to spend figuring this out.


    Robin W
    Moderator

    @robin-w

    sorry if I wasn’t so busy, I’d have a crack at it 🙂


    crushdg
    Participant

    @crushdg

    I ended up just having to go with a User Data Manager plugin since it was quickest, though will probably try my hand at writing up some SQL to do it manually through phpmyadmin. Thanks so much for your help!


    Robin W
    Moderator

    @robin-w

    No problem

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.
Skip to toolbar