Appearance
Reviews Platforms
Review platforms extend the abstract BaseReview (app/Services/Platforms/Reviews/BaseReview.php). The base class handles syncing, caching, cron, and settings storage; your subclass supplies the platform-specific bits — how to talk to the API and how to normalize a single review.
The contract
php
namespace WPSocialReviews\App\Services\Platforms\Reviews;
class MyPlatform extends BaseReview
{
public function __construct()
{
parent::__construct(
'myplatform', // $platform slug
'wpsr_reviews_myplatform', // $optionKey for settings
'wpsr_myplatform_reviews_update' // $cronScheduleName
);
}
// REQUIRED: normalize one raw review into the wpsr_reviews shape
public function formatData($review, $index)
{
return [
'platform_name' => 'myplatform',
'reviewer_name' => $review['author'] ?? '',
'reviewer_text' => $review['text'] ?? '',
'rating' => (int) ($review['stars'] ?? 0),
'review_time' => $review['created'] ?? '',
'review_id' => $review['id'] ?? '',
];
}
// REQUIRED: return the API/connection settings for this platform
public function getApiSettings()
{
return get_option('wpsr_reviews_myplatform', []);
}
}Methods the base class provides
You inherit a full lifecycle — override only what you need:
| Method | Role |
|---|---|
registerHooks() | Bind cron, settings, and rendering hooks |
prepareAuth() / consumeAuth() | The OAuth prepare/consume handshake |
syncRemoteReviews() / manuallySyncReviews() / syncReviews() | Fetch and store reviews |
getReviews() | Read stored reviews |
saveCache() / deleteCache() | Cache management (see Caching) |
activateCronEvent() / doCronEvent() | Scheduled refresh |
reviewDelete() / deletePlatformReviews() | Remove reviews |
saveAdvanceSettings() / getAdvanceSettings() | Settings storage |
Only formatData() and getApiSettings() are abstract — everything else has a sensible default.
Registering it
Instantiate and register hooks when the app boots, and make the platform known to the registry:
php
add_action('wp_social_reviews_loaded_v2', function () {
(new \WPSocialReviews\App\Services\Platforms\Reviews\MyPlatform())->registerHooks();
});
add_filter('wpsocialreviews/available_valid_reviews_platforms', function ($platforms) {
$platforms[] = 'myplatform';
return $platforms;
});The admin then routes credential verification and settings for myplatform through the dynamic _{platform} hooks — see Action Hooks → Platform Settings Seam.
Study an existing platform
GoogleMyBusiness.php and Airbnb.php are good real-world references for how a BaseReview subclass is structured, including API-tuning filters like gmb_reviews_limit and airbnb_api_key.

