How to get Membership Users to be the same Member users for a Directory Listing website?

I am trying to create a map-based directory website that is only viewable to people who have paid a subscription. Basically only a handful of pages will be public - Home, About, Contact, etc. The entire rest of the website will be available to paid subscribers only.

All of the directory listings themes out there seem to only have the capability to charge for the ability to post listings on a directory site. None (that I've found) charge to be able to see the listings. I want posting the listings to be be free and the subscription fee will allow subscribers to see the listings on a map.

Enter Membership, the plugin and my theme, Atlas by Themes Depot. Both Atlas and Membership are perfect for my needs but essentially the the two don't talk to each other and here's why:

The specific problem is that in the Atlas theme, there is a front end submission that utilizes geolocate and this is the main reason why I need this theme to work. This front end submission with geolocate is tied to a custom user default role Atlas has defined as 'Listing Contributor'. I set this preference in Settings/general - new user default role. This puts all new registrants/users/listing submitters as a Listing Contributor, which shows up in a list for the Atlas theme, under Memberships (not the plugin, just a section of Atlas theme called Memberships). Atlas does not allow for me to charge for a subscription to view the listing. It only allows me to charge to submit listings.

Memberships, the plugin also works beautifully and allows me to charge for subscriptions to view content. But it puts all the people who pay under users in a separate section of the website (Users). With them in the wrong section, they don't have access to most of the themes' perks.

Without Atlas, I don't get the geolocate map and theme functionality that I need. Without Membership, I can't charge a subscription to see the content.

In summary, I need the Membership plugin list of paid users and the Atlas theme list of members to be the same list. Is there a way to force the Membership plugin users to have this custom new user role defined in the Atlas theme?

Any ideas at all? I'm lost! I think I see what the problem is (maybe I don't) but I have no clue how to proceed.

