Notifications
Clear all

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.

 

New Feature [Closed] Widget for unregistered users

2 Posts
2 Users
0 Reactions
1,419 Views
st7878
Posts: 115
Topic starter
(@aima-forum)
Estimable Member
Joined: 5 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: 3611
(@chris)
Famed Member
Joined: 4 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