Jump to content
Erwan

s2Member php scripts : in a PL custom page template ?

Recommended Posts

Erwan    37
Erwan

Hi,

 

I would really need to use s2Member scripts related to "Membership Options Page [aka MOP] Variables", for instance for displaying dynamic information on my MOP page such as what the user / member was attempting to access before they were redirected to it.

s2Member plugin provides code snippets, e.g. :

<?php
$_g = stripslashes_deep ($_GET);
if (isset ($_g["_s2member_seeking"]["type"]) /* One of: page|post|catg|ptag|file|ruri */ )
    echo 'You were trying to access a protected: ' . esc_html ($_g["_s2member_seeking"]["type"]) . '.';

My problem is: where should I put this kind of code?

 

Is it logical (I was said so...) and possible to put it in a custom page template (let's say: the 'pagemystwomember.php' file I created in my child theme and use for drag & drop) and affect this template to my s2Member MOP page?

Or should I rather put directly the code in my page (using a plugin like "Allow PHP in Posts and Pages"?

Many thanks in advance.

Share this post


Link to post
Share on other sites
James B    436
James B

Hi there,

 

I think I'm following what you mean. So the plugin hides the content regardless, you just want the additional message to appear if it does block the content?

 

The easiest option would to be to use a plugin like you've mentioned and place the code into a contentbox which has been placed into the layout via the drag and drop editor.

 

As we're not a standard theme, if you wanted to place the php code directly into the child theme's functions php I would think you'd need to edit it into a worpdress filter so it work correctly. More information on wordpress filters can be found at - http://codex.wordpress.org/Plugin_API/Filter_Reference and http://wp.tutsplus.com/tutorials/the-beginners-guide-to-wordpress-actions-and-filters/


Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites
Erwan    37
Erwan

Hi James,

  • Thanks for the good idea: I never thought about boxes this way, especially ContentBoxes. I placed my code in ContentBoxes (and "standard" Boxes too!) using the plugin I mentioned Allow PHP in Posts and Pages: it does work ;) !
     
  • This is of course a compromise solution and I would really have prefered to be able to use "real / full php": this plugin has some restrictions + it's not really what s2Member recommends i.e. use a seperate page template. But my knowledge of WordPress hooks is too limited for editing my child theme functions.php to achieve the same result (on the condition it is really relevant in this context, which I doubt).
     
  • In order to put an end to this topic: if I understand you correctly, my custom page template files are not supposed to content anything else than the template name and the following code, and cannot be a solution here in no way at all?
<?php
setup_pagelines_template();

Share this post


Link to post
Share on other sites
James B    436
James B

Hi there,

 

That's great news the plugin code in the contentbox worked.

 

Unfortunately you're correct with the page template files, the actual data within those template files pulls the php/code from other files within the framework, depending on what sections are present in the template on the drag and drop page.

 

If you were to enter custom code directly into the template.php file it could affect the setup of the template and stop any other sections from being pulled in etc. Plus any content you put into those files would be wiped each time you updated the framework, which is why they suggest using hte functions.php of a child theme or the customize plugin as this will be safe from updates as it's outside of the core files.

  • Like 1

Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites
Erwan    37
Erwan

Thanks for everything: marked as solved ;) !

Share this post


Link to post
Share on other sites
Rob    547
Rob

Great!


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Similar Content

    • yemoonyah
      By yemoonyah+
      Hi,
       
      I have ProPricing installed and I know I can enter a button link.
       
      However, I also have s2Member installed which creates Paypal subscription buttons for me which have a lot of information about subscriber levels, etc. that need to be communicated to Paypal.
       
      I want to combine the two and basically have the S2Member buttons take the place of the ProPricing buttons inside the ProPricing section BUT with the look of the ProPricing buttons.
       
      Or, in other words, have the ProPricing buttons communicate all the S2 member button information to Paypal.
       
      I have no clue how to do this!
       
      Any ideas?
       
       
      Thanks
×