Post Pay Counter

The best way to pay authors on WordPress

  • Features
    • PRO version
  • Cart
    • Addons
  • Documentation
  • Support

Need Help in Referral Visits

by

› Forums › Referral Visits › Need Help in Referral Visits

We are based in Europe with a GMT+1/GMT+2 time zone - support replies may be delayed due to time zone differences with your country.

  • This topic has 13 replies, 2 voices, and was last updated 5 years, 10 months ago by Stefano.
Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • July 23, 2019 at 1:32 am #66085
    Raj Sundesha
    Guest

    hey can you help me out I am stuck in this
    Can you tell me how I can enable this only for a particular user role only like- subscriber-only something like that
    Refer link only visible for a particular role as I created one new user role as subscribers and an only subscriber can use this referral link feature no other user role able to use this except subscribers role which we have given permission to use refer link feature for earning through it.

    July 23, 2019 at 9:37 am #66094
    Stefano
    Keymaster

    Hi Raj,
    the following edits will have the effect of displaying the referral box only to the subscriber role. To change the role, just replace the word subscriber with whatever you wish in the code below ๐Ÿ™‚

    1. Open the file ppc-referral-visits/classes/display.php and replace line 194 with this:

      return apply_filters( 'ppc_ref_vis_referral_link_html', $ref_html, $author_id );

    2. Open your theme’s functions.php file and, at the bottom, add a few line breaks and add this:
      function ppc_ref_vis_referral_link_filter_user_role( $html_output, $user_id ) {
      	$user = get_userdata( $user_id );
      	if( in_array( 'subscriber', (array) $user->roles ) )
      		return $html_output;
      	else
      		return '';
      }
      add_filter( 'ppc_ref_vis_referral_link_html', 'ppc_ref_vis_referral_link_filter_user_role', 10, 2 );

    Let me know, it should have the desired effect!
    Have a nice day,
    Stefano

    July 24, 2019 at 4:40 am #66111
    Raj Sundesha
    Guest

    Hi, Nothing Happen Still Showing a link for another user role also.
    As you said I added all code

    July 24, 2019 at 10:17 am #66121
    Stefano
    Keymaster

    Hi Raj,
    I don’t really know what to say – I double tested the changes and they work for me. The best I can do is have a look with admin access at your site, most likely you did not do something all right ๐Ÿ™‚

    Have a nice day,
    Stefano

    July 24, 2019 at 10:25 am #66127
    Raj Sundesha
    Guest
    This reply has been marked as private.
    July 24, 2019 at 11:22 am #66129
    Stefano
    Keymaster

    Line numbers were slightly off in your and my files, you had replaced the wrong line ๐Ÿ™‚ Try again now.

    July 24, 2019 at 2:00 pm #66132
    Raj Sundesha
    Guest

    Which Line I have to replace can you tell me right now not Showing for any user role as I have set it for Creator

    July 24, 2019 at 7:17 pm #66134
    Stefano
    Keymaster

    This is where the user role is mentioned:
    if( in_array( 'subscriber', (array) $user->roles ) )

    July 25, 2019 at 2:29 pm #66150
    RAJ SUNDESHA
    Guest

    hi as you said I do all but still nothing seeing now I am unable to see refer link on posts and if you do it that would be great if can’t tell me what can I do I just want to refer link work for creator role only

    July 25, 2019 at 4:38 pm #66158
    Stefano
    Keymaster

    now I am unable to see refer link on posts

    Well, you do not have the creator role, I guess, so it is right that you do not see the link, right? Do creators see it?

    July 25, 2019 at 5:05 pm #66161
    Raj Sundesha
    Guest

    No i already created creator role and in code i include creator and for creator also the share link is not visible in blog post.

    July 25, 2019 at 5:10 pm #66163
    Stefano
    Keymaster

    I wrote the Creator word lowercase, just in case. Did that helped? Anyway, I don’t see any user with that role on your site, who should I check out to test?

    July 26, 2019 at 1:13 am #66180
    Raj Sundesha
    Guest
    This reply has been marked as private.
    July 26, 2019 at 3:09 pm #66187
    Stefano
    Keymaster

    The problem is that line 304 of functions.php should have the word creator all in small caps: if( in_array( 'creator', (array) $user->roles ) ). This should fix ๐Ÿ™‚

  • Author
    Posts
Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Need Help in Referral Visits’ is closed to new replies.

Your cart

Number of items in cart: 0

  • Your cart is empty.
  • Total: €0.00
  • Checkout

What are you looking for?

BEFORE POSTING

Before posting, please please please do have a look at our Documentation section. Your problem may be addressed there, allowing you to solve it without help from us :)

Copyright © 2025 ยท Centric Theme on Genesis Framework ยท WordPress ยท Log in