Notifications
Clear all

New Feature Widget for unregistered users

2 Posts
2 Users
0 Likes
512 Views
st7878
Posts: 108
Topic starter
(@aima-forum)
Estimable Member
Joined: 3 years ago

I have created a shortcode in the function.php file that only shows content to unregistered users:

function no_logged_user_content( $atts, $content = null ) {
	if ( is_user_logged_in() && !is_null( $content ) && !is_feed() ) {
		return '';
	}
	return $content; 
}
 
add_shortcode( 'member', 'no_logged_user_content' );

Now in the text widget, I can only add content for unregistered users:

[member]Information only to unregistered[/member]

Please help to refine this code so that you can differentiate information for admins, moderators, registered, guests ... Make several shortcodes for each user group.

Forum Page URL
Topic Tags
1 Reply
Chris
Posts: 1907
Admin
(@chris)
Support Team
Joined: 1 year ago

Hi @aima-forum,

wpForo has custom development, which can make that work for you, if you are interested contact sales[at]gvectors.com

Reply
Share: