# charitable/1.6.2/includes/shortcodes/class-charitable-profile-shortcode.php

Charitable – Donation &amp; Fundraising Platform (Donation Forms, Recurring Donations &amp; Fundraising Campaigns), version 1.6.2. 65 lines.

- Page: https://pluginprobe.com/plugins/charitable/1.6.2/code/includes/shortcodes/class-charitable-profile-shortcode.php
- Raw: https://pluginprobe.com/plugins/charitable/1.6.2/raw/includes/shortcodes/class-charitable-profile-shortcode.php
- Modified: 2018-06-09T06:41:12+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/charitable/1.6.2/code/includes/shortcodes/class-charitable-profile-shortcode.php#L10-L20`.

```php
<?php
/**
 * Profile shortcode class.
 *
 * @package   Charitable/Shortcodes/Profile
 * @author    Eric Daams
 * @copyright Copyright (c) 2018, Studio 164a
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU Public License
 * @since     1.0.0
 * @version   1.5.7
 */

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) { exit; }

if ( ! class_exists( 'Charitable_Profile_Shortcode' ) ) :

	/**
	 * Charitable_Profile_Shortcode class.
	 *
	 * @since   1.0.0
	 */
	class Charitable_Profile_Shortcode {

		/**
		 * The callback method for the campaigns shortcode.
		 *
		 * This receives the user-defined attributes and passes the logic off to the class.
		 *
		 * @since   1.0.0
		 *
		 * @param   array $atts User-defined shortcode attributes.
		 * @return  string
		 */
		public static function display( $atts ) {
			$defaults = array(
				'hide_login' => false,
			);

			$args = shortcode_atts( $defaults, $atts, 'charitable_profile' );

			ob_start();

			/* If the user is logged out, show the login form. */
			if ( ! is_user_logged_in() ) {

				if ( false == $args['hide_login'] ) {
					$args['redirect'] = charitable_get_current_url();

					echo Charitable_Login_Shortcode::display( $args );
				}

				return ob_get_clean();
			}

			$args['form'] = new Charitable_Profile_Form( $args );

			/* If the user is logged in, show the profile template. */
			charitable_template( 'shortcodes/profile.php', $args );

			return apply_filters( 'charitable_profile_shortcode', ob_get_clean() );      
		}
	}

endif;
```
