Problem with Paypal button
-
This is a pretty significant problem which I’ve just been alerted to on a website I created for this client.
They have a membership page which offers the option of paying for a membership with Paypal. I do not have access to the client’s Paypal account – they created the button and then sent me the code.
When I paste the code into the page on the text editing tab, the resulting Paypal field looks fine, but the drop-down boxes for length of membership, whether they are a new member or renewing, and which format they wish to receive their newsletter in, do not work!
I did some sleuthing on the support site, and found some indications that a custom template is required or something to that effect, but I have yet to make heads or tails out of it. This is pretty time sensitive, since the client did not discover the issue until AFTER the site went public (they’ve only had two weeks to review the site).
-
This will more likely be a WordPress editor issue.
I’m not sure what the code is that was used, but my guess is that if this was added to the “text” view on the page editor, that the editor has stripped out parts of it. After you add the code to the editor and then save it, look at the code again and see if anything was stripped out. The WordPress editor is notorious for doing that, even for basic HTML code elements.
There are many who experience problems even with trying to insert a paypal pay or donate button.
Again, I don’t know what kind of code was being added, but this might be something that could require a third party editor plugin that won’t strip out stuff, or a custom template might be required in this situation and assigned to that page. The “content” code would have to be placed above the PayPal code in the template.
I’m not sure what other options there are for this…perhaps there are plugins. This might even require using an actual Membership plugin for WordPress.
Again, depending on what the code was that was put in, there could even be a form or script conflict with another script from a plugin.
Quick follow up…I’m wondering if there is a forms plugin that can be used in this situation where the form is created with it, then added to a page as a shortcode. So when the page is viewed on the front-end, the shortcode converts to the full form code, therefore not losing any code from the editor (if that is what is happening).
I’m using TinyMCE Advanced as my editor. I did see something in one of the posts about not switching back to the visual editor after inserting the Paypal code in the text editor, so I tried that, but it didn’t seem to make any difference. I’ll have to go back and try again, and see if when I update the page the editor strips anything out.
Follow-up on your follow-up…interesting thought. Searching the plugin directory for “forms” brings up a lot of contact form plugins, but that’s not what’s needed here – more research needed…
I found this, referreed to in an old thread about the problem, but either I’m suffering from Alzheimers or stress – I’m not GETTING it!
I’m assuming then that some code is being stripped out from your test?
I use TinyMCE advanced for my demo sites, but I also use HTML Editor Syntax Highlighter so I can see colour coded html. Still, it does not prevent WordPress from still stripping certain elements…extremely annoying.
As for plugins, you won’t be using “Contact” form plugins, but rather you would seek out actual form building plugins.
Like Form Maker Pro? Which I have, and which is already installed on this site?
That last link you posted is not quite what I would do, especially because that plugin they mentioned has not been kept up to date (2 years old).
For Longevity, you maybe try this:
1. Create a new page template using the page.php file as a “template” to make a copy of. Name the file like: template-paypal.php and then in the top part, replace:
* The template for displaying pages
to
* Template Name: PayPal Template
Then make sure this is saved to the page-templates folder.
2. Then the code that is between the <main> container:
<?php get_template_part( 'loop' ); ?>Replace that with the code that is between the
<main> ... </main>from the template-full-width.php template file (you will need to open it to get that). This will give the ability to add content to the page from the editor.3. Then, after that code and just above the closing
</main>tag, the PayPal code would go in that spot.4. Assign this page template to the page in question, and see if the form works.
This is only a possible solution because again, I don’t know what kind of code is being used for the PayPal setup, but if it’s HTML code, there is a possibility that this option could work.
IMPORTANT: Make backups before doing anything in case you had to revert back. Also, adding a new page template should be fine when theme updates come in, but normally it’s better to make these kinds of changes or addons using a child theme so you don’t lose anything custom.
Remember….ALWAYS keep BACKUPS.
Form Maker Pro? If you have that, you can try that first and see if that works. I’m not familiar with that plugin, but if it has the ability to add custom form code, try it out first before making a page template (last resort)
Actually, your solution looks easier than the Form Maker Pro instructions, which make no sense to me at all…
So I’m trying your solution. I’ve done everything up to, but not including, step #3 above – this is the code I have in my template-paypal.php file
<?php /** * Template Name: PayPal Template * * This is the template that displays all pages by default. * Please note that this is the WordPress construct of pages and that * other "pages" on your WordPress site will use a different template. * * @package Longevity */ get_header(); ?> <div class="container"> <?php get_sidebar( 'cta' ); ?> <?php get_sidebar( 'breadcrumbs' ); ?> <?php get_sidebar( 'top' ); ?> <div class="row"> <div class="col-lg-9"> <div id="primary" class="content-area"> <main id="main" class="site-main" role="main"> <?php // Start the loop. while ( have_posts() ) : the_post(); // Include the page content template. get_template_part( 'template-parts/content', 'page' ); // If comments are open or we have at least one comment, load up the comment template. if ( comments_open() || get_comments_number() ) : comments_template(); endif; // End the loop. endwhile; ?> </main> </div> </div> <div class="col-lg-3"> <?php get_sidebar( 'right' ); ?> </div> </div><!-- .row --> <?php get_sidebar( 'content-bottom' ); ?> </div><!-- .container --> <?php get_footer(); ?>Does that look right?
Now, when you say:
Then, after that code and just above the closing </main> tag, the PayPal code would go in that spot.
, do you mean add it to the template-paypal.php page before I upload it? And where would I upload that file to? The page-emplates directory? Or the root “longevity” directory?
And, yes, I am a backup fiend!
looks correct.
the paypal custom code would go into that template between this:
endwhile; ?>and the closing
</main>tag.This gets uploaded to the /page-templates/ folder where you see the others like “template-fullwidth.php”
OK, I will give that a try, but probably not until tomorrow morning.
By the way, the button code from Paypal begins with:
<form action=”https://www.paypal.com/cgi-bin/webscr” method=”post” target=”_top”>
…and goes on from there.
Ok, so I couldn’t help myself. I went ahead and tried it just now. The dropdowns still don’t work…[:-(
Next, I will try comparing the code to see if the editor is dropping something…but that will definitely have to wait until morning.
If you created a template with the paypal code in it, then the code should be intact then. I just grabbed the paypal form code (actually the full page) from your website and put it into a page on my local test site using Longevity. I was able to get the drop down select fields to work.
This may be a longshot, but if the code being added in the editor is all there and nothing is being stripped out, or you still have that custom template, I am wondering if that no right click script you are running is the cause of the problem. Disable it and see what happens.
Holy schnikies, you are a GENIUS! That did it! I am doing a happy dance – I KNEW the drop-downs were working at one point! That’s because I had the copy protection script disabled while I was working on the site, and only re-enabled it before going public!
Now the client just has to decide what they want more – copyright protection for their contributors’ images, or having their Paypal button working…I have a feeling I know which they will choose.
Thank you again for the great support!
The topic ‘Problem with Paypal button’ is closed to new replies.
