I will be creating 4 plans/memberships. When creating the plan and setting restrictions and it says “select restricted attributes that CAN be viewed with this membership” how do I create the restricted attribute, is there a setting or toggle I am missing when creating the various vendor, listing, or request attributes? Or is it assumed that all attributes are restricted and then we must include them in each membership tier so that they have the appropriate access?
Hi @Knode,
There’s no “restricted” setting on the Attribute itself, and nothing is restricted by
default - it works the other way round. You create the Attributes as normal under
Listings > Attributes, and an Attribute only becomes restricted once you select it in a Plan. Anything you don’t select stays visible and editable for everyone.
Two settings on the Attribute control whether it can be restricted at all, though:
- To restrict viewing, the Attribute needs at least one area selected under
Display > Areas. - To restrict editing, the Attribute needs
Editing > Editableenabled.
Then go to Memberships > Plans and edit a Plan. In the Restrictions (Listings) box
you’ll find two fields - Attributes (Display) and Attributes (Editing) - and you select the Attributes to restrict there.
One thing to keep in mind: this works as a site-wide restriction rather than a
per-Plan one. As soon as an Attribute is listed in any published Plan, it’s restricted
for everyone who doesn’t hold a Membership that includes it - so if you have several Plans, add the Attribute to every Plan that should be able to see it.
Restricted Attributes aren’t hidden outright either. Under Display, the value is
replaced with a Reveal {Attribute} link pointing at your Membership Plans page.
Under Editing, the field is removed from the front-end Listing form entirely. Vendors always see and edit their own Attributes regardless of Plan, as do administrators.
If you also set a View Limit on the Plan, the behaviour changes: members see a
Reveal link too, and each Listing they reveal uses one credit from their limit.
Once revealed, that Listing stays visible to them. Worth setting View Limit
consistently across your Plans - either on all of them or none - as a limit on one
Plan switches the reveal behaviour on for everyone.
For your example: create a free Plan, select the Phone Number Attribute under Attributes (Display), and everyone else sees Reveal Phone Number instead of the number. Users do have to actually sign up for the free Plan - simply being logged in isn’t enough.
If you’d rather give every new User that free Plan automatically, there’s a snippet
from @ihor here:
add_action(
'hivepress/v1/emails/user_register/send',
function( $email ) {
// Set plan ID.
$plan_id = 123;
// Get user.
$user = hivepress()->helper->get_array_value( $email->get_tokens(), 'user' );
if ( ! $user ) {
return;
}
// Get plan.
$plan = \HivePress\Models\Membership_Plan::query()->get_by_id( $plan_id );
if ( ! $plan ) {
return;
}
// Add membership.
hivepress()->membership->add_membership( $user->get_id(), $plan );
}
);
Replace 123 with your Plan’s ID. Note that if you have email verification enabled under HivePress > Settings > Users, the Membership is assigned once the User verifies their email rather than at the moment they register.
Lastly, if you want to restrict Vendor or User Attributes rather than Listing ones,
go to HivePress > Settings > Memberships > Content Types first and add them - it’s set to Listings only by default, so the Restrictions (Vendors) box won’t appear on your Plans until you do.
I hope this helps!
Cheers,
Chris ![]()
Hi,
It seems that Chris gave a comprehensive answer, but if you need further clarification, please do not hesitate to ask.
P.S. Please note that we have to move this topic to the Memberships forum category. Since it’s related to a premium extension, the forum category is restricted — please add the license key to the account settings or consider renewing support if you still need assistance related to the premium themes or extensions Renew Support | HivePress