BP Polls Rest Api – Activity Data

You can get the Polls data on “bp_polls” of BuddyPress/BuddyBoss “activity” Rest API. The “bp_polls” key enables you to get the poll data ( admin options and submitted polls ).

  {
    "user_id": 1,
    "component": "activity",
    "content": {
      "rendered": ""
    },
    "date": "2023-04-26T05:52:41",
    "date_gmt": "2023-04-26T05:52:41",
    "id": 797,
    "link": "http://buddypress.local/activity/p/797/",
    "primary_item_id": 0,
    "secondary_item_id": 0,
    "status": "published",
    "title": "admin created a poll",
    "type": "activity_poll",
    "favorited": false,
    "user_avatar": {
      "full": "http://buddypress.local/wp-content/uploads/avatars/1/1663828147-bpfull.jpg",
      "thumb": "http://buddypress.local/wp-content/uploads/avatars/1/1663828147-bpthumb.jpg"
    },
    "bp_polls": {
      "bpolls_meta": {
        "poll_option": {
          "good": "Good",
          "better": "Better",
          "cool": "Cool"
        },
        "multiselect": "no",
        "user_additional_option": "no",
        "user_hide_results": "no",
        "close_date": 0,
        "bpolls_thankyou_feedback": "",
        "poll_optn_votes": {
          "good": 2,
          "better": 1,
          "cool": 2
        },
        "poll_total_votes": 5,
        "poll_optn_user_votes": {
          "good": [
            1,
            10
          ],
          "better": [
            19
          ],
          "cool": [
            16,
            8
          ]
        },
        "poll_users": [
          19,
          16,
          1,
          8,
          10
        ]
      },
      "bpolls_total_votes": "5"
    },
    "_links": {
      "self": [
        {
          "href": "http://buddypress.local/wp-json/buddypress/v1/activity/797"
        }
      ],
      "collection": [
        {
          "href": "http://buddypress.local/wp-json/buddypress/v1/activity/"
        }
      ],
      "user": [
        {
          "embeddable": true,
          "href": "http://buddypress.local/wp-json/buddypress/v1/members/1"
        }
      ]
    }
  }
Update on April 26, 2023