Limited Support
Our team is currently on holiday, so support will be limited during this period. Response times may be slower than usual, and some inquiries may be delayed.
We appreciate your patience and understanding, and we’ll resume our usual support by the end of August.
Mar 04, 2021 11:03 am
What is the simple way to hide links for guests in wpforo?
1 Reply
Mar 05, 2021 5:38 am
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/