{"slug":"fluentcart-customers-portal","title":"fluentcart-customers-portal","summary":"Implements and audits FluentCart customer identity, WP_User linkage, addresses, ownership checks, account creation, customer-scoped queries, and custom portal endpoints. Use when working with Customer, CustomerResource, getCurrentCustomer(), fct_customers, customer-profile REST r","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-09-16T14:51:44.616704Z","repo":{"url":"https://github.com/Lonsdale201/wp-agent-skills","stars":26,"forks":2,"license":"MIT","updatedAt":"2026-11-15T13:11:43Z"},"bodyHtml":"<hr>\n<h2>name: fluentcart-customers-portal\ndescription: &gt;-\nImplements and audits FluentCart customer identity, WP_User linkage,\naddresses, ownership checks, account creation, customer-scoped queries, and\ncustom portal endpoints. Use when working with Customer, CustomerResource,\ngetCurrentCustomer(), fct_customers, customer-profile REST routes,\nfluent_cart_api() customer-dashboard endpoint registration, customer merges or email\nchanges, portal menus, order/subscription ownership, or long-running tests\nthat switch users.\nmetadata:\nwp-skills-author: \"Soczó Kristóf\"\nwp-skills-contact: \"mailto:lonsdale201@hotmail.com\"\nwp-skills-plugin: \"fluent-cart\"\nwp-skills-plugin-version-tested: \"1.6.0\"\nwp-skills-wp-version-tested: \"7.0.2\"\nwp-skills-php-min: \"7.4\"\nwp-skills-last-updated: \"2026-08-06\"</h2>\n<h1>FluentCart customers and portal</h1>\n<p>Treat Customer as the commerce identity and WP_User as an optional login\nidentity. Enforce ownership for every customer-facing object.</p>\n<p>Read <a href=\"references/customer-identity.md\">customer-identity.md</a> before changing\nemail/user links, moving resources, or exposing customer data.</p>\n<h2>Resolve identity safely</h2>\n<ul>\n<li>Customer rows live in fct_customers and may link to WP users by user_id.</li>\n<li>Orders, subscriptions, addresses, licenses, statistics, and labels reference\nCustomer IDs, not WP user IDs.</li>\n<li>CustomerResource::getCurrentCustomer() first resolves the logged-in WP user by\nuser_id or matching email and may attach that user_id to the existing row.</li>\n<li>Passing true may create a Customer from the current WP user.</li>\n<li>Email matching is a linking operation. Validate verified ownership and\nduplicate/merge consequences before changing an address.</li>\n</ul>\n<p>Use Customers/CustomerResource and the normal resource-moving hooks for\ncoordinated changes. Do not update order and subscription customer_id values\npiecemeal.</p>\n<h2>Enforce object ownership</h2>\n<p>CustomerFrontendPolicy only proves that a WP user is logged in. It does not\nauthorize an arbitrary order, subscription, address, download, or license.</p>\n<p>For every custom handler:</p>\n<ol>\n<li>resolve CustomerResource::getCurrentCustomer();</li>\n<li>query the requested object with customer_id equal to that customer;</li>\n<li>reject absent/mismatched objects without revealing whether another customer\nowns them;</li>\n<li>authorize the requested mutation separately;</li>\n<li>use FluentCart lifecycle methods for the mutation.</li>\n</ol>\n<p>Never authorize solely by UUID, license key, address ID, download ID, or portal\nURL.</p>\n<h2>Add a portal page</h2>\n<p>Register at fluent_cart/init or later. Use a unique kebab-case slug that is not\ndashboard, purchase-history, subscriptions, licenses, downloads, or profile.</p>\n<pre><code>fluent_cart_api()-&gt;addCustomerDashboardEndpoint('acme-benefits', [\n    'title'           =&gt; __('Benefits', 'acme-addon'),\n    'render_callback' =&gt; static function (): void {\n        $customer = \\FluentCart\\Api\\Resource\\CustomerResource::getCurrentCustomer();\n        if (!$customer) {\n            return;\n        }\n\n        echo '&lt;div&gt;' . esc_html__('Your benefits', 'acme-addon') . '&lt;/div&gt;';\n    },\n]);\n</code></pre>\n<p>The render callback receives no arguments and echoes content inside the logged-in\nportal shell. Escape output and recheck any resource ownership inside it. A\npage_id can be supplied instead, but its content must still avoid exposing\nunscoped customer data.</p>\n<h2>Keep caches request-scoped</h2>\n<p>CustomerResource caches the current customer statically. Call\nresetCurrentCustomerRuntimeCache() between simulated users/requests in PHPUnit,\nWP-CLI loops, workers, or multisite switches. Do not let one user's cached\nCustomer bleed into another iteration.</p>\n<h2>Handle account and email changes</h2>\n<ul>\n<li>Do not create duplicate WP users merely because an order is paid; core may\ncreate/link an account according to store/order policy.</li>\n<li>Normalize and validate email, then search both Customer and WP_User collision\ncases.</li>\n<li>Move all connected resources through the normal move/change operation.</li>\n<li>React to fluent_cart/customer_email_changed and\nfluent_cart/customer_resources_moved only after verifying their payload.</li>\n<li>Recount customer statistics after repair/import, not on every read.</li>\n<li>Never include PII in public cache keys, logs, HTML data attributes, or URLs.</li>\n</ul>\n<h2>Cross-references</h2>\n<ul>\n<li>Use fluentcart-rest-headless for customer-facing endpoints.</li>\n<li>Use fluentcart-orders-transactions for customer order queries.</li>\n<li>Use fluentcart-licensing-pro for Pro license ownership.</li>\n</ul>\n<h2>References</h2>\n<ul>\n<li>Official customer hooks: <a href=\"https://dev.fluentcart.com/hooks/actions/customers-users/\">https://dev.fluentcart.com/hooks/actions/customers-users/</a></li>\n<li>Verified Free source paths:\n<ul>\n<li>fluent-cart/app/Models/Customer.php</li>\n<li>fluent-cart/api/Customers.php</li>\n<li>fluent-cart/api/Resource/CustomerResource.php</li>\n<li>fluent-cart/api/Resource/CustomerAddressResource.php</li>\n<li>fluent-cart/app/Http/Policies/CustomerFrontendPolicy.php</li>\n<li>fluent-cart/app/Http/Controllers/FrontendControllers/</li>\n<li>fluent-cart/api/FluentCartGeneralApi.php</li>\n<li>fluent-cart/app/Hooks/Handlers/ShortCodes/CustomerProfileHandler.php</li>\n<li>fluent-cart/app/Hooks/Handlers/UserHandler.php</li>\n</ul>\n</li>\n</ul>\n","files":[{"path":"agents/openai.yaml","sizeBytes":313,"isText":true},{"path":"references/customer-identity.md","sizeBytes":1919,"isText":true},{"path":"SKILL.md","sizeBytes":5036,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-09-16T14:55:20.431599Z","sha256":"E4BC7EC45CACC14E14FF3C6D42460EBFCBDCA1D5BCC3AAFAD72CC32963910C4E","sizeBytes":3674},"review":null,"source":{"repositoryUrl":"https://github.com/Lonsdale201/wp-agent-skills","path":"fluentcart/fluentcart-customers-portal","license":"MIT","commit":"9025fda280d15da3e2ba376a66940e75bd45f3ce","subtreeSha":"F3AE1E96914AC2AF9E9ABDD187384B2D2899B2100631F9EF2049365A0E253042","lastSyncedAt":"2026-11-17T00:39:45.243627Z"},"reviewedAt":"2026-09-16T15:10:28.269623Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/Lonsdale201/wp-agent-skills/tree/main/fluentcart/fluentcart-customers-portal"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install lonsdale201-wp-agent-skills@llmmart"},{"target":"git","command":"git clone https://github.com/Lonsdale201/wp-agent-skills.git"}]}