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 fpl

fpl


My Latest Replies (From Various Topics)

Viewing 17 replies - 26 through 42 (of 42 total)
Author Replies
Author Replies
Posted: Friday Apr 26th, 2013 at 9:22 am #48479
fpl
Username: ctl

Hi Cristi´n,

Thanks for your speedy reply and testing.

Could you check in the subscription’s profile over at PayPal if the s2Member custom field has the correct value?

I’m not sure I understand what you mean by that. In PayPal’s Manager > latest transaction?

I’ll install the server scanner within the next hour (got a quick appointment).

Meanwhile: s2i.php
if it can help.

Posted: Friday Apr 26th, 2013 at 7:46 am #48466
fpl
Username: ctl

Hi there,

Any update on that? It’s becoming pretty urgent on my side, as it is for t2media: we must go live next week.

I’ve sent you everything you need to test on the real site (reset to WP defaults), via the Private Contact Form.

Btw., and this is important too, could you e-mail me the IPs that I have to allow in .htaccess. I’ve disabled the redirection so you can access it… but I need to re-enable it asap.

Thanks.

Posted: Thursday Apr 25th, 2013 at 10:54 am #48370
fpl
Username: ctl

Hey Cristián,

I’ve reset WP to its defaults with just S2Member & the PayPal info.

Just made a test (with logging enabled), same issue.

I’m contacting you via the Private Contact Form.

Posted: Tuesday Apr 23rd, 2013 at 5:05 pm #48215
fpl
Username: ctl

Hey Cristiàn,

Your shortcode seems okay, and it would create a subscription. The log entry you quoted says it’s a subscription too.

It does create a subscription on s2member’s side, but apparently not on PayPal’s.

I just made another test, with all .htaccess redirects disabled –> no joy.

Another weird thing is that there’s no Description whatsoever in PP’s receipts (customer & seller).
So, apparently this info is not transmitted to them, or it’s lost in translation… but only for recurring payments.

Getting a bit concened and very confused!

Posted: Monday Apr 22nd, 2013 at 10:30 pm #48142
fpl
Username: ctl

Hi there,

Any update on that? I’m having the exact same problem and it’s not a small one…

The “Description” field in Paypal receipts is blank… Well, everything exactly as described by t2media:

Description is blank unit price $9.99, qty 1, amount $9.99 – absolutely nothing about it being recurring. And on the seller side the receipt received was “You received a payment of $9.99 USD from …”

Pretty annoying, huh?

Thanks for your insight.

Posted: Monday Apr 22nd, 2013 at 7:12 pm #48127
fpl
Username: ctl

:)

Posted: Monday Apr 22nd, 2013 at 6:34 pm #48115
fpl
Username: ctl

You’re most welcome, Sir!
I told you I was a PHP ninja… ;)

Posted: Wednesday Apr 10th, 2013 at 8:14 am #47067
fpl
Username: ctl

Well, Cristiàn… you’re totally right.

I don’t know if you’ve ever been in this stupid state, where you don’t even remember why you have to do something, but all you “know” is you have to? It generally means you are knackered and you need a serious break… I went out of the stupid state yesterday, and wrote this awesomeness in my mu-plugins:

<?php function you_can_access()
	{
		echo ("<p><strong>Hi " . S2MEMBER_CURRENT_USER_FIRST_NAME . "!</strong></p><p>You currently have access to:</p>");
		if(current_user_can('access_s2member_ccap_module1')) 
		{
			echo ('
			<h4>Module 1</h4>
			<ul>
			<li>Content 1</li>
			<li>Content 2</li>
			<li>Content 3</li>
			</ul>
				');
		
		
		if(current_user_can('access_s2member_ccap_module2')) 
		{
		// Guess what?
		}

I’ll echo the ccaps… next time. ;)

Thanks again!

Posted: Tuesday Apr 9th, 2013 at 11:05 am #46912
fpl
Username: ctl

Thanks, Cristiàn!

1. Okay… I missed that.

2.

<?php
$user_capabilities = get_user_option('capabilities', S2MEMBER_CURRENT_USER_ID);
foreach ($user_capabilities as $cap => $v) {
	if (strpos($cap, 'access_s2member_ccap_') !== false)
		echo $cap . "\n";
}
?>

Returns:

access_s2member_ccap_module1
access_s2member_ccap_module2

Which is a good start ;) but, as you can guess, what I’d like to display is:

You have access to module 1, which contains:
[Links to posts included in module 1]

Posted: Monday Apr 8th, 2013 at 8:40 am #46841
fpl
Username: ctl

Thanks, Cristiàn!

So, you’re confirming that I did that in my sleep… Pretty scary! Better be careful around me…

Posted: Saturday Apr 6th, 2013 at 11:13 am #46767
fpl
Username: ctl

EDIT: I’ve been a bit quick pretending that I knew how to get the user’s ccaps (and I meant display them)…

I thought the whole answer was here: http://www.s2member.com/forums/topic/cant-receive-the-users-ccaps-values/

…but if I do as suggested and write:

<?php
$user_capabilities = get_user_option('capabilities', S2MEMBER_CURRENT_USER_ID);
print_r($user_capabilities);

$user_ccaps = explode('|', $user_capabilities);
echo $user_ccaps[1];
?>

I only get the result of print_r:

Array
(
[s2member_level1] => 1
[access_s2member_ccap_module1] => 1
[access_s2member_ccap_module2] => 1
)

Nothing is echoed. I’ve tried other delimiters, no luck. Really can’t figure out how to echo all the ccaps contained in the array, or any of them actually. I’ve tried a bunch of stuff suggested on php.net and stackoverflow, no luck either. Needless to say I’m a PHP ninja… ;)

