'', // Single capability or comma-separated multiple capabilities 'role' => '', // Single role or comma-separated multiple roles ); /* Merge the input attributes and the defaults. */ extract( shortcode_atts( $defaults, $attr ) ); /* If there's no content or if viewing a feed, return an empty string. */ if ( is_null( $content ) || is_feed() ) return ''; /* If the current user has the capability, show the content. */ if ( !empty( $capability ) ) { /* Get the capabilities. */ $caps = explode( ',', $capability ); /* Loop through each capability. */ foreach ( $caps as $cap ) { /* If the current user can perform the capability, return the content. */ if ( current_user_can( trim( $cap ) ) ) return do_shortcode( $content ); } } /* If the current user has the role, show the content. */ if ( !empty( $role ) ) { /* Get the roles. */ $roles = explode( ',', $role ); /* Loop through each of the roles. */ foreach ( $roles as $role ) { /* If the current user has the role, return the content. */ if ( current_user_can( trim( $role ) ) ) return do_shortcode( $content ); } } /* Return an empty string if we've made it to this point. */ return ''; } /** * Displays a login form. * * @since 0.1.0 * @uses wp_login_form() Displays the login form. */ function members_login_form_shortcode() { return wp_login_form( array( 'echo' => false ) ); } ?>