PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Limiting access to a form/php

s2Member Plugin. A Membership plugin for WordPress®.

Limiting access to a form/php

Postby dapike » July 30th, 2011, 12:24 pm

What I would like to do is to have a form on a webpage that everybody can see, but I want the php script from the line

<form action="do_something_spiffy.php" method="get">

to only function for logged in members. I've tried putting the php script within the s2member-files/access-s2member-level1 directory, but this resulted in a nasty error message even for logged-in members.

Also, the php script evidently is beyond the scope of being able to use functions such as
if (is_user_logged_in()) { // do spiffy stuff }
so I can't embed code into the php script to check the user's status.

Does anybody have any suggestions for how to achieve what I'd like to accomplish?

Thanks,

- David.
User avatar
dapike
Registered User
Registered User
 
Posts: 9
Joined: October 5, 2010

Re: Limiting access to a form/php

Postby Cristián Lávaque » July 30th, 2011, 11:03 pm

You could have your form protected inside a conditional so only those that can use the form can actually see it. WP Admin -> s2Member -> API / Scripting -> Simple/Shortcode Conditionals and Advanced/PHP Conditionals

And the do_something_spiffy script can be inside a WordPress page with Exec PHP installed, then you'll have the WP and s2Member functions available. https://wordpress.org/extend/plugins/exec-php/
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010


Return to s2Member Plugin

Who is online

Users browsing this forum: No registered users and 4 guests

cron