Anyway, that’s just another question to add to the 2 previous ones.

Thanks for your assistance, the explode() function works miracles on my brain! ;)

Posted: Friday Apr 5th, 2013 at 10:12 am #46704
fpl
Username: ctl

Thanks Christiàn!

Being new to S2Member and not having really coded anything for ages, I feel safer under your benevolent control! ;)

Posted: Thursday Apr 4th, 2013 at 7:33 pm #46652
fpl
Username: ctl

Thanks Bruce!

I did use this conditional… but, well… I guess I needed a serious nap!
I can’t believe I did that… ;)

Anyway… everything’s fine. Much better when you open and close your conditionals at the right places.

Thanks again.

Bed!

Posted: Thursday Apr 4th, 2013 at 9:49 am #46609
fpl
Username: ctl

Do you mean the link in the widget for the profile page? Or is that were you’re taken after login?

No, I want the widget to totally vanish:

– if the user is not logged in, then display the login form.
– if (or once) he’s logged in, then display nothing at all, no profile summary, no links, nothing. I’ll insert other static & dynamic content instead.

Posted: Thursday Apr 4th, 2013 at 8:45 am #46591
fpl
Username: ctl

No, your logic seems fine.

That’s the good news of the day! Not for my ego –I don’t care too much about “him”, but for the continuation of the project. ;)

So you’re selling the ccap together with the level.

Yup, or: I’m selling the level together with the ccap.

But you see, you had to sell the level to do it as a subscription. When I said ccaps could only be buy-nows, I meant if sold independ of the level.

Okay, I see what you mean, now.

But instead of adding that ccap to the level to check if he has the ccap to see if he has that level, you could just check for the level in your conditional.

current_user_can("access_s2member_level1")

As I’ve done it, all buyers have the Level 1 role, with different ccaps:

fullmember Level1 all
module1user Level1 module1
module2user Level1 module2
module1and2user Level1 module1,module2

…so checking for the level wouldn’t make much sense here. Instead, I’m checking if he is a full member (ccap=”all”) or has the adequate ccap to access the post:

if(is_single() && has_tag('mod1'))
  {
      if(!current_user_can('access_s2member_ccap_all') && !current_user_can('access_s2member_ccap_module1'))
        {
            header('Location: http://mysite.com/custom-page/');
            exit;
        } 
  }

Bad, wrong, ugly, or just a different approach?

Posted: Tuesday Apr 2nd, 2013 at 7:42 pm #46421
fpl
Username: ctl

Hi Cristián,

Now my brain is really scrambled! ;)

You’ll need levels for subscriptions, ccaps can only be sold with buy-nows.

Here’s what I’ve done and it seems to be working just fine, but you worry me a little bit… (°°° am I missing something? Am I in for a bad surprise? °°°).

– Used WP Tags for all my posts: “module1”, “module2”, etc., and “members-only” for the ones that are not included in a module.

– Created a /mu-plugins/s2-haccess.php that checks that current_user_can access the ccap associated with each Tag. Of course, “members-only” which is associated with “all” ccap, is evaluated first.

– Generated PayPal Pro Forms for Level #1 Access (NOT “Buy Now”: they generate a “You must log in before making this purchase.” warning, and, of course, they can’t be used for the “members-only” ccap, as it’s recurring monthly)

I’ve tested with a PayPal Sandbox and everything seems to be working smoothly…
I’m not very happy with my PHP code (could probably be more compact but I had problems when I tried to use “||” operators, for some reason), but it does what it’s expected to do in 60-ish lines, so…

Can you see a flaw in my “logic”?

Posted: Monday Apr 1st, 2013 at 3:30 pm #46292
fpl
Username: ctl

Thanks for your reply, Cristián!

1. As I see it now, I think I should be able to do everything I want to do, using only Custom Capabilities and PHP Conditionals, not even bothering to do anything at a post-level nor even in Post Access Restrictions, right?

2. One of the things I’m not quite clear about, is when to use /mu-plugins/some-file.php or my theme’s functions.php… Could you clarify that for me?

Thanks!

Viewing 17 replies - 26 through 42 (of 42 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.