Woocommerce tie two membership statusses together - woocommerce

I have membership setup which is linked to a subscription when a product is purchased. I want to add another membership for elite members but I want to tie it to the first membership. So if membership A which is linked to a subscription expires then membership B must also expire.
So membership B must be linked to Membership A as it's a requirement to have a active membership A in order to have membership b.
How can I do this?
Have not managed to find a solution

Related

How to get membership with membership ID in woocommerece

I have a membership ID I just want to pull the membership details from woo-commerce. I was doing this with the active membership function(wc_memberships_get_user_active_memberships) which gives me the currently active membership for the user also I use the wc_memberships_get_user_memberships which is giving me all the memberships for a user, but I want a particular membership whose ID I have.
Edit:
Got the function in woocommerece documentation $user_membership = wc_memberships_get_user_membership($user_membership_id);

ASP.NET MVC with multiple user tables and roles

I have an application that uses a client table, a company user table and an admin user table to manage companies. Companies have an admin area where they manage their users with roles of what their users can do, and a level above that the admin manages users that have their roles for managing all companies.
The question is: I want to use asp.net identity with authorize and roles in the appropriate controllers. Is there a way to integrate the existing user tables and roles for all three levels of users?
you can create a referrence table with many to many relationship to the asp.net users table like the below:
1- ASP.NET Users (The one Identity provider will give you)
2- Custom Table called (CompanyUsers) that takes the company ID and User ID
3- all tables linked to the above custom table

Creating my custom security role and custom user group tables, to implement custom authorization for my asp.net mvc web application

I am working on an Intranet Asp.net mvc with windows authentication enabled. I am building an asset management application, and I need to define user groups and security roles. For example I have a group that contains senior HR employees; this group will be linked to a security role. The security role will allow for example to add new vehicles, but only allow reading the information about IT assets such as PC, etc.
But since I am working on intranet and the users exists in the Active Directory, and I want to link the user groups to customize security role. So is it a recommended approach to use my own userGroups table and securityRole table to store the information about the user groups and their security roles.
Currently I only use the users from AD , but stores the info about user groups and security roles inside my custom tables. As this will give me more flexibility of implementing the requirements, OR it is recommended to use the build-in groups and role management that comes with asp.net?
Thanks
If the ability exists to maintain the active domain groups there is no reason to maintain a local groups table isinrole can be used for group access checks

How to implement roles in ASP.NET using existing AD groups

I'm trying to implement some role-based functionality in my web application (.NET 4.0.3) so that I can control what menu items users can see based on their roles, either Administrator or User.
I'm simply using existing AD groups to administer the roles. Let's say there is a team in my organisation that is represented by an AD group called IT-Managers, and there is another team with AD group IT-Support. I simply want to map IT-Managers as Administrator and IT-Support as User.
I can easily use WindowsPrincipal.IsInRole() to check whether the currently logged-in user belongs to either group, but how do I tell the application that the logged-in user holds the Administrator role or the User role, therefore sitemap security trimming can pick this up?
By implementing your custom Role Provider. Once implemented you can easily use the ASP.NET role provider framework....
Roles.IsUserInRole("Admin");
Roles.GetUsersInRole("Users");
etc.
You can implement a Role Provider by implementing the RoleProvider abstract class or by extending an existing one such as SqlRoleProvider. There's a lot of extensive documentation out there. I'll paste a couple of links
http://msdn.microsoft.com/en-us/library/aa478950.aspx
http://www.codeproject.com/Articles/28546/Active-Directory-Roles-Provider

One user with more than one mail on ASP.NET Membership Provider

i need to know this.. in the asp.net membership provider, it is possible to create a user with more than one mail?
The thing is that i want in my page (ASP.NET MVC 3) the users can have various emails to login.
It's this possible?
Thanks!
Membership Provider is limited to 1 email account per account holder. You can attach custom attributes for each account using Membership Profile. So your secondary email would simply be an attribute of the user's profile. Here is a great article explaining how to do this.
It is possible, but not with any of the built-in membership providers. You will need to implement your own. Just know that your design will come down to ensuring that e-mail is unique in the table and is linked to a single user account (many-to-one). This will require a separate table in the database for the many e-mails a user may have.
With the default membership providers, no. An email address maps to one user. You can however implement your own membership provider that will take care of this situation.
I'd argue its not a job for the membership provider -- multiple email addresses smell like an application-layer concern.

Resources