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.

Home Forums Bruce

Bruce

Staff Member

My Latest Replies (From Various Topics)

Viewing 25 replies - 2,401 through 2,425 (of 2,703 total)
Author Replies
Author Replies
Posted: Thursday Dec 6th, 2012 at 3:55 pm #33759
Bruce
Username: Bruce
Staff Member

Hi Abner,

When the user enters the coupon, you should do the following (replacing the ccap “test” with whatever ccap you’re using):

<?php
$user = new WP_User(get_current_user_id());

$user->add_cap('access_s2member_ccap_test'); // Adds custom capability "test"

When the user presses the button and should no longer have access, do this (again, replacing “test”):

<?php
$user = new WP_User(get_current_user_id());

$user->remove_cap('access_s2member_ccap_test'); // Takes it away
$user->add_cap('access_s2member_ccap_test_used'); // Tells us that the user has used a coupon already.

Make sure to use something like this where you have your form to input the coupon (replace “test”):

<?php if(current_user_can('access_s2member_ccap_test_used')) { ?>
	You are not allowed to input a coupon more than once.
<?php } else { ?>
	Normal Content (the form to enter the coupon)
<?php } ?>
  • This reply was modified 4 years, 1 month ago by  Bruce. Reason: Replacing $id with get_current_user_id()
Posted: Thursday Dec 6th, 2012 at 3:48 pm #33756
Bruce
Username: Bruce
Staff Member

Hi Claire,

You may be able to do through Dashboard -› s2Member® -› API / Notifications -› Payment Notifications if your business directory plugin has an API via URL that you can use. Otherwise, you may want to set up a hack through the set_user_role hook in WordPress to handle this.

Posted: Thursday Dec 6th, 2012 at 3:44 pm #33754
Bruce
Username: Bruce
Staff Member

Hi Elizabeth,

This article may be helpful:

Knowledge Base » Offering a Free Coupon Code (100% Discount)

Posted: Thursday Dec 6th, 2012 at 3:42 pm #33753
Bruce
Username: Bruce
Staff Member

thank you for the help – regarding the post restriction – I found a solution based on your hints – I installed the plugin taxonomity drop down, and then I can display all the pages based on tags, and then I implemented a tag called month 00, and used the tag restirction area, where I restricted all tags from month 01 and forward to only level 1.

Great, glad to hear it.

Im am not sure I understand your answer re. the trial, could I ask you to explain it in another way ?

When you create your Pro Form / Button for access with a trial, add the Custom Capability “trial” to the shortcode, so that you can differentiate between users that signed up with a trial, and those that did not.

You can then use the code that I posted to subtract 14 days from the s2Member Paid registration time for users that signed up with a trial.

Posted: Thursday Dec 6th, 2012 at 3:38 pm #33751
Bruce
Username: Bruce
Staff Member

Hi Marc,

What exactly shows up when you use a shortcode? Does the plain-text shortcode show up, or is there nothing at all?

Try following these Knowledge Base » Common Troubleshooting Tips.

Posted: Thursday Dec 6th, 2012 at 3:36 pm #33749
Bruce
Username: Bruce
Staff Member

Hi Randy,

s2Member can be supported by any theme that follows WordPress standards and supports the standard WordPress 3.1+ features (which leaves you with a LOT of themes). On Themeforest, you should not run into any problems at all with incompatibility with s2Member, as these incompatibilities are usually caused by custom themes.

When searching for a theme, look for specific reports of:

  • Shortcodes not functioning correctly
  • Theme not supporting WordPress 3.1+, or the version of WordPress that you’re using
  • Problems with SSL certificates and the theme
  • Issues that were reported specifically for s2Member

If the theme has any of the above issues reported, then it probably will cause issues with s2Member.

Posted: Thursday Dec 6th, 2012 at 3:30 pm #33748
Bruce
Username: Bruce
Staff Member

Hi Emmanuel,

This article should be helpful:

Knowledge Base » Protecting Non-WordPress Content with s2Member

Posted: Thursday Dec 6th, 2012 at 3:28 pm #33745
Bruce
Username: Bruce
Staff Member

Hi David,

It sounds like you need to set up dynamic Login Welcome Pages. You can do so under Dashboard -› s2Member® -› General Options -› Login Welcome Page in the text field under the dropdown box.

Change the Login Welcome page to –Select– in the dropdown, and use the replacement codes to specify a dynamically-created Login Welcome Page URL. Then make corresponding pages.

As an example, if you used

http://yoursite.com/login-welcome-page-level-%%current_user_level%%

You would then need to set up a Login Welcome Page for each level that you’re using. A page for Level 1 subscribers would have the slug /login-welcome-page-level-1.

Posted: Thursday Dec 6th, 2012 at 3:22 pm #33743
Bruce
Username: Bruce
Staff Member

