#1 WordPress forum plugin created by gVectors Team

wpForo – WordPress Forum Plugin
  • Home
  • Forum
  • Migrate to wpForo
  • Addons
  • Addons Demo
  • Documentation

Forum

Home | Forum

wpDiscuz - WordPress Comment Plugin
  • Forums
  • Members
  • Recent Posts
Forums
Main Support Forums
General Discussions
hide links for gues...
 
Share:
Share
Tweet
Share
Notifications
Clear all

Script hide links for guests

    Last Post
RSS

parsa
Posts: 4
 parsa
Topic starter
March 4, 2021 11:03 am
(@parsa)
New Member
Joined: 1 year ago

What is the simple way to hide links for guests in wpforo?

Topic Tags
hide links
1 Reply
Robert
Posts: 9090
Robert - Twitter
 Robert
Admin
March 5, 2021 5:38 am
(@robert)
Support Team
Joined: 6 years ago

Hi @parsa,

You should use this small hook code in your current active WordPress theme's functions.php file:

add_filter('wpforo_content_after', 'wpforo_hide_links_for_guests', 10);
function wpforo_hide_links_for_guests( $content ){
if( WPF()->current_user_groupid === 4 ){
$content = preg_replace('|<a[^>]+href=[^>]+>[^<>]+<\/a>|im', '<a href="#" rel="nofollow">[' . wpforo_phrase('Please login to see the link', false) . ']</a>', $content);
}
return $content;
}

Here is a good article how to add such codes to the website in case you cannot add it in the functions.php file: https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/

In case you want to say thank you !)
We'd really appreciate and be thankful if you leave a good review on plugin page. This is the best way to say thank you to this project and support team.

Reply
  All forum topics
  Previous Topic
Next Topic  
Topic Tags:  hide links (2),

Forum Search

Join Us!

Download wpForo plugin
on WordPress.org

wpForo Addons

wpforo-private-messages wpforo-advanced-attachments-128x128 wpforo-embeds-128x128 wpForo User Custom Fields addon wpForo – Blog Cross Posting addon wpForo Ads Manager wpForo – WooCommerce Memberships Integration wpForo Emoticons wpForo – Tenor GIFs Integration
View all Addons »

Recent Topics

  • Suggestion How to make new user to get approve manually before creating post and profile.

    By Adhyansh21, 12 hours ago

  • Posts deleted in database still show up on front-end

    By nylex, 14 hours ago

  • Not all links are automatically added with the "nofollow" attribute

    By st7878, 17 hours ago

  • Editors assign users to groups

    By mike_netinfo, 19 hours ago

  • Set password link opens forum login page instead of set password page

    By JanJan, 19 hours ago

  • User banned for using icons?

    By JanJan, 20 hours ago

Topic Tags

  • css52
  • translation50
  • plugin conflict48
  • seo47
  • new features45
  • buddypress43
  • avatar41
  • moderation40
  • ultimate member40
  • login40
  • forum40
  • registration37
  • threaded layout35
  • cache34
  • editor33
  • menu33
  • spam32
  • shortcode32
  • forum accesses30
  • widget29
View all tags (2190)

Recent Posts

  • RE: recover deleted forum categories

    I didn't delete the categories on the forum, just did s...

    By Asmadi1, 4 hours ago

  • recover deleted forum categories

    hi I need help, I accidentally deleted categories and f...

    By Asmadi1, 5 hours ago

  • RE: Not all links are automatically added with the "nofollow" attribute

    I have no idea, i guess not.

    By dimalifragis, 6 hours ago

  • RE: How to make new user to get approve manually before creating post and profile.

    Thanks again

    By Adhyansh21, 9 hours ago

  • RE: Posts deleted in database still show up on front-end

    Ok then, wait until someone from wpForo support will he...

    By dimalifragis, 12 hours ago

  • RE: Set password link opens forum login page instead of set password page

    Hi @janjan, Go to Dashboard > Forums > Settings...

    By Chris, 17 hours ago

  • RE: Editors assign users to groups

    Hi @mike_netinfo, Only administrators can change user...

    By Chris, 17 hours ago

Share:
Share
Tweet
Share
  Forum Statistics
21 Forums
9,933 Topics
50.2 K Posts
5 Online
48 K Members

Latest Post: recover deleted forum categories Our newest member: w88pokerdownload43 Recent Posts Unread Posts Tags

Forum Icons: Forum contains no unread posts Forum contains unread posts

Topic Icons: Not Replied Replied Active Hot Sticky Unapproved Solved Private Closed

Powered by wpForo | Copyright © 2016-2022 gVectors Team
Copyright Registration Service - Click here for more information or to register work
wpForo is Registered with the IP Rights Office
Copyright Registration Service

Ref: 4477265538
  • Home
  • Forum
  • Migrate to wpForo
  • Addons
  • Addons Demo
  • Documentation