WordPress.org

Ready to get started?Download WordPress

Forums

User Specific Content
[resolved] logged in and logged out shortcode (2 posts)

  1. skopy
    Member
    Posted 1 year ago #

    What is the shortcode for logged in and logged out?

    you have shortcode in faq for user roles but dont have simple logged in, logged out shortcode...

    http://wordpress.org/extend/plugins/user-specific-content/

  2. Bainternet
    Member
    Plugin Author

    Posted 1 year ago #

    There is none but here is a quick one for you:

    add_shortcode('USER','show_user_content');
    add_shortcode('GUEST','show_guest_content');
    
    function show_user_content($atts,$content = null){
    	if (!is_user_logged_in()){
    		return "this is for looged in users only";
    	}
    	return $content;
    }
    
    function show_guest_content($atts,$content){
    	if (!is_user_logged_in()){
    		return $content;
    	}
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags