使用中 ケイデンス Pattern Hub を使用する場合、デザイン・ライブラリのアクセス・キーを生成し、他の人にアクセスを提供することができます。デザイン・ライブラリへのアクセスを WooCommerce WooCommerce Software License PluginとLicense Manager for WooCommerceプラグインは理想的なソリューションです。この記事では、このにプラグインの基本設定と、アクセスキー販売のためのKadence Pattern Hubとの統合方法。
![画像 [1]- WooCommerceでKadenceパターンハブアクセスキーを販売するための完全ガイド](https://www.361sale.com/wp-content/uploads/2025/04/20250403164238406-image.png)
ステップ1:パターン・ハブ・アクセス製品の作成
第一に WooCommerce アクセスキーの販売に使用する新しい商品を作成します。出荷プロセスを使用しない仮想商品として設定します。
- バーチャル製品の作成
入り込む ワードプレス バックエンド WooCommerce -> 商品 -> 新しい商品の追加そして、バーチャル・プロダクトとしてセットアップされる。
![画像[2]-WooCommerceでKadenceパターンハブのアクセスキーを販売するための完全ガイド](https://www.361sale.com/wp-content/uploads/2025/04/20250403164456342-image.png)
- 設定ライセンス
使用するプラグイン(WooCommerce Software LicenseまたはLicense Manager for WooCommerce)に応じて、製品のライセンス設定を行い、アクセスキージェネレータと関連付けます。
![画像[3]-WooCommerceでKadenceパターンハブアクセスキーを販売するための完全ガイド](https://www.361sale.com/wp-content/uploads/2025/04/20250403164521401-image.png)
![画像[4]-WooCommerceでKadenceパターンハブアクセスキーを販売するための完全ガイド](https://www.361sale.com/wp-content/uploads/2025/04/20250403164543973-image.png)
ステップ 2: Kadence パターン・ハブをライセンス認証に接続する
ある WooCommerce Kadence Pattern Hubでアクセスキーを販売した後、Kadence Pattern Hubがライセンスの有効性を確認できるようにする必要があります。そのためには、Kadence Pattern Hubにカスタム PHP フィルター
WooCommerceソフトウェア・ライセンス・フィルター設定::
以下のスニペットは、リクエストされたドメインに対して、リクエスト時にライセンスが有効で有効化されているかどうかをチェックする。キーが有効でアクティベートされていれば、アクセスは許可されたものとして返されます。
/**
* Validates license with WooCommerce Software License.
*
* @param Boolean $access true or false based on access.
* @param String $key the access key.
* @param WP_REST_Request $request full details about the request.
* @return Boolean based on if access should be granted.
*/
function custom_check_cloud_access( $access, $key, $request ) {
// If true the key matches with settings in Kadence Pattern Hub. Let that pass for testing purposes.
if ( $access ) {
return $access;
}
// Make sure WooCommerce Software License exists.
global $WOO_SL_API;
if ( $WOO_SL_API ) {
$site = preg_replace('(^https?://)', '', $request->get_param( 'site' ) );
$args = array(
'licence_key' => $key,
'domain' => $site,
'woo_sl_action' => 'status-check',
'product_unique_id' => 'PRODUCT_UNIQUE_ID',
);
$response = $WOO_SL_API->API_call( $args );
$response = json_decode( $response );
end( $response );
$response_data = current( $response );
if ( is_object( $response_data ) && 'success' === $response_data->status ) {
// Lets activate it for this domain if it's not.
if ( $response_data->status_code && 's203' === $response_data->status_code ) {
$args['woo_sl_action'] = 'activate';
$response = $WOO_SL_API->API_call( $args );
}
return true;
} else if ( is_object( $response_data ) && 'error' === $response_data->status ) {
// Lets activate it for this domain if possible.
if ( $response_data->status_code && 'e204' === $response_data->status_code ) {
$args['woo_sl_action'] = 'activate';
$response = $WOO_SL_API->API_call( $args );
$response = json_decode( $response );
end( $response );
$response_data = current( $response );
if ( is_object( $response_data ) && 'success' === $response_data->status ) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
return $access;
}
add_filter( 'kadence_cloud_rest_request_access', 'custom_check_cloud_access', 10, 3 );
特定のパターン・ライブラリー・コレクションへのアクセス制限
あるアクセス・キーが特定のスキーマ・ライブラリのコレクションにしかアクセスできないように制限したい場合は、以下のコードで行うことができる:
/**
* 特定のパターンハブライブラリコレクションへのアクセスを設定します。
/** * 特定のパターンハブライブラリコレクションへのアクセスを設定します。
* @param array $args アイテム取得のためのクエリ引数 * @param string $key アクセスキー。
* @param string $key アクセスキー。
* @param array $request_extras リクエストの追加引数 * @return array with updated query args.
* 更新されたクエリ引数を配列で返します。
*/
function custom_kadence_cloud_query_args( $args, $key, $request_extras ) { 以下のようにします。
if ( ! isset( $args['tax_query'] ) ) { { $args['tax_query'] )
$args['tax_query'] = array(
array(
'taxonomy' => 'kadence-cloud-collections'、
'field' => 'slug'、
'terms' => array( 'COLLECTION_SLUG')
),
);
}
return $args.
}
add_filter( 'kadence_cloud_template_query_args', 'custom_kadence_cloud_query_args', 10, 3 );
複数のコレクションのアクセスキーを販売
販売するスキーマコレクションが複数ある場合は、コレクションごとに異なるライセンス接頭辞を設定することで販売できます:
/**
* Validates license with WooCommerce Software License.
*
* @param Boolean $access true or false based on access.
* @param String $key the access key.
* @param WP_REST_Request $request full details about the request.
* @return Boolean based on if access should be granted.
*/
function custom_check_cloud_access( $access, $key, $request ) {
// If true the key matches with settings in Kadence Pattern Hub. Let that pass for testing purposes.
if ( $access ) {
return $access;
}
// Make sure WooCommerce Software License exists.
global $WOO_SL_API;
if ( $WOO_SL_API ) {
if ( substr( $key, 0, strlen( 'col_one' ) ) === 'col_one' ) {
$product_id = 'PRODUCT_UNIQUE_ID';
} else {
$product_id = 'PRODUCT_UNIQUE_ID_TWO';
}
$site = preg_replace('(^https?://)', '', $request->get_param( 'site' ) );
$args = array(
'licence_key' => $key,
'domain' => $site,
'woo_sl_action' => 'status-check',
'product_unique_id' => $product_id,
);
$response = $WOO_SL_API->API_call( $args );
$response = json_decode( $response );
end( $response );
$response_data = current( $response );
if ( is_object( $response_data ) && 'success' === $response_data->status ) {
// Lets activate it for this domain if it's not.
if ( $response_data->status_code && 's203' === $response_data->status_code ) {
$args['woo_sl_action'] = 'activate';
$response = $WOO_SL_API->API_call( $args );
}
return true;
} else if ( is_object( $response_data ) && 'error' === $response_data->status ) {
// Lets activate it for this domain if possible.
if ( $response_data->status_code && 'e204' === $response_data->status_code ) {
$args['woo_sl_action'] = 'activate';
$response = $WOO_SL_API->API_call( $args );
$response = json_decode( $response );
end( $response );
$response_data = current( $response );
if ( is_object( $response_data ) && 'success' === $response_data->status ) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
return $access;
}
add_filter( 'kadence_cloud_rest_request_access', 'custom_check_cloud_access', 10, 3 );
WooCommerce用ライセンスマネージャ フィルター設定
License Manager for WooCommerce プラグインを使用している場合、以下のようになります。 PHP このコードは、ライセンスの有効性を確認するのに役立ちます:
/**
* ライセンスマネージャでライセンスを検証します。
/** * ライセンスをwoocommerceのライセンスマネージャで検証します。
* @param Boolean $access アクセスに基づき、true または false を返します。
* @param String $key アクセスキー。
* @param WP_REST_Request $request リクエストの詳細 * @return WP_REST_Request に基づく Boolean。
* アクセスが許可されるべきかどうかに基づいてブール値を返す。
*/ 関数 custom_check_cloud
function custom_check_cloud_access( $access, $key, $request ) { // trueの場合、キーが設定と一致します。
// もしtrueなら、キーはKadence Cloudの設定と一致します。
もしtrueなら、キーはKadence Cloudの設定と一致します。
if ( $access ) { return $access; // true の場合、キーは Kadence Cloud の設定と一致する。
}
// woocommerce用のライセンスマネージャが存在することを確認します。
if ( class_exists( 'LicenseManagerForWooCommerceRepositoriesResources︓License' ) { { $license = ︓$license。
$license = ¦LicenseManagerForWooCommerce¦Repositories¦License::instance()->findBy(
array( 'hash' => apply_filters( 'lmfwc_hash', $key ) )
);
if ( ! $license ) { // ライセンスは見つかりませんでした。
// ライセンスは見つかりませんでした。
return false; } else { // ライセンスは見つかりませんでした。
} else {
// 期限切れかどうかをチェックします。
$expiresAt = $license->getExpiresAt(); $dateExpiresAt = new DateTime($expires)
$dateExpiresAt = new DateTime($expiresAt); $dateNow
$dateNow = new DateTime('now', new DateTimeZone('UTC'));
if ( $dateNow < $dateExpiresAt ) { if ( $dateNow getTimesActivated() ) update()
$license->getId()、
array(
'times_activated' => $timesActivatedNew
)
);
}
// 成功しました。
成功しました。
}
}
return $access; }.
}
add_filter( 'kadence_cloud_rest_request_access', 'custom_check_cloud_access', 10, 3 );
概要
結合 WooCommerce ソフトウェアライセンスプラグインまたはWooCommerceプラグインのLicense Manager。ケイデンス Pattern Hubは強力なアクセスキー管理機能を提供します。これらのプラグインを使用することで、アクセスキーを簡単に管理し、正確なパーミッション制御を設定し、複数のコレクションの販売をサポートし、コンテンツの販売と管理を大幅に促進します。
| お問い合わせ | |
|---|---|
| チュートリアルが読めない?無料でお答えします!個人サイト、中小企業サイトのための無料ヘルプ! |
カスタマーサービス WeChat
|
| ① 電話:020-2206-9892 | |
| ② QQ咨询:1025174874 | |
| 三 Eメール:info@361sale.com | |
| ④ 勤務時間: 月~金、9:30~18:30、祝日休み | |
この記事へのリンクhttps://www.361sale.com/ja/49064この記事は著作権で保護されており、必ず帰属表示を付けて複製してください。




















![絵文字[wozuimei]-Photonflux.com|プロのWordPress修理サービス、ワールドワイド、迅速対応](https://www.361sale.com/wp-content/themes/zibll/img/smilies/wozuimei.gif)
![表情[baoquan]-光子波动网 | 専門WordPress修復サービス、全世界対応、迅速対応](https://www.361sale.com/wp-content/themes/zibll/img/smilies/baoquan.gif)

コメントなし