Membership Level Restrictions
This topic contains 10 replies, has 3 voices, and was last updated by Stiofan O’Connor 11 years ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
January 12, 2015 at 11:25 am #27092
Hi,
I’m using GeoDirectory in conjunction with S2Members and BuddyPress.
I use S2Members to handle all membership sign-ups and would like to conditionally display content based on membership level.
I need to restrict BuddyPress Members from being able to upload Places/Events and instead have this for business owners only.
So for example the GD > Loginbox:My Dashboard widget should only display for Level 1 members and not Level 2.
Can you please advise on which template I would need to put the conditional in and how to futureproof this from any updates.
Thanks in advance
January 12, 2015 at 11:35 am #27094Have a look at s2member > restriction options > URI restrictions
So you would put /add-listing/ in the field for business owners (whatever level they are in your system).
That will stop members from adding listings, but will not remove from the dashboard widget.
One way that can be solved is to only use the buddypress login widget, and add the GD dashboard widget to protected page for business owners only.January 12, 2015 at 11:53 am #27096Thanks Guust,
I can add page level restrictions just fine but need to apply some widget logic.
For example in geodir-location.php i can wrap the right sidebar hook in this code
if (current_user_is(‘s2member_level4’)) {
###### SIDEBAR ######
do_action(‘geodir_location_sidebar_right’); }That of course will remove the entire right sidebar unless the logged in member is Level 4.
What I’m trying to do is conditionally display just the dashboard widget, not the entire sidebar.
Is there a file where I can add my code to achieve this?
January 12, 2015 at 11:55 am #27098I’ll get Stiofan to look at your question.
January 12, 2015 at 12:00 pm #27100Would you not be better adding the restriction on the actual add listing page?
Stiofan
January 12, 2015 at 12:07 pm #27104That is an option and it would stop certain users adding listings, however I’d rather not give the impression that it’s possible to add listings.
This might be annoying for the user.
I would much prefer to display the widget conditionally if this is possible.
January 12, 2015 at 12:26 pm #27109I suppose I could remove the widget completely from the BuddyPress pages and create a set of similar pages for business owners with the widget included, and make these restricted…. Just seems a cumbersome approach.
Let me know if you can think of a way I can avoid doing this.
Thanks again.
January 12, 2015 at 12:41 pm #27113Okay on line 359 of geodirectory_widgets.php I have replaced with:
if (current_user_is(‘s2member_level1’)) { register_widget(‘geodir_loginwidget’); }
This works and now only shows the widget conditionally.
Can you foresee any problems with doing this?
Thanks
January 12, 2015 at 2:21 pm #27125If it were me i would simply copy the widget code into your child theme functions and rename it to your own, then add the conditional call around that, this will mean it won’t be overwritten on updates.
Thanks,
Stiofan
January 12, 2015 at 2:41 pm #27129That’s a far cleaner solution – thanks for your help!
January 12, 2015 at 3:17 pm #27132Your welcome 🙂
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket