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,551 through 2,575 (of 2,703 total)
Author Replies
Author Replies
Posted: Saturday Nov 24th, 2012 at 7:58 pm #32503
Bruce
Username: Bruce
Staff Member

Hi Cassel,

You don’t have the ending ‘); on the third line, but otherwise it should be O.K.

Posted: Saturday Nov 24th, 2012 at 7:56 pm #32501
Bruce
Username: Bruce
Staff Member

Hi Cassel,

There are no syntax errors in that code as-is. I suspect that the problem lies in that you have the tags, you do not need to have these tags when you’re putting the code in.

Does that fix your issue?

Posted: Saturday Nov 24th, 2012 at 7:48 pm #32498
Bruce
Username: Bruce
Staff Member

Can you please copy the exact error that you’re getting?

Posted: Saturday Nov 24th, 2012 at 7:45 pm #32496
Bruce
Username: Bruce
Staff Member

Hi Cassel,

Are those periods and spaces supposed to be there??

Yes, when you’re putting a function’s or variable’s data into a PHP string/variable, you want to concatenate the function/variable with the other parts of the variable/string. That’s what those ‘.’s are.

Posted: Saturday Nov 24th, 2012 at 7:36 pm #32493
Bruce
Username: Bruce
Staff Member

Hi Cassel,

Try this instead:

<?php
	$my_ccaps= 'wm' . date('Ym') . ',element,forum';
	echo do_shortcode('&#91;&#91;s2Member-Pro-PayPal-Form modify="1" level="1" ccaps="'. $my_ccaps . '" desc="Element Creation Tutorial - GOLD" ps="paypal" lc="" cc="USD" dg="0" ns="1" custom="scrapbookcampus.com" ta="0" tp="0" tt="D" ra="15" rp="1" rt="M" rr="1" rrt="" rra="2" accept="paypal" accept_via_paypal="paypal" coupon="" accept_coupons="0" default_country_code="" captcha="0" /&#93;&#93;');
?>
  • This reply was modified 4 years, 1 month ago by  Bruce.
Posted: Saturday Nov 24th, 2012 at 7:30 pm #32492
Bruce
Username: Bruce
Staff Member

Hi there,

This is very possible with s2Member. You’ll want to set this up in Dashboard -› s2Member® -› Restriction Options -› Post Access Restrictions and Dashboard -› s2Member® -› Restriction Options -› Page Access Restrictions.

Posted: Saturday Nov 24th, 2012 at 7:26 pm #32490
Bruce
Username: Bruce
Staff Member

Hi Cheryl,

That’s interesting. Could you copy the shortcode you’re using to display your form so that I could take a look at it?

About how many times out of ten does this happen?

Posted: Monday Nov 19th, 2012 at 7:24 pm #32027
Bruce
Username: Bruce
Staff Member

Hi Alissa,

s2Member’s user Import/Export feature is limited by the way that WordPress handles password saving. While these limitations are not noticeable when you’re only backing up users, it can cause problems with the way you’re attempting to use it because it does not move passwords over. WordPress uses a special key that’s in your wp-config.php file. If you want to migrate users over to another site, you’ll need to move over your wp-config.php file, and edit it to work with your new SQL database, then export a copy of your WordPress users and usermeta tables from your PhpMyAdmin within your server’s control panel.

To get started, you want to download your wp-config.php file via FTP.

Edit the following lines:

define('DB_NAME', '');

/** MySQL database username */
define('DB_USER', '');

/** MySQL database password */
define('DB_PASSWORD', '');

/** MySQL hostname */
define('DB_HOST', 'localhost');

These lines should be edited to reflect your current SQL setup on your new server environment. Next, you want to export your users and usermeta table:

Keep the default exportation options, and save the downloaded file. Then, go to your new PhpMyAdmin on your new server, and click on the SQL tab at the top of the page, copy all of the data in the downloaded file and submit the SQL:

Once this is finished, your user’s Paid Registration ID and other user data will be moved over to your new environment, and you should be good-to-go.

If you run into any errors with your PhpMyAdmin giving you errors, delete the current users and usermeta tables you have in your new server environment, and then follow the importation step.
  • This reply was modified 4 years, 1 month ago by  Bruce.
Posted: Tuesday Nov 13th, 2012 at 5:09 pm #31488
Bruce
Username: Bruce
Staff Member

Hi Avery,

Sorry for the delayed response

Could you try making sure that your field ID (i.e. ‘countries’ in the example code) is correct? Also, you may want to try creating a new User and setting up fields, and calling the function with his ID as the second arguments to ensure that it is not simply trying to get data from the wrong source. You can find the User’s ID easily with WP Show IDs

Posted: Thursday Nov 8th, 2012 at 12:27 am #30997
Bruce
Username: Bruce
Staff Member

BUG REPORT:

Moved the KB to the Unofficial Hacks/Extensions forums

Fixed a bug where users could not download things from s2Member because it was on the ‘init’ hook. Please change line 18 within your copy of the hack from ‘init’ to ‘plugins_loaded’

Posted: Thursday Nov 8th, 2012 at 12:25 am #30996
Bruce
Username: Bruce
Staff Member

No Problem and sorry for the mixup.

I’ll add a reply to the thread you linked letting others know about the bug.

Posted: Wednesday Nov 7th, 2012 at 11:20 pm #30993
Bruce
Username: Bruce
Staff Member

Hi John,

It is likely that the reason that this is not working for Level 2 Members is due to the way I had originally hooked WordPress. I had the plugin set up to automatically log in at the ‘init’ hook, which is one of the first hooks that WordPress fires. I have updated the hack to work on the ‘plugins_loaded’ hook which comes before ‘init’. Try the new code at:

http://www.s2member.com/forums/topic/automatic-login-based-on-ip/

This should solve your issue, but if it does not, I would consider changing line 18 to add_action('mu_plugins_loaded', 's2hack_auto_login_ip'); to get the absolute first hook available to you.

Posted: Thursday Oct 18th, 2012 at 12:21 am #28799
Bruce
Username: Bruce
Staff Member

Thanks for the heads up

Updated. Knowledge Base » Adding A Sortable EOT User Column

Posted: Friday Oct 12th, 2012 at 10:15 pm #28286
Bruce
Username: Bruce
Staff Member

Hi LG,

Thanks for the info.

I’ve started an investigation on this. I’m going to get back to you as soon as I can reproduce this issue.

Posted: Thursday Oct 11th, 2012 at 12:19 pm #28142
Bruce
Username: Bruce
Staff Member

Hi LG,

Could you please post a list of other plugins you’re running with s2Member? just copy + pasting the list from /wp-admin/plugins.php should suffice. :-)

Posted: Thursday Oct 11th, 2012 at 12:16 pm #28141
Bruce
Username: Bruce
Staff Member

Hi Jim,

Just to clarify, s2Member does create ARCHIVED files accordingly, but you should never get this many log files normally which leads me to believe this is a problem outside of WordPress. However, it could be possible that there is a plugin conflict or bug with s2Member causing this. I’m going to put this issue into a case issue to look into for the next major release of s2Member. In the meantime, you may want to disable logging within Dashboard -› s2Member® -› PayPal® Options -› Account Details -› Logging.

Thanks for your patience.

Posted: Thursday Oct 11th, 2012 at 3:07 am #28086
Bruce
Username: Bruce
Staff Member

Hi LG,

Thanks for the info.

As you can see in the Codex (Source Code Docs), s2Member does update_user_option() for s2member_last_payment_time in these two files:

The first file is the class for the recurring payments, and the second is for the signup for the subscription.

I’m going to run tests to try to get this to happen in a test environment. For now I suggest using get_user_field (“s2member_auto_eot_time”) – 1 day to display the date that users will be billed again. If this field is not being populated correctly either, then I would suggest disabling all plugins possible (except s2Member) and running test transactions until the problem is resolved.

Thanks for your patience.

Posted: Thursday Oct 11th, 2012 at 12:43 am #28077
Bruce
Username: Bruce
Staff Member

Hi cassel,

Maybe it was not obvious in the code i made but here is the “English translation” for it:
if (the member is a Level 1 with “element” ccap) or (the member is a Level 2 with “element” ccap AND is a level 2 member since X number of days)
Display the content

Is that what the code was saying?

Yes that’s correct.

Posted: Wednesday Oct 10th, 2012 at 10:45 pm #28074
Bruce
Username: Bruce
Staff Member

ow can i use the registration time and not the PAID registration time? If i want to give a free membership to someone, the PAID part would not trigger the dripping. 90% of the time it will be paid memberships, but occasionally, it might not be. How do i configure it then?

You could check first to see if the user is a ‘subscriber’ before starting your if() statement. If so, you can use the constant S2MEMBER_CURRENT_USER_REGISTRATION_TIME, which is not dependant on user level.

Assuming you just want to drip content no matter the level, you can use S2MEMBER_CURRENT_USER_REGISTRATION_TIME for all levels instead of s2member_paid_registration_time().

Posted: Wednesday Oct 10th, 2012 at 10:42 pm #28072
Bruce
Username: Bruce
Staff Member

Hi Scott,

WordPress already has a built-in feature for this. Just change the action=”” portion of your form to include the redirect_to argument:

<form method="post" action="http://www.nowsayit.com/wp-login.php?redirect_to=/my-login-welcome-page" class="ws-plugin--s2member-pro-login-widget-form">
Posted: Wednesday Oct 10th, 2012 at 10:37 pm #28070
Bruce
Username: Bruce
Staff Member

Bruce, that looks absolutely awesome, thanks so much for posting this! I haven’t had a chance yet to try it out but it looks very simple and straightforward to implement. Thanks again! I will now happily buy you as much beer as you like :)

No problem! I’ve been meaning to add this hack for awhile now. Let us know if you have any issues with it! :-)

Posted: Wednesday Oct 10th, 2012 at 10:26 pm #28067
Bruce
Username: Bruce
Staff Member

Hello again Cassel,

You’ve got a parse error in your above code. Try this:

<?php
if(current_user_can("access_s2member_level1") && current_user_can("access_s2member_ccap_element")
  || ((current_user_can("access_s2member_level2") && current_user_can("access_s2member_ccap_element") && s2member_paid_registration_time("level2") >= strtotime("-7 days"))))
	{ ?>
		Display what is supposed to be dripped to the level 2 members, but available to the level 1 members already
<?php } ?>

You can use strtotime() to find how many days it is away. s2member_paid_registration_time() returns a timestamp.

  • This reply was modified 4 years, 2 months ago by  Bruce. Reason: Updated code with strtotime() to allow for 7 days
Posted: Wednesday Oct 10th, 2012 at 10:09 pm #28066
Bruce
Username: Bruce
Staff Member

Hi Tony,

Thank you. To so confirm, because we load this page dynamically through AJAX, I need to use include() in my php call of the .php in question?

Ah, I didn’t realize you were actually showing users this page through AJAX. In this case, I would definitely take a look at the info Raam Posted here on protecting content outside of WordPress:

http://www.s2member.com/kb/protecting-non-wordpress-content-with-s2member/

This way, your AJAX requests won’t fail when JavaScript tries to load the page. Just make sure to protect the file with something like this near the top of the page:

include_once 'wp-load.php';
if(!current_user_can('access_s2member_level1'))
	exit('You don\'t have access to this.');
Posted: Wednesday Oct 10th, 2012 at 9:24 pm #28058
Bruce
Username: Bruce
Staff Member

Hi Tony,

You should add this to the top of your PHP page, right underneath the <?php&#91;/hilite&#93;:

&#91;hilite pre_code&#93;
if(!defined('ABSPATH'))
exit('Do not access this file directly');
&#91;/hilite&#93;

By doing this, your file will check to see if WordPress loaded with it, and if it didn't, it will not load. :-)

<blockquote>
This would probably be fixed if you made some .htaccess rules, which would only allow s2Member to access it, and nothing else.
</blockquote>

If you'd like to do it this way, make sure that your file(s) are within their own directory, and within this directory create a .htaccess file with this in it:

deny from all

That blocks access to anything within the directory :-)

Keep in mind that using either of these tips will cause the file to not be able to be accessed. You’ll need to require() or include() the file to see its’ output from now on :-)
Posted: Wednesday Oct 10th, 2012 at 9:17 pm #28056
Bruce
Username: Bruce
Staff Member

Hi LG,

Can you check to see if get_user_field('s2member_paid_registration_times') is being populated correctly? This should be an array, so var_dump() it.

If that’s not working for you either, please make sure that your PayPal IPN URL is set up correctly within PayPal. If you have logging enabled, you should check out your paypal-ipn.log file to ensure that it is getting populated. If you do not have a paypal-ipn.log file, then this is most likely your issue.

Technically, if your IPN URL is wrong, you could still be getting user signups, because user upgrades/downgrades are done within the PayPal Return processes, or within WP_Cron in /includes/classes/auto-eots.inc.php. However, this problem, and also a problem where all of your subscription-based members would not be downgraded would occur.

Let us know how that goes :-)

Viewing 25 replies - 2,551 through 2,575 (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.