latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Can s2mPro limit menu links to external pages

Home Forums Community Forum Can s2mPro limit menu links to external pages

This topic contains 11 replies, has 3 voices. Last updated by  Cristián Lávaque 4 years, 3 months ago.

Topic Author Topic
Posted: Saturday Sep 29th, 2012 at 1:57 pm #26961

Gents,

I have several WP menu links going out to external HTML pages that I serve on a separate server. Is there a simple way to use s2MemberPro to control access to those external pages via the WP menu links that I want to use?

Thank you.

List Of Topic Replies

Viewing 11 replies - 1 through 11 (of 11 total)
Author Replies
Author Replies
Posted: Saturday Sep 29th, 2012 at 5:25 pm #26972
Eduan
Username: Eduan
Moderator

Hello Charles,

Would the method described in this article work for you?:
Knowledge Base » Protecting Non-WordPress Content with s2Member

Hope this helps. :)

Posted: Saturday Sep 29th, 2012 at 10:54 pm #26997

Eduan,

Thanks for the article. I had read that earlier today and I don’t think that will help. The destination files ate HTML, not PHP, and I’d like those files to not be protected if they are accessed via another route – I just want to make it so that the WP site that I have S2MemberPro running on will not allow non-members direct access to the file via the WP menu. It would be great to have it so the links in the menu will only let the user access those outside files if they are a registered member.

Thank you,

Posted: Sunday Sep 30th, 2012 at 6:25 am #27007

Hi Charles.

So, basically, you want to hide the links if the user doesn’t have the required access, right? You’re not protecting the content itself, but the link to it.

You could do that with conditionals. If you use a Text widget in your sidebar, you could use conditionals there.
[hilite path]Dashboard -› s2Member® -› API / Scripting -› Simple/Shortcode Conditionals[/hilite]
[hilite path]Dashboard -› s2Member® -› API / Scripting -› Advanced PHP Conditionals[/hilite]

I hope that helps. :)

Posted: Sunday Sep 30th, 2012 at 10:03 am #27013

Cristián,

Thanks for the input. Actually, I don’t want to hide the links. I want the main WP menu to look the same to both members and non-members. I just want the link to allow access out to the external page if the user is s signed-in member, otherwise they receive the standard non-member restriction error.

Thank you sir.

Posted: Monday Oct 1st, 2012 at 7:22 am #27050

In that case, you could use the conditional to change the link instead of hiding it, pointing to the Membership Options Page instead of the external page you’re preventing him from going to.

Posted: Monday Oct 1st, 2012 at 8:23 am #27065

Thank you Cristián.

Can you show me how to do that please? Thank you.

Posted: Tuesday Oct 2nd, 2012 at 6:24 am #27189

Something like this, I guess:

[hilite pre_code]
My link
[/hilite]
Posted: Tuesday Oct 2nd, 2012 at 10:02 am #27213

Cristian,

As much as I appreciate your desire to assist, I (like many of s2MemberPro’s customers) are not coders or developers. We are blog owners who chose WordPress as our platform because we aren’t coders/developers.

As such, I graciously ask for you to give me a little more guidance in exactly where that line of code goes. Not being coders/developers, we’d like to be able to make changes to our sites without crashing our sites. Thank you for lowering your support approach to a more novice level.

Posted: Tuesday Oct 2nd, 2012 at 4:02 pm #27252

You basically have this in that line:

[hilite code]My link[/hilite]

[hilite code]a[/hilite] is the HTML tag for the link.
[hilite code]href[/hilite] is where you enter the hypertext reference, where you’re linking to.
[hilite code][/hilite] closes PHP block.
[hilite code]My Link[/hilite] is the anchored text, the text that will be linked to the URL in href.
[hilite code][/hilite] closes the [hilite mono]a[/hilite] tag.

So the line I gave you earlier checks [hilite code]is_user_logged_in()[/hilite] to see if the user is logged in, if [hilite code]true[/hilite] it uses the first URL (the one that points to the page you’re hiding from not logged in users), if [hilite code]false[/hilite] the second one (the Membership Options page).

Posted: Tuesday Oct 2nd, 2012 at 5:43 pm #27268

AWESOME GUIDANCE! Thank you Cristián

Posted: Tuesday Oct 2nd, 2012 at 5:58 pm #27271

:)

Viewing 11 replies - 1 through 11 (of 11 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.