Clear all

New Feature [Closed] Widget for unregistered users

2 Posts
2 Users
0 Reactions
Posts: 111
Topic starter
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
Posts: 3650
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]