The member will have access to any non-restricted content, like any other member, however, he has an additional “key” that you give him to unlock whatever content you protected with that particular ccap.

This is correct. Users will have access to all content for the specified level, as well as the content that you protect with the custom capability.

Posted: Thursday Dec 6th, 2012 at 3:20 pm #33742
Bruce
Username: Bruce
Staff Member

Hi Cindy,

You can update your Primary Domain here:

http://www.s2member.com/profile/

Posted: Thursday Dec 6th, 2012 at 3:14 pm #33739
Bruce
Username: Bruce
Staff Member

Charles,

To clarify, you’re putting this code into a mu-plugin, within /wp-content/mu-plugins/a-plugin-file.php, correct?:

<?php
function s2_login_ips_for($username)
{
	$ips = get_transient('s2m_ipr_'.md5('s2member_ip_restrictions_'.strtolower($username).'_entries'));
	
	// This returns an associative array containing all IPs the user has logged in with, over the last 30 days.
	// Array keys are IP addresses, and array values are timestamps.
	return (is_array($ips)) ? $ips : array();
}
?>

I just tested this and it seems to be working correctly.

Posted: Thursday Dec 6th, 2012 at 2:34 pm #33733
Bruce
Username: Bruce
Staff Member

Hi Kelli,

One last question. Is it possible to redirect them to the site as opposed to the registration page after they make their donations or possible to just turn off the wordpress follow up emails after they register?

I believe that PayPal donations do not use the PayPal IPN to send users back to your site, but if they do, you should be able to set your PayPal PDT to your site’s homepage instead of the standard s2Member return page, and s2Member should override this change when it sends a user to PayPal.

Posted: Thursday Dec 6th, 2012 at 2:18 pm #33728
Bruce
Username: Bruce
Staff Member

Hi Ayurveda,

You can do this by simply creating multiple Pro Forms / Buttons at different prices for the same level. s2Member does not look at the price when verifying the transactions.

Posted: Thursday Dec 6th, 2012 at 2:16 pm #33727
Bruce
Username: Bruce
Staff Member

Hi Ayurveda,

For clarity, if I password protect the page will this mess with the S2 requirement that the options page must always be public. Might it cause a conflict?

Yes, this may cause conflicts for the page. Instead of using default WordPress functionality for this, you can set up an if() statement for this. Download and install a PHP Execution plugin on your site, and put something like this at the top of your page:

<?php
if($_REQUEST&#91;'s2hack_access_page'&#93; !== 'xxxyyyzzz') { ?>
	You do not have access to this page.
<?php } else { ?>
	They have access to the page. Put content here
<?php } ?>

With this, you can send users to

http://yoursite.com/my-membership-options-page/?s2hack_access_page=xxxyyyzzz

This will allow users to then sign up.

Posted: Thursday Dec 6th, 2012 at 2:10 pm #33726
Bruce
Username: Bruce
Staff Member

Hi Ben,

You’d need to do this with some JavaScript. Add a onsubmit action to the Pro Form and create some JavaScript to grab the data and use AJAX to send the data to a URL that saves the data.

You can check out the IDs for the s2Member Pro Forms in /s2member-pro/includes/templates/forms/

Posted: Thursday Dec 6th, 2012 at 2:04 pm #33725
Bruce
Username: Bruce
Staff Member

Hi Charles,

What exactly did you put into the must use plugin?

Posted: Thursday Dec 6th, 2012 at 1:59 pm #33724
Bruce
Username: Bruce
Staff Member

Hi Christian,

Yes, I’m using all the integration settings from that article. The registration process worked fine, it assigned the new user to the right level, and returned them to the site after making payment so they could register. But it just didn’t set an EOT.

As for the logging, I didn’t have it enabled. I’ve enabled it now and will try again. Just to confirm, setting p3=1
and t3=Y in the advanced variables box in the PayPal button generator should pass the instructions to S2Member that the EOT will be 1 year from the date of registration?

To change the payment from recurring to One-Time, you’ll want to make sure that you’ve set “src” to 0.

With this, the EOT date should be 1 year and 1 day from when the user registered.

Posted: Thursday Dec 6th, 2012 at 1:54 pm #33723
Bruce
Username: Bruce
Staff Member
Posted: Thursday Dec 6th, 2012 at 1:52 pm #33722
Bruce
Username: Bruce
Staff Member

On other question which struck me regarding how to restrict content in relation to their payments – I use following script :

<?php if(S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS < 30 ){?>
    <h3>Ooops ! Acces to this content will be available after next months payment or if you are a lifetime member</h3>
<?php } elseif(S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS >= 30 OR S2MEMBER_CURRENT_USER_ACCESS_LEVEL >= 4){?>
    Drip content to Members that started paying you at least 30 days ago or 
    membershiplevel =4.
<?php } ?>

