AddShoppers social sharing - Configuring with Memberships

Hi

We have installed the social sharing plugin / service from AddShoppers.com and need some guidance on some aspects of configuration. https://en-gb.wordpress.org/plugins/social-sharing-buttons-by-addshoppers/

1. Shares, leads & resulting sales are tracked / recorded by AddShoppers with a script loaded into our sales completion page.

<script type="text/javascript">
AddShoppersConversion = {
order_id: <order id>,
value: <order value>
};
var js = document.createElement('script'); js.type = 'text/javascript'; js.async = true; js.id = 'AddShoppers';
js.src = ('https:' == document.location.protocol ? 'https://shop.pe/widget/' : 'http://cdn.shop.pe/widget/') + 'widget_async.js#56902335a387646ccc9a32c3';
document.getElementsByTagName("head")[0].appendChild(js);
</script>

We need to ensure that we have the correct M2 script for the 2x fields - <order id> & <order value> .

2. We would like to use the AddShoppers social login feature on both the M2 Login & Register pages and have been given the following php code to use;
<?php addshoppers_show_social_login('facebook,twitter,google','large'); ?>
Please can you advise / supply some script so that we can achieve this?

Many thanks,

  • Kasia Swiderska
    • Support nomad

    Hello BizE,

    ad 1) Can you tell me when this script should load? When user buys subscription on your site, yes? An this should be represent by the order id and value?

    ad 2) Both login and registration forms have own pages where are added shortcodes for that forms. So you would need to create new separate page template for that pages with function you have or use plugin like this: https://wordpress.org/plugins/insert-php/

    kind regards,
    Kasia

  • BizE
    • Site Builder, Child of Zeus

    Hi Kasia

    1. Yes, after the user has bought a membership, the M2 Registration-Complete page loads, which is where this script has been added. I assume M2 process creates an "order id" and "value", it is just making sure we are collecting the correct data to report to AddShoppers.

    2. ". . . login and registration forms have own pages" ? As I can see it, login is taking place on the M2 "Account" page and registration takes place as part of the Memberships signup functionality and not the standard WP process? I can try adding the php to the Accounts page, but maybe you can check to confirm the process on your install?

    Regards,
    Paul

  • Kasia Swiderska
    • Support nomad

    Hello BizE,

    I've spoke with developer about your first question and Membership doesn't handle order ID - and only thing we could use here is Transaction ID, but this require custom coding, and because I'm not developer I'll need to ping Second Line Support - our coding team.

    2. Can we add this to the M2 Login & Registration pages by somehow putting in our theme's functions.php file?

    Yes, this could be possible - with using right hooks you should be able to add this additional code:
    - register_form is the hook to add html in the registration form
    - for login form, you have three available filters you can use: login_form_bottom, login_form_middle, login_form_top - they allow you to insert code into top, middle or bottom of the login form (code for this form you will find here /wp-content/plugins/membership/app/view/shortcode/class-ms-view-shortcode-login.ph )

    kind regards,
    Kasia

  • BizE
    • Site Builder, Child of Zeus

    Hi Kasia

    1. Noted and look forward to hearing back on this.
    2. Apparently we can also use a shortcode to add the social logins and so this is what I tried adding to my theme's functions.php file. Unfortunately it didn't work, causing a server error - not one of my skills! I'd be very grateful if could you review and correct this, as well as indicate the same type of code required for the login page too.

    function addshoppers_show_social_login() {
    echo do_shortcode('[AddShoppersSocialLogin networks="facebook,google,twitter" size="medium"]');
    };
    add_action('register_form', 'addshoppers_show_social_login');

    Thanks & regards,
    Paul

  • Kasia Swiderska
    • Support nomad

    Hello Paul,

    Please try this code:

    add_action('register_form','addshopersaociallogin');
    
    function addshopersaociallogin($error) {
    	echo do_shortcode('[AddShoppersSocialLogin networks=&quot;facebook,google,twitter&quot; size=&quot;medium&quot;]');
    }

    I've tested it on my site and looks like it is working - please see attached screenshot.

    kind regards,
    Kasia

  • BizE
    • Site Builder, Child of Zeus

    HI Kasia

    Just tried it and unfortunately it is still not showing.
    Is "register_form" the right reference to the correct M2 form? I have left it in functions.php if you could take a look too?

    Regards,
    Paul

  • Kasia Swiderska
    • Support nomad

    Hello Paul,

    Yes, this is right code - screenshot is from my site, from the M2 registration form. However I noticed that in my snippet code the " signs were replaced by & quot; - did you paste code as is with & quot; ? If yes, please change them to " characters.

    I cant check this on your site due to "Invalid access token" - you would need to revoke and grant access again.

    kind regards,
    Kasia

  • BizE
    • Site Builder, Child of Zeus

    Hi Kasia

    Yes, that was an issue and I have amended the code to this, but still cannot see it. WPMU DEV Support is enable in our dashboard if you can see what you need there.

    add_action('register_form','addshopperssociallogin');

    function addshopperssociallogin() {
    echo do_shortcode('[AddShoppersSocialLogin networks="facebook,google,twitter" size="medium"]');
    }

  • Rupok
    • Support Ninja

    Hi BizE

    I hope you had a wonderful day.

    Thanks for granting Support Access. I logged in with Support Access, created a test page here (https://bigrockgaming.com/test-social/) just to check if the addshopper plugin has any conflict with anything on your theme or not, and on that page, social signup buttons appeared perfectly. So we are very close to make this work, but for testing from your functions.php file, I used the code there and as you said "Unfortunately it didn't work, causing a server error", same happened again though the exact same code worked perfectly fine on my test site. So to bring your site live, just remove the block in your theme's functions.php or I can fix it, make some tests and make it work if you send me your FTP credentials. Can you please send me message with FTP access credentials through our secure contact form here: https://premium.wpmudev.org/contact/

    Subject: "Attn: Rupok"
    - WordPress admin Username
    - WordPress admin Password
    - Login URL
    - Link back to this thread for reference
    - Any other relevant URLs

    Select "I have a different question" for your topic - this and the subject line ensure that it gets assigned to me.

    This time, I'll try this with MU Plugin, and I believe, it will be solved very soon.

    Have a nice day. Cheers!
    Rupok

  • BizE
    • Site Builder, Child of Zeus

    Hi Rupok

    Thanks and great to hear that you are making progress with this. I have remove the code from functions.php file so the site is back up again and sent you the logins as requested.

    Look forward to hearing back from you again.
    Paul

  • Rupok
    • Support Ninja

    Hi BizE

    I hope you had a wonderful day.

    It's working fine in Login page now: https://bigrockgaming.com/memberships/?step=register&do-login=1

    About registration page, can you please confirm if there is any caching plugin at site level or server lever? Are you passing your site through CDN? Because the registration page seems to be stuck. No changes in the registration form is reflected on site. Can you please make a plugin conflict test and check if the issue is resolved or not? To know more about plugin conflict test, you can check this page: https://premium.wpmudev.org/manuals/using-wpmu-dev/getting-support/

    I've already moved the code from functions.php file to MU Plugin and have added code for both login page and the registration page.

    Please confirm the result after you clear your cache and disable all other plugins. If it still doesn't show, please let us know. I'll look into more details then.

    Have a nice day. Cheers!
    Rupok

  • BizE
    • Site Builder, Child of Zeus

    Hi Rupok

    Mostly working now, here is what I did;

    1. We are using both Wordfence & Cloudflare CDN, so I set relevant to be excluded from cache.

    2. Buttons still did not appear on Register form, but have found that "register_form" is not the correct address. I found in the M2 plugin file - /plugins/membership/app/view/shortcode/class-ms-view-shortcode-registeruser.php that as a multisite, we are actually using this form - "signup_extra_fields".
    I changed this is the mu-plugin file and now all works ok.

    3. Only remaining issue now are the URL links created with other languages (we are using WPML which is enabled in M2). If you look at the site in either "English - USD" or "English-EUR" languages, then select a membership and try to register, the URL that is created has 2 query strings - 1 for the product and 1 for the language. The first query runs BUT the second query for language is not implemented and the site switches back to a default language page English GBP. Any ideas on this one or do I need to start a different ticket?

    Regards,
    Paul

  • BizE
    • Site Builder, Child of Zeus

    Hi Kasia

    No problem, pleased to get it sorted out. I have now also got the language url links working too, so no need to make a further ticket.

    So we just have 1 outstanding item on this ticket, re the transaction id & value data when an order is made. You said that this has been referred to another developer, so shall we leave this ticket open for now?

    Thanks,
    Paul

  • Rupok
    • Support Ninja

    Hi Paul

    I hope you had a wonderful day.

    I just tried to communicate with our developer regarding the following issue but he is offline now.

    We need to ensure that we have the correct M2 script for the 2x fields - <order id> & <order value>

    I've already told him about this, and I'll get back to you as soon as I get anything from him.

    Have a nice day. Cheers!
    Rupok

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.