PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.6.20
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.6.20
1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 1.7.0.9 1.8.0 All 210 releases
charitable / includes / shortcodes / class-charitable-profile-shortcode.php

class-charitable-profile-shortcode.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.6.20, at includes/shortcodes/class-charitable-profile-shortcode.php

66 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Profile shortcode class.
4 *
5 * @package Charitable/Shortcodes/Profile
6 * @author Eric Daams
7 * @copyright Copyright (c) 2019, Studio 164a
8 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 * @since 1.0.0
10 * @version 1.5.7
11 */
12
13 // Exit if accessed directly.
14 if ( ! defined( 'ABSPATH' ) ) { exit; }
15
16 if ( ! class_exists( 'Charitable_Profile_Shortcode' ) ) :
17
18 /**
19 * Charitable_Profile_Shortcode class.
20 *
21 * @since 1.0.0
22 */
23 class Charitable_Profile_Shortcode {
24
25 /**
26 * The callback method for the campaigns shortcode.
27 *
28 * This receives the user-defined attributes and passes the logic off to the class.
29 *
30 * @since 1.0.0
31 *
32 * @param array $atts User-defined shortcode attributes.
33 * @return string
34 */
35 public static function display( $atts ) {
36 $defaults = array(
37 'hide_login' => false,
38 );
39
40 $args = shortcode_atts( $defaults, $atts, 'charitable_profile' );
41
42 ob_start();
43
44 /* If the user is logged out, show the login form. */
45 if ( ! is_user_logged_in() ) {
46
47 if ( false == $args['hide_login'] ) {
48 $args['redirect'] = charitable_get_current_url();
49
50 echo Charitable_Login_Shortcode::display( $args );
51 }
52
53 return ob_get_clean();
54 }
55
56 $args['form'] = new Charitable_Profile_Form( $args );
57
58 /* If the user is logged in, show the profile template. */
59 charitable_template( 'shortcodes/profile.php', $args );
60
61 return apply_filters( 'charitable_profile_shortcode', ob_get_clean() );
62 }
63 }
64
65 endif;
66