Skip to:

Edit subscripitions via MySQL

  • haddlyapis


    Hi there,
    I want to import 150 users to my forum and subscribe them to a new “test” forum topic in order to check if the email notification is working (it stops after sending 100 emails).
    In order to do this, I use the plugin “import and export users and customers” to import a list of made-up users (username and email are all that is needed for columns in CSV file).
    Then I create a new “test” forum.
    Now I want to subscribe them all to this forum topic programmatically via MySQL.
    The issue is, I have looked at the SQL table and the only data that I can find on user subscriptions is the wp_usermeta where meta_key = 'wp__bbp_forum_subscriptions'. The meta_value shows the ID of the forum that users are subscribed to.
    The issue is that it seems to be no longer working. Is it a meta_value that BBpress no longer uses? If so, which one is used?
    If I take a random subscribed user (ID=17248) and check what they are subscribed to, the following query works: select * from wp_usermeta where meta_key = 'wp__bbp_forum_subscriptions' and user_id = 17248;. I can then see a list in the meta_value table of what they are subscribed to. But if I then (using the BBp Toolkit plugin) alter their subscriptions and e.g. unsubscribe them from a topic, go back to the DB and do the same query, it shows the same forum subscription IDs, even though there should be one less.
    Could you point me in the right direction of which table to query to alter the forum topic ids of a user please?

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

  • Robin W


    subscriptions used to be stored with the user, so in usermeta wp__bbp_forum_subscriptions which is what you are seeing – that data here is old.

    However on 2.6.x this has changed, and now subscriptions are stored in the postmeta of the forum or topic they are subscribed to.

    Each user has an entry

    so the query

    SELECT * FROMwp_postmetaWHEREpost_id= 2927 ANDmeta_keyLIKE '_bbp_subscription' ORDER BYmeta_idASC

    where 2927 is the ID of the forum

    will produce

    post_id	meta_key	meta_value
    2927 	_bbp_subscription 	1
    2927 	_bbp_subscription 	1191

    where the subsbribers to forum 2927 are user_id’s 1 and 1191



    Great! thx for the explanation and the quick response. That clears everything up.

    Robin W


    Great – glad you are fixed

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