Support » Plugin: myCred - Points, Rewards, Gamification, Ranks, Badges & Loyalty Plugin » Award points for each youtube subscriber

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author myCred

    (@designbymerovingi)

    Hey.

    It depends. Is this a button you insert yourself or is it a button that is inserted via a plugin?

    I don’t know yet, because at the moment it’s just an idea.
    Maybe you could advise me how is much easier if i include the button myself or through a plugin. If the plugin is the right answer, please i ask you to recommend me one which including a feature that allows buddypress users to add a link of their youtube channel from their bp profile. Every user must have their youtube subscriber button and every user must award points for each youtube subscription.

    Plugin Author myCred

    (@designbymerovingi)

    Well my initial thought is that if the button has a unique ID we could probably target it with javascript to detect clicks. Then when the button is clicked I would fire of an AJAX call to award points to the current user. Of course I would also only insert this script if the user is logged in and has not yet received points for this. Otherwise there is no need for the script.

    Exactly what I need. Is there a solution?

    Plugin Author myCred

    (@designbymerovingi)

    Here is one example.

    Paste this code into your theme’s function.php file and then insert the subscription button somewhere on your website where you want the button to show up:

    <!-- Start myCRED -->
    <script src="https://apis.google.com/js/platform.js"></script>
    <div class="g-ytsubscribe" data-channel="ABCD" data-onytevent="mycredyoutubesub"></div>
    <!-- End of myCRED -->

    You will need to replace ABCD in the above code snippet with your YouTube Chanel ID and you might need to change the code snippet you pasted into your theme’s functions.php file to award the amount of points you want to award.

    The script will only award points if a user who is logged in subscribed to your channel. If they are not logged in, they will miss out getting points. Also, the example code will award 10 points for subscriptions and deduct 10 points if you unsubscribe.

    Hey Gabriel,
    thanks a lot for the code!
    I’ve updated the function.php with the code and i’ve added the <div> code in a page, obviously replacing the correct youtube id channel.
    It’s ok, but i don’t award points. I’ve tried with admin account and with normal user account, but in either case i haven’t awarding points.
    I use the latest version of plugin.
    Maybe I miss something else?

    Plugin Author myCred

    (@designbymerovingi)

    Ok so when you visit the page where the subscription button is shown, if you look at the source, can you see the javascript being inserted in the page header?

    If it is, then the question is if you are using an account that is excluded. I tested this code with myCRED 1.5.4 without any issues.

    Otherwise test this:

    In the code you inserted into your theme’s functions.php file replace:

    xmlhttp.send();

    with:

    xmlhttp.send();
    alert( 'Click!' );

    It should give you a popup warning with the text “Click!”. If you get this warning then we know that the listening script is working. Also remember you must be logged in.

    Thanks for the support, Gabriel!
    I’ve replaced the code in theme’s functions.php with the new code, but i don’t see no popup and i haven’t yet awarding points.

    Just to be sure:
    I paste the code in functions.php
    I paste in a post or a custom page the <div> code to subscribe youtube channel.
    Login on Youtube with my Google / YouTube’s account in a browser page.
    I make the login with my account on my wordpress site in another browser page.
    I go to the post or page of my site, subscribe the youtube channel with my google account and don’t award any points on my account mycred / wordpress.
    I don’t really know where is the mistake.

    I’ve tried also to paste the code in functions.php of another wordpress themes, but nothing has changed.

    Is there any configuration I need to do in the wordpress mycred’s panel between hooks, addons and general settings?

    I’m so sorry to bother you!

    Plugin Author myCred

    (@designbymerovingi)

    Ok so if you are not getting the alert then the script is not getting loaded.

    Since you see the YouTube button, the second part of the script which I pasted here is working so the question is why is the listening script not being loaded.

    You are sure you have pasted the code into the correct functions.php file? It should be your currently active theme or if you are using a child theme, the child theme’s functions.php file.

    Hi Gabriel,
    i’m sure i’ve pasted the code in the correct functions.php. I’ve tried also with other wordpress themes (No one has the child theme) and with other hosting provider.

    Plugin Author myCred

    (@designbymerovingi)

    Would it be possible for you to zip down the functions.php file you pasted the code inside and send me a copy to have a look? My emil is support [at] mycred [dot] me.

    Gabriel i’ve sent you an email few seconds ago! 🙂

    Plugin Author myCred

    (@designbymerovingi)

    Confirming that the code worked. The issue seemed to be with the YouTube channel set.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Award points for each youtube subscriber’ is closed to new replies.