Comments on: Awarding points for users who “Share” a post. https://mycred.me/tutorials/awarding-points-for-users-who-share-a-post/?utm_source=rss&utm_medium=rss&utm_campaign=awarding-points-for-users-who-share-a-post Free WordPress Reward, Badge, Loyalty & Points Management Plugin Fri, 09 Aug 2024 11:31:35 +0000 hourly 1 https://wordpress.org/?v=6.6.1 By: felipeduque https://mycred.me/tutorials/awarding-points-for-users-who-share-a-post/#comment-62561 Mon, 20 Dec 2021 14:45:45 +0000 https://devstages.wpengine.com/?post_type=tutorial&p=816#comment-62561 I tried everything here, and still not working.

I put it in function.php and single.php but still not working.

Using WP 4.9 and MyCred 1.8 (beta). Already tried with 1.7.x (latest)

]]>
By: istartups https://mycred.me/tutorials/awarding-points-for-users-who-share-a-post/#comment-62560 Mon, 20 Dec 2021 14:45:45 +0000 https://devstages.wpengine.com/?post_type=tutorial&p=816#comment-62560 Excuse me here do i have to firstly install the wordpress share this plugin befoe this code i will paste in my function.php works.
or there is no need to install any plugin just install and it works

]]>
By: Jidmik https://mycred.me/tutorials/awarding-points-for-users-who-share-a-post/#comment-62562 Mon, 20 Dec 2021 14:45:45 +0000 https://devstages.wpengine.com/?post_type=tutorial&p=816#comment-62562 Hello, I need you to please Help me with the Code For Earning Point when Sharing Post to Facebook. Please I need help on that.

https://mycred.me/tutorials/awarding-points-for-users-who-share-a-post/

]]>
By: Fajar Permana https://mycred.me/tutorials/awarding-points-for-users-who-share-a-post/#comment-62557 Mon, 20 Dec 2021 14:45:20 +0000 https://devstages.wpengine.com/?post_type=tutorial&p=816#comment-62557 Hi Gabriel, I have the same problem lik this. What shoul I do to fix it. Thank you

]]>
By: Elvin https://mycred.me/tutorials/awarding-points-for-users-who-share-a-post/#comment-62555 Mon, 20 Dec 2021 14:45:20 +0000 https://devstages.wpengine.com/?post_type=tutorial&p=816#comment-62555 I put all the code you provided to us.

add_shortcode( ‘mycred_share_this’, ‘mycred_render_shortcode_share_this’ );
function mycred_render_shortcode_share_this( $attr, $link_title )
{
// Get URL (we assume you only use this shortcode inside the loop)
$url = get_permalink();

// Add affiliate link (requires myCRED 1.5.3 or higher)
$url = mycred_render_affiliate_link( array( ‘url’ => $url ) );

// Append social media share urls
if ( $attr[‘href’] == ‘facebook’ )
$attr[‘href’] = ‘https://www.facebook.com/sharer/sharer.php?u=’ . urlencode( $url );
elseif ( $attr[‘href’] == ‘twitter’ )
$attr[‘href’] = ‘http://twitter.com/home?status=’ . urlencode( $url );
elseif ( $attr[‘href’] == ‘google’ )
$attr[‘href’] = ‘http://plus.google.com/share?url=’ . urlencode( $url );
elseif ( $attr[‘href’] == ‘pinterest’ )
$attr[‘href’] = ‘http://pinterest.com/pin/create/button/?url=’ . urlencode( $url );

// Always make links open in a new window
$attr[‘target’] = ‘_blank’;

// Pass it on
return mycred_render_shortcode_link( $attr, $link_title );
}

but as I can make links are displayed facebook , twitter , etc , so that the user can click

]]>
By: giore https://mycred.me/tutorials/awarding-points-for-users-who-share-a-post/#comment-62556 Mon, 20 Dec 2021 14:45:20 +0000 https://devstages.wpengine.com/?post_type=tutorial&p=816#comment-62556 hi Gabriel,
i also have such request for my site ‘Add Referral ID to the URL’, so i able to give points to social users after they view my site shared post(link) or register as member to gain points on my site instead of just count the shared link, and i was told and guided by the social button plugin vendor that should just need to put a line of your code snippet into its script file of the location he mentioned:
$url = mycred_render_affiliate_link( array( ‘url’ => $url ) );