Thanks!

  • PC

    Hello there Erika,

    Thanks for posting on the forums.

    In summary, I need the Membership plugin list of paid users and the Atlas theme list of members to be the same list. Is there a way to force the Membership plugin users to have this custom new user role defined in the Atlas theme?

    Yes, that is possible using Membership plugin.

    But for that you will need to use Advanced rules in Membership >> Access levels.

    When you go to the advanced tab after editing an access level, you will see the "Associated Role" option where you can select the role you want to be assigned to a user on that particular access level.

    Here is a screenshot.

    I hope that helps. Please feel free to ask if you have more questions on the same.

    Cheers, PC

  • Erika

    PC,

    Thank you, that is excellent! I didn't notice that option. That was half of my problem. The other half, and I don't know if this is possible...but how could I add something similar in the Advanced section that would also ask what Atlas Membership level a new subscriber has? This is the final step that would put both pieces together and give the full atlas functionality to someone subscribing with Membership plugin. Attached is a screen shot from the user profile page showing the field that i need to link up. This user is just a new user registered through the Membership plugin, and then I went into the user.

    Thank you so much!!!! You have no idea how much this helps!

  • Erika

    To clarify, I mean I'd like to have a field under advanced in access level, like where you can assign the role (that you mentioned above). This new field would give me the option to choose the Atlas membership level when I'm defining the access level from within Membership plugin. So in the screen shot, Non-Member is the Atlas Membership level.

    How would I add that to the plugin, the ability to choose the Atlas membership level in advanced under access level?

    What this basically does is automate the process so when someone registers through membership plugin, they will automatically be assigned the membership role that will give them access to the Atlas membership geolocate functionality.

    How to pull this off?? Thank again!

  • Patrick

    Hey there @Erika

    I happened upon this thread while going through a bunch of them, and thought I'd add a bit of feedback.

    Does the 'Listing Contributor' role created by the theme not appear in the dropdown for selection in the Advanced Settings of the Membership plugin access levels?

    Selecting that role for any particular Membership access level should automatically assign that role to your users when they are on that acess level.

  • Erika

    HI Patrick,

    The 'Listing Contributor' user role created by the theme allows users on the front end to submit a listing using all the features of the theme (like geolocate, etc.) But within the theme there is also a set of membership levels which gives them access to everything else within the theme.

    I can manually change that from the Users section one user at a time, but that is a painful and non-automated process. So let's say someone pays for a membership, I'm sure they don't want to wait three hours to access the site b/c the site administrator is out playing golf or whatever. I've been trying to figure out a way to automate this second part.

    Thanks for your feedback! And any further suggestions would be welcome!

  • PC

    Hello there Erika,

    Thanks for posting back.

    Unfortunately there is no out of the box way to let Membership ask which Atlas membership level they are currently on. It can only associate a user role from your site to a member who is registering via Membership plugin

    If you need that sort of integration, it will need to be custom coded. Let me see if I can get our Second Level support to provide some code suggestion here to make this possible.

    One of them should be around soon.

    Cheers, PC

  • Dharmendra

    Hello Erika,

    I hope you are doing well!

    I have figured out the solution for your custom requirement.

    To achieve this you will need to use child theme as described here https://premium.wpmudev.org/blog/create-wordpress-child-theme/ to upgrade-safe edit. I think it is already available under theme section named as "Atlas Child".

    You will need to add below mentioned code in the functions.php file.

    function login_and_add_subscription($error,$user_id){
    		tdp_changeMembershipLevel(1, $user_id); // You can change 1 with your default membership ID.
    		//update_usermeta( $user_id, 'allowance_limit', 15 ); // You can uncomment this line to set the post allowance limit for newly created user.
    }
    add_action( 'membership_subscription_form_registration_process', 'login_and_add_subscription',4,2 );

    Please have a try and let me know if it works for you.

  • Erika

    Hi Dharmendra,

    Thank you so much for trying! When I tried this code with Atlas Child, it errored out - the php file did not like it.

    Also, since I posted last I tried switching to AIT Themes' Directory. Can you tell that I am grasping for a solution here?!

    Again, I just need an automated way to switch the user role for paying subscribers to the membership level created by the theme. Without that, I can't use the geolocate functionality.

    To add complication to things, in thinking this through I have three levels of memberships:

    1. Free: They can see anything
    2. Registered: They must have the theme membership level role to be able to submit listings, but they shouldn't have access to most of the pages
    3. Subscribers: People who subscribe/pay can see it all.

    In the membership theme options, I can set the Use Level for strangers to Guest, and Default User Subscription to Registered, but that doesn't help me get the Subscriber level.

    At this point I'm so frustrated! How does one go about hiring someone to help?! Any tips? Or would you be willing to login and look at my site?

    Thanks so much

  • Erika

    Hi Dharmendra,

    Well, unfortunately I had to switch themes (the Atlas theme is great but it wasn't exactly what I was looking for). After I tried your code, I wiped my server and installed a fresh copy of a new theme hoping for a fresh start, so unfortunately I can't go back and give you the exact error with that theme. I feel bad abandoning that theme and your code with all the work you put into it, but there were too many stumbling blocks with that theme and I had to try something different.

    So now I am using the AIT Themes Directory theme and I think this is the theme that will make it all work, except for this one little piece.

    How to flip a paying plugin subscriber to 'subscribe' theme access level/ user role

    and

    How to flip a registered plugin user to a 'registered' theme access level/user role

    I would love to use the Membership plugin to actually register people rather than using the registration method in the theme - it is way better in the plugin. But I need to then correspond those users with the account user roles specified in the theme.

    Is it possible to take that code and adjust it to the AIT DIrectory theme? I poked around a little bit in the functions.php file but to no avail. I'd be glad to give you a copy of the theme to look at, or whatever you need.

    I can't tell you how much I appreciate your efforts. If you could help me out, I would be so grateful, and I'd be happy to pay you to do it too.

    Many thanks,
    Erika

  • Dharmendra

    Hello Erika,

    I can try to achieve the similar functionality with AIT DIrectory theme and membership plugin. For this I will require AIT DIrectory theme code.

    Can you please send in:

    - Mark to my attention - ATTN: Dharmendra Vekariya
    - Link back to this thread
    - Include admin/network access
    - Include FTP
    - Include any relevant URLS for your site

    On the contact form, select "I have a different question", this ensures it comes through and gets assigned to me.

    https://premium.wpmudev.org/contact/

    However, if this ends up being rather complex then you may need to hire a developer for this custom work. I'll let you know once I've assessed further.

    Please advise.

  • Dharmendra

    Hello Erika,

    Thanks for your reply and sharing the information.

    I just go through it and applied one solution.

    I have uploaded functions.php file to your child theme and added below mentioned code to achieve desired results.

    add_filter('pre_option_default_role', function($default_role){
    
    	if ($_REQUEST['subscription'] == 1)
    	{
    		$default_role =  "directory_3" ; //for free
    	}else if ($_REQUEST['subscription'] == 4)
    	{
    		$default_role =  "directory_2"; //for annual
    	}else if ($_REQUEST['subscription'] == 3)
    	{
    		$default_role =  "directory_1"; //for monthly
    	}
    
    	return $default_role; // This allows default
    });

    Please check and let me know if it is working as required.

    cheers:slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.