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™

php problem when adding to the level of user

s2Member Plugin. A Membership plugin for WordPress®.

php problem when adding to the level of user

Postby Dawn123 » February 11th, 2011, 9:08 am

Hi,
I am developing a website in Wordpress with S2member standard, as I am not a programmer the tutorials are excellent but I have arrived at the API/ Scripting section, which is causing me major problems, I have the upgrade button and the cancellation button showing these are fine, until I add the php code shown below from the snapshot. Once I add this code and update and view the page I lose the unsubscribe button. When I go back to the editor in Wordpress to check the code it has then changed to the 2nd code I am showing below, but I do not understand why as I have checked this with the tutorial and the first set of code seems correct. At the moment this is not a live site.

Exec-PHP WYSIWYG Conversion Warning. Saving this article will render all contained PHP code permanently unuseful. Even if you are saving this article through the Code editor. You can turn off this warning in your user profile. Ignore this warning in case this article does not contain PHP code. Read the Exec-PHP documentation if you are unsure what to do next.
<?php if(current_user_can(“s2member_level1”)){ ?>
Would you like to upgrade? (checkout here)
6 months subscription
[s2Member-PayPal-Button level="2" ccaps="" desc="Standard Membership 6 months £27.00 per month one payment £162.00 w/£31.00 monthly renewal*" ps="paypal" cc="GBP" ns="1" custom="www.painfree-drugfree-selfhelp.com" ta="162.00" tp="6" tt="M" ra="31.00" rp="1" rt="M" rr="1" image="default" output="button" /]
<?php } ?>

<?php if(current_user_can(“s2member_level2”)){ ?>
Would you like to cancel?
[s2Member-PayPal-Button cancel="1" image="default" output="anchor" /]
<?php } ?>


2nd Code after the page has been update

<!-- p if (current_user_can(“s2member_level1”)){-->
Would you like to upgrade? (checkout here)
6 months subscription
[s2Member-PayPal-Button level="2" ccaps="" desc="Standard Membership 6 months £27.00 per month one payment £162.00 w/£31.00 monthly renewal*" ps="paypal" cc="GBP" ns="1" custom="www.painfree-drugfree-selfhelp.com" ta="162.00" tp="6" tt="M" ra="31.00" rp="1" rt="M" rr="1" image="default" output="button" /]
<!--p }-->

<!--p if(current_user_can(“access_s2member2”)){-->
Would you like to cancel?
[s2Member-PayPal-Button cancel="1" image="default" output="anchor" /]
<!- -p }-->

Hope to hear from someone soon, as all my work will be in vein if I cannot find a solution to this .I have no idea how to do code without the tutorial. I am learning everything including making the website as I go along. :)

Dawn.
User avatar
Dawn123
Registered User
Registered User
 
Posts: 6
Joined: February 11, 2011

Re: php problem when adding to the level of user

Postby stowe39 » February 15th, 2011, 8:37 pm

in order to use php code directly in your wordpress pages you need to have this plugin installed http://wordpress.org/extend/plugins/php-execution-plugin/ without it wordpress doesn't know what to do with the php code...

Have you got that plugin installed and activated?

Cheers

Kym
User avatar
stowe39
Registered User
Registered User
 
Posts: 22
Joined: February 15, 2011

Re: php problem when adding to the level of user

Postby Dawn123 » February 16th, 2011, 9:17 am

Hi Kym
The only plugin I installed was the one recommended by the s2member tutorial under API/Scripting , a
plugin Exec-PHP. If I can just digress a little , I have been checking every step since making this post and have noticed that when I go to create the Paypal button, in the tutorial it shows you a preview of the button before you click generate code. When I try this there is no preview button just the generated code, I have again copied and pasted the code into the page and on viewing the page and seeing the button there, then clicked them which has taken me to PayPal where a message then says "the link you have used to enter PayPal is invalid. Please review the link and try again".
I was wondering if this is because it did not show me a preview of the button first as shown in the tutorial. and that is why the php code was not working either.I have not installed the plugin you mentioned above.Do I still need to install this plugin and is it a download.
I really appricate your help I have now been trying to get these button done for over 3 weeks and cannot move forward.
Hope to hear from you soon
Dawn
User avatar
Dawn123
Registered User
Registered User
 
Posts: 6
Joined: February 11, 2011

Re: php problem when adding to the level of user

Postby Dawn123 » February 16th, 2011, 8:11 pm

Hi Kym
I have just notice that on my s2member plugin under the PayPal buttons section after filling in the details in the centre of the page , to the left of this there is insufficient space under to show a preview of the generated button. I have no idea how to get around this problem.

I should mention that I have downloaded the plugin you suggested above , so now i have 2 php plugins , do I need them both or should I delete the one suggested by s2member tutorial ?.
User avatar
Dawn123
Registered User
Registered User
 
Posts: 6
Joined: February 11, 2011

Re: php problem when adding to the level of user

Postby stowe39 » February 16th, 2011, 8:40 pm

Hi Dawn

The php plugin I posted a link to is the one recommended in S2Member --> API / Scripting --> Using Advanced Conditionals.

You only need 1 php plugin - use the one recommended by YOUR version of S2Member. (the video tutorials might be done using and earlier version)

I have Version 3.3.2 of S2Member and its the free one. What version are you using? mine doesn't show the button preview either - but it works fine.