but it seem like it can not be works after added the code snippet into the script file, so may i have your assisting for what i was miss out or anything may be goes wrong?
(see near the bottom sentence that have stated ‘//giore add mycred affiliate code’ which i insert your code snippet)

// custom_share_message_address
$post_essb_post_share_message = $postMetaOptions['essb_post_share_message']; //get_post_meta($post->ID, 'essb_post_share_message', true);
$post_essb_post_share_url = $postMetaOptions['essb_post_share_url']; //get_post_meta($post->ID, 'essb_post_share_url', true);
$post_essb_post_share_image = $postMetaOptions['essb_post_share_image']; //get_post_meta($post->ID, 'essb_post_share_image', true);
$post_essb_post_share_text = $postMetaOptions['essb_post_share_text']; //get_post_meta($post->ID, 'essb_post_share_text', true);
$post_essb_post_fb_url = $postMetaOptions['essb_post_fb_url']; //get_post_meta($post->ID, 'essb_post_fb_url', true);
$post_essb_post_plusone_url = $postMetaOptions['essb_post_plusone_url']; //get_post_meta($post->ID, 'essb_sidebar_pos', true);

$post_essb_twitter_username = $postMetaOptions['essb_post_twitter_username']; //get_post_meta($post->ID, 'essb_post_twitter_username', true);
$post_essb_twitter_hastags = $postMetaOptions['essb_post_twitter_hashtags']; //get_post_meta($post->ID, 'essb_post_twitter_hashtags', true);
$post_essb_twitter_tweet = $postMetaOptions['essb_post_twitter_tweet']; //get_post_meta($post->ID, 'essb_post_twitter_tweet', true);

$post_essb_as = $postMetaOptions['essb_as']; //get_post_meta($post->ID, 'essb_as', true);

$salt = mt_rand ();

// show buttons only if post meta don't ask to hide it, and if it's not a shortcode.
if ( $show_me ) {

// @since 1.3.9.6 - check if it is shortcode then options by bp will not be executed otherwise we correct state with possible values from settings
if ($is_shortcode) {
$this->options_by_bp_active = false;
}
else {
$this->set_options_by_bp_activate_state();
}

// texts, URL and image to share
$text = esc_attr(urlencode($post->post_title));
$url = $post ? get_permalink() : ESSBOptionsHelper::get_current_url( 'raw' );
if ($this->avoid_next_page) {
$url = $post ? get_permalink($post->ID) : ESSBOptionsHelper::get_current_url( 'raw' );
}

//giore add mycred affiliate code
$url = mycred_render_affiliate_link( array( 'url' => $url ) );

//$url = urlencode(get_permalink());
if ( $is_current_page_url ) {
$url = ESSBOptionsHelper::get_current_url( 'raw' );
}

if (!$is_shortcode) {
$force_wp_fullurl = isset($options['force_wp_fullurl']) ? $options['force_wp_fullurl'] : 'false';
if ($force_wp_fullurl == 'true') {
//if (ESSBOptionsHelper::exsitQueryString()) {
$url = ESSBOptionsHelper::curPageURL();
//}
}
}

if you want to have a look for the whole script file, i can send it to you.

many thanks

]]>
By: Fajar Permana https://mycred.me/tutorials/awarding-points-for-users-who-share-a-post/#comment-62558 Mon, 20 Dec 2021 14:45:20 +0000 https://devstages.wpengine.com/?post_type=tutorial&p=816#comment-62558 Hi Gabriel, can I integrate this with jetpack social media sharing button?

]]>
By: Gabriel Merovingi https://mycred.me/tutorials/awarding-points-for-users-who-share-a-post/#comment-62559 Mon, 20 Dec 2021 14:45:20 +0000 https://devstages.wpengine.com/?post_type=tutorial&p=816#comment-62559 Hey. Right now no. I have been looking into this a while back and found a few limitations posed by Jetpack. That was a few versions ago.

]]>
By: giorgos https://mycred.me/tutorials/awarding-points-for-users-who-share-a-post/#comment-62552 Mon, 20 Dec 2021 14:45:13 +0000 https://devstages.wpengine.com/?post_type=tutorial&p=816#comment-62552 I pasted the code to my functions.php
I added
to

to my single.php
but then I receive below warnings when viewing a post. Any idea what is causing that?


Warning: Illegal string offset 'href' in /functions.php on line 265

Warning: Illegal string offset 'href' in /functions.php on line 267

Warning: Illegal string offset 'href' in /functions.php on line 269

Warning: Illegal string offset 'href' in /functions.php on line 271
error Anchor missing URL!

]]>
By: giorgos https://mycred.me/tutorials/awarding-points-for-users-who-share-a-post/#comment-62554 Mon, 20 Dec 2021 14:45:13 +0000 https://devstages.wpengine.com/?post_type=tutorial&p=816#comment-62554 Oops, sorry, indeed I forgot the href attribute. No warnings anymore. But I’m using easy social share buttons plugin and is not working. No points given. Worth the try anyway 🙂

]]>