Notifications
Clear all

New Feature [Closed] Widget for unregistered users

2 Posts
2 Users
0 Reactions
964 Views
st7878
Posts: 111
Topic starter
(@aima-forum)
Estimable Member
Joined: 4 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.

1 Reply
Chris
Posts: 3649
(@chris)
Famed Member
Joined: 3 years ago

Hi @aima-forum,

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