Have you entered a valid paypal account email address in s2Member PayPal® Options --> PayPal® Account Details?

Did you put the * in the description field when generating the button? try removing it... and remove the / in the description too...

Cheers

Kym
User avatar
stowe39
Registered User
Registered User
 
Posts: 22
Joined: February 15, 2011

Re: php problem when adding to the level of user

Postby Dawn123 » February 16th, 2011, 8:56 pm

Hi Kym
thanks for replying ,I am using s2member 3.3.2 the same as yourself , but in the s2member tutorial API/Scripting-->Using advanced Conditionals. It mentions before you start the process to download the Exec-PhP not the one you mentioned should I deactive this Plugin and keep yours?.

I am working in sandbox mode maybe this is not a good idea, the only email address that is valid is the one to get into the sandbox test area . The user and buyer emails are dummy.
this is how i have filled in the fields for the level 1
I'll offer the first 3 months@£90.00
then ,I want to charge£35.00
Monthly recurring

description : Standard Membership 3 months £30.00 per month one payment £90.00 w/£35.00 monthly renewal*

I did the same thing with level2
I'll offer the first 6 months @£162.00
then ,I want to charge£31.00
Monthly recurring

Description 6 months £27.00 per month one payment £162.00w/£31.00 monthly renewal*

I still do not understand where I am going wrong.
Dawn
User avatar
Dawn123
Registered User
Registered User
 
Posts: 6
Joined: February 11, 2011

Re: php problem when adding to the level of user

Postby Dawn123 » February 16th, 2011, 9:04 pm

Kym if we are both using the same version of S2member which we are I think I will keep your plugin and remove the Exec-PHP.
Will wait to hear your views on the post above.
Thanks :)
User avatar
Dawn123
Registered User
Registered User
 
Posts: 6
Joined: February 11, 2011

Re: php problem when adding to the level of user

Postby stowe39 » February 17th, 2011, 12:54 am

Hi Dawn

Sandbox mode is a great idea - it lets you iron out the bugs without it costing you money :)

I just tried creating a button using the options you chose on my test site. It worked when I took the pound sign (£) out of the description field - but didn't work at all with the pound sign in the description.

Cheers

Kym
User avatar
stowe39
Registered User
Registered User
 
Posts: 22
Joined: February 15, 2011

Re: php problem when adding to the level of user

Postby stowe39 » February 17th, 2011, 8:07 pm

Hi Dawn

This code should work (it does on my test site - using the PHP Execution plugin)

Code: Select all
<?php if(current_user_can("access_s2member_level1")) { ?>
Would you like to upgrade? (checkout here)
<strong>Premium Membership 6 months</strong>. General
symptoms,treatment of listed conditions plus complimentary recommendations.
&#163;27.00 per month one payment &#163;162.00 w/&#163;31.00 monthly
renewal<strong>*</strong>  [s2Member-PayPal-Button level="2" ccaps=""
desc="Premium Membership 6 months GBP 27.00 per month one payment GBP
162.00 w/GBP 31.00 monthly renewal" ps="paypal" cc="GBP" ns="1" custom="www.painfree-drugfree-selfhelp.com"
ta="162.00" tp="6" tt="M" ra="31.00" rp="1" rt="M" rr="1" modify="1"
image="default" output="button" /]
<?php } ?>

<?php if (current_user_can("access_s2member_level1")) { ?>
    Would you like to cancel? <br>
    [s2Member-PayPal-Button cancel="1" image="default" output="anchor" /]
<?php } ?>


I only made a few adjustments to your code. It needed the access_ bit infront of where it has s2member_level in the conditional bit.

Also the inverted commas around the conditional were the 66 and 99 sort (which I wouldn't have noticed except I use hateml http://www.migajek.com/?c=hateml for my coding and it didn't make the code pink like it does for php stuff that's in quotes)

I also used &#163; for the html code for the pound sign (coz my webserver couldn't display it) Here's a good list for html codes for special characters http://www.degraeve.com/reference/specialcharacters.php in case you ever need some.

Cheers

Kym
User avatar
stowe39
Registered User
Registered User
 
Posts: 22
Joined: February 15, 2011

Re: php problem when adding to the level of user

Postby Dawn123 » February 18th, 2011, 7:40 am

Kym,
This works fine , again thank you. I am going to check out the two links you have given me here. Regarding the inverted commas this is all I have on my keyboard , how would I get around that ?
User avatar
Dawn123
Registered User
Registered User
 
Posts: 6
Joined: February 11, 2011

Re: php problem when adding to the level of user

Postby stowe39 » February 18th, 2011, 8:59 pm

Hi Dawn

There is only one sort of quote on a keyboard (on mine its shift + the key next to the enter key)

I'm guessing you were typing the code into microsoft word or some other program while you were going through the tutorials? and then copy/pasting it into wordpress? because microsoft word "autocorrects" the quote marks to the 66 and 99 sort.

If you were typing it into MS word, use notepad instead or hateml - they wont change any of your carefully entered text.

Cheers

Kym
User avatar
stowe39
Registered User
Registered User
 
Posts: 22
Joined: February 15, 2011


Return to s2Member Plugin

Who is online

Users browsing this forum: Bing [Bot], Exabot [Bot], Yahoo [Bot] and 2 guests

cron