› 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 6 years, 3 months ago by
Stefano.
-
AuthorPosts
-
July 23, 2019 at 1:32 am #66085
Raj Sundesha
Guesthey 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 #66094Stefano
KeymasterHi 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 ๐- 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 ); - 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,
StefanoJuly 24, 2019 at 4:40 am #66111Raj Sundesha
GuestHi, Nothing Happen Still Showing a link for another user role also.
As you said I added all codeJuly 24, 2019 at 10:17 am #66121Stefano
KeymasterHi 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,
StefanoJuly 24, 2019 at 10:25 am #66127Raj Sundesha
GuestThis reply has been marked as private.July 24, 2019 at 11:22 am #66129Stefano
KeymasterLine 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 #66132Raj Sundesha
GuestWhich 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 #66134Stefano
KeymasterThis is where the user role is mentioned:
if( in_array( 'subscriber', (array) $user->roles ) )July 25, 2019 at 2:29 pm #66150RAJ SUNDESHA
Guesthi 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 #66158Stefano
Keymasternow 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 #66161Raj Sundesha
GuestNo 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 #66163Stefano
KeymasterI wrote the
Creatorword 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 #66180Raj Sundesha
GuestThis reply has been marked as private.July 26, 2019 at 3:09 pm #66187Stefano
KeymasterThe problem is that line 304 of functions.php should have the word
creatorall in small caps:if( in_array( 'creator', (array) $user->roles ) ). This should fix ๐ - Open the file ppc-referral-visits/classes/display.php and replace line 194 with this:
-
AuthorPosts
- The topic ‘Need Help in Referral Visits’ is closed to new replies.