And regarding this I need to know if the paid registration days also cover a 14 days trial – if so, how then I need to have 45 days instead of 30, however, this gives the next challenge, how do I then differ between a customer who has signed fully up from the start without a trial, as this customer only should have 30 days in. ?

You could try adding the custom capability “trial” to users that signed up with a trial, and not adding it to users that didn’t. Set a variable at the top of the page in PHP, and use that for content dripping instead.

Like this:

<?php
if(current_user_can('access_s2member_ccap_trial'))
	$time = -14;
else
	$time = 0;
	
$time + S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS = $drip_time;

if($drip_time >= 30) { ?>
	They should have access to month one
<?php } ... ?>

2) have all month 1 posts on the home page, with the excerpt, so that everyone can see what they can get
access to if they sign up as member

This is something you’ll have to set up outside of s2Member. You’ll need to edit the loop in your theme.

3) have all other posts sorted by month (and this could be the tag), however, they should not be able to see the excerpts on the home page for all the following month – if I could have a box where it says content month 1, month 2 …. and so on, and then when they click they can see the excerpts, however they should only be able to see the content if their payments are in sync with the actual month – however, the last item is easy to do with the former scripts I have got from you, so this is just a script in front of each post.

You will want to use the is_permitted_by_s2member() function for this.

Posted: Thursday Dec 6th, 2012 at 1:41 pm #33720
Bruce
Username: Bruce
Staff Member

In the future I want to add more languages (German, French, Spanish and Russian) and I want to offer a site that is as much localized as I can. Therefore I need to be able to translate things like “edit my profile”, “My Account” etc…
How do I do that? The best option possible I see now is what I asked already, to add those translations into the $options array. But that comes from a total lack of knowledge about PHP (so forgive me if I say something entirely stupid.)

For logged-in users, your code will work fine. This is because you’re using get_user_field() to grab the data for a user. If the user is logged-out, there is no data. If you’d rather grab the user’s language from something like IP, you could do that as well. I reformatted your code a bit and added the lines:

if(!$lang)
	$lang = 'EN'; 

This sets the default language to ‘EN’, or English. If you’d rather set this to something else, or use another method to find the correct language for users that are NOT logged-in, you can set $lang to whatever you need to here.

  • This reply was modified 4 years, 1 month ago by  Bruce.
Posted: Thursday Dec 6th, 2012 at 1:24 pm #33718
Bruce
Username: Bruce
Staff Member

Hi Charles,

We recommend putting this code into a Must-Use Plugin, by putting it into your /wp-content/mu-plugins/ directory (create one if you don’t have one).

This Must-Use plugin should only house the function that Jason wrote, and not actually display any information.

For getting the user’s info I would suggest creating a Post/Page to display this data for users (a private post/page or draft), and then finding the user’s ID or username to use the code.

OR

If you’re comfortable with it, you can create a custom admin submenu page within your Must Use plugin to house this functionality. Find info on this at WordPress.org >> API >> add_submenu_page()

Posted: Thursday Dec 6th, 2012 at 1:14 pm #33717
Bruce
Username: Bruce
Staff Member

They are Groupon.com.

If that’s the case, I believe you won’t need an API to check the coupon, because you’ll know what the coupon’s code is already, correct?

So using this code the visitor has tu put his code befores he can open the page and then hi validates his ID once he hits the send button and the access will be remove once the visitors close the page, am I right?

Yes, that’s correct. If my above comments were correct, you should probably set another custom capability after the coupon is used such as “test_used” so that you can tell if a user has already used the coupon code before.

Posted: Wednesday Dec 5th, 2012 at 7:38 pm #33643
Bruce
Username: Bruce
Staff Member

Hi Jakub,

I do understand this would most likely require storing user credit card information on our end, which I am guessing was the reason s2Member did not go down that path?

Yes, s2Member would be forced to save info other than the Paid Subsription ID, which could lead to this data being compromised if there was ever a way found to access this data outside of s2Member’s processes.

Posted: Wednesday Dec 5th, 2012 at 7:35 pm #33642
Bruce
Username: Bruce
Staff Member

Hi Christian,

s2Member does not set an EOT date until while the subscription to your site is still active, because the user could have access for an undetermined amount of time. If you were to set up a One-Time payment for a specific amount of time, users *would* have an EOT date. Users are also given an EOT date when they cancel recurring billing.

Posted: Wednesday Dec 5th, 2012 at 6:51 pm #33638
Bruce
Username: Bruce
Staff Member

Hi Chad,

The success=”” attribute is enabled on the PayPal standard buttons when you have s2Member Pro installed.

Viewing 25 replies - 2,401 through 2,425 (of 2,703 total)

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.