Reference

Post

A post records one attempt to send an entry to a social media account, including the settings used and the provider’s response. You get posts from a post query, which returns an array of verbb\socialposter\elements\Post objects.

{% set posts = craft.socialPoster.posts()
    .ownerId(entry.id)
    .all() %}

{% for post in posts %}
    <p>{{ post.getAccount().name ?? 'Deleted account' }}: {{ post.success ? 'Sent' : 'Failed' }}</p>
{% endfor %}

Properties

accountId

The ID of the account this post was sent from.

data

The full response data returned by the provider. When sending failed, this holds any error details the provider returned.

id

The post’s element ID.

owner

The element this post was sent for, usually an entry, or null when that element no longer exists. This reads getOwner().

ownerId

The ID of the element this post was sent for.

ownerSiteId

The ID of the site the owner element was sent from.

ownerType

The class name of the owner element, such as craft\elements\Entry.

response

A short summary of the provider’s response. When sending failed, it holds the statusCode and reasonPhrase of the error.

settings

The settings used to send this post, such as its title, URL and message.

success

Whether the post was sent to the provider successfully.

title

The post’s title, taken from the owner element’s title.

Methods

getAccount()

Returns the Account this post was sent from, or null when the account has been deleted.