/**
  * Should the group creation step be included?
  *
  * @since 1.2
  */
 public function enable_create_step()
 {
     $options = invite_anyone_options();
     return !empty($options['group_invites_enable_create_step']) && $options['group_invites_enable_create_step'] === 'yes';
 }
示例#2
0
function invite_anyone_bypass_registration_lock()
{
    global $bp;
    if (!invite_anyone_is_accept_invitation_page()) {
        return;
    }
    if (!isset($_GET['email']) || !($email = urldecode($_GET['email']))) {
        return;
    }
    $options = invite_anyone_options();
    if (empty($options['bypass_registration_lock']) || $options['bypass_registration_lock'] != 'yes') {
        return;
    }
    // Check to make sure that it's actually a valid email
    $ia_obj = invite_anyone_get_invitations_by_invited_email($email);
    if (!$ia_obj->have_posts()) {
        bp_core_add_message(__("We couldn't find any invitations associated with this email address.", 'invite-anyone'), 'error');
        return;
    }
    // To support old versions of BP, we have to force the overloaded
    // site_options property in some cases
    if (is_multisite()) {
        $site_options = $bp->site_options;
        if (!empty($bp->site_options['registration']) && $bp->site_options['registration'] == 'blog') {
            $site_options['registration'] = 'all';
        } else {
            if (!empty($bp->site_options['registration']) && $bp->site_options['registration'] == 'none') {
                $site_options['registration'] = 'user';
            }
        }
        $bp->site_options = $site_options;
        add_filter('bp_get_signup_allowed', '__return_true');
    } else {
        add_filter('option_users_can_register', create_function(false, 'return true;'));
    }
}
示例#3
0
function invite_anyone_bypass_registration_lock()
{
    global $bp;
    if ($bp->current_component != BP_REGISTER_SLUG || $bp->current_action != 'accept-invitation') {
        return;
    }
    if (!isset($bp->action_variables[0]) || !($email = urldecode($bp->action_variables[0]))) {
        return;
    }
    $options = invite_anyone_options();
    if (empty($options['bypass_registration_lock']) || $options['bypass_registration_lock'] != 'yes') {
        return;
    }
    // Check to make sure that it's actually a valid email
    $ia_obj = invite_anyone_get_invitations_by_invited_email($email);
    if (!$ia_obj->have_posts()) {
        bp_core_add_message(__("We couldn't find any invitations associated with this email address.", 'bp-invite-anyone'), 'error');
        return;
    }
    // This is a royal hack until there is a filter on bp_get_signup_allowed()
    if (is_multisite()) {
        if (!empty($bp->site_options['registration']) && $bp->site_options['registration'] == 'blog') {
            $bp->site_options['registration'] = 'all';
        } else {
            if (!empty($bp->site_options['registration']) && $bp->site_options['registration'] == 'none') {
                $bp->site_options['registration'] = 'user';
            }
        }
    } else {
        add_filter('option_users_can_register', create_function(false, 'return true;'));
    }
}
示例#4
0
function invite_anyone_settings_cs_content()
{
    $options = invite_anyone_options();
    $domain_key = !empty($options['cloudsponge_key']) ? $options['cloudsponge_key'] : '';
    ?>
	<div class="cs">
		<a href="http://www.cloudsponge.com/?utm_source=invite-anyone&utm_medium=partner&utm_campaign=integrator"><img class="cs-logo" src="<?php 
    echo plugins_url('invite-anyone/images/cloudsponge_logo.png');
    ?>
" /></a>

		<div class="cs-explain">
			<p><?php 
    _e('<a href="http://www.cloudsponge.com/?utm_source=invite-anyone&utm_medium=partner&utm_campaign=integrator">CloudSponge</a> is a cool service that gives your users easy and secure access to their address books (Facebook, LinkedIn, Gmail, Yahoo, and a number of other online and desktop email clients), so that they can more easily invite friends to your site. It#8217;s a great way to increase engagement on your site, by making it easier for them to invite new members. In order to enable CloudSponge support in Invite Anyone and BuddyPress, you\'ll need to <a href="http://www.cloudsponge.com/signup?utm_source=invite-anyone&utm_medium=partner&utm_campaign=integrator">register for a CloudSponge account</a>.', 'invite-anyone');
    ?>
</p>

			<label for="invite_anyone[cloudsponge_enabled]"><input type="checkbox" name="invite_anyone[cloudsponge_enabled]" id="cloudsponge-enabled" <?php 
    checked($options['cloudsponge_enabled'], 'on');
    ?>
/> <strong><?php 
    _e('Enable CloudSponge?', 'invite-anyone');
    ?>
</strong></label>
		</div>

		<div class="cs-settings">
			<label for="invite_anyone[cloudsponge_key]"><?php 
    _e('CloudSponge Domain Key', 'invite-anyone');
    ?>
</label> <input type="text" id="cloudsponge-key" name="invite_anyone[cloudsponge_key]" value="<?php 
    echo esc_html($domain_key);
    ?>
" /> <span class="description"><?php 
    _e('CloudSponge integration will not work without a valid domain key.', 'invite-anyone');
    ?>
</span>

			<p class="description"><?php 
    _e('When you use CloudSponge with Invite Anyone, part of your CloudSponge monthly payment goes to the author of Invite Anyone. This is a great way to support future development of the plugin. Thanks for your support!', 'invite-anyone');
    ?>
</p>
		</div>
	</div>
<?php 
}
function invite_anyone_settings_cs_content()
{
    $options = invite_anyone_options();
    $domain_key = !empty($options['cloudsponge_key']) ? $options['cloudsponge_key'] : '';
    $account_key = !empty($options['cloudsponge_account_key']) ? $options['cloudsponge_account_key'] : '';
    // Trying to give to CloudSponge user email and name to pre populate signup
    // form and reduce friction
    $cloudsponge_params = '?utm_source=invite-anyone&utm_medium=partner&utm_campaign=integrator';
    $cloudsponge_additional_params = '&email=' . urlencode(wp_get_current_user()->user_email);
    $display_name = bp_core_get_user_displayname(bp_loggedin_user_id());
    if ($display_name) {
        $cloudsponge_additional_params .= '&name=' . urlencode($display_name);
    }
    // A callback URL to create a friendly button to get back to WP
    $protocol = is_ssl() ? 'https://' : 'http://';
    $cloudsponge_additional_params .= '&callback=' . urlencode($protocol . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
    // Landing to home
    $cloudsponge_link = 'http://www.cloudsponge.com' . $cloudsponge_params;
    // Landing on Signup Form
    $cloudsponge_signup_link = 'http://cloudsponge.com/signup/invite-anyone' . $cloudsponge_params . $cloudsponge_additional_params;
    // Include CloudSponge Snippet, so user can launch it clicking
    // on `Test` button
    wp_register_script('ia_cloudsponge', plugins_url() . '/invite-anyone/by-email/cloudsponge-js.js', array(), false, true);
    $strings['account_key'] = $account_key;
    $strings['domain_key'] = false;
    wp_localize_script('ia_cloudsponge', 'ia_cloudsponge', $strings);
    wp_enqueue_script('ia_cloudsponge');
    ?>
	<div class="cs">
		<img class="cs-logo" src="<?php 
    echo plugins_url('invite-anyone/images/cloudsponge_logo.png');
    ?>
" />
		<div class="cs-explain">
			<p><?php 
    _e('CloudSponge is a cool service that gives your users easy and secure access to their address books (LinkedIn, Gmail, Yahoo, and a number of other online and desktop email clients), so that they can more easily invite friends to your site. It\'s a great way to increase engagement on your site, by making it easier for them to invite new members. In order to enable CloudSponge support in Invite Anyone and BuddyPress, you\'ll need to <a href="' . $cloudsponge_signup_link . '">register for a CloudSponge account</a>.', 'invite-anyone');
    ?>
</p>
			<label for="invite_anyone[cloudsponge_enabled]"><input type="checkbox" name="invite_anyone[cloudsponge_enabled]" id="cloudsponge-enabled" <?php 
    checked($options['cloudsponge_enabled'], 'on') || checked(isset($_GET['cloudsponge-key']), true);
    ?>
/> <strong><?php 
    _e('Enable CloudSponge?', 'invite-anyone');
    ?>
</strong></label>
		</div>

		<div class="cs-settings">

			<?php 
    if ($domain_key) {
        ?>
					<label for="invite_anyone[cloudsponge_key]"><?php 
        _e('CloudSponge Domain Key', 'invite-anyone');
        ?>
</label> <input type="text" id="cloudsponge-key" name="invite_anyone[cloudsponge_key]" value="<?php 
        echo esc_html($domain_key);
        ?>
" /> <span class="description"><?php 
        _e('CloudSponge integration will not work without a valid CloudSponge Domain key.', 'invite-anyone');
        ?>
</span>
			<?php 
    } else {
        ?>
					<label for="invite_anyone[cloudsponge_key]"><?php 
        _e('CloudSponge Key', 'invite-anyone');
        ?>
</label>
					<input type="text" id="cloudsponge-key" name="invite_anyone[cloudsponge_account_key]" value="<?php 
        if ($account_key) {
            echo esc_html($account_key);
        } else {
            echo esc_html($_GET['cloudsponge-key']);
        }
        ?>
" />
					<?php 
        if ($account_key) {
            ?>
						<button id="test-cloudsponge-button" name="test-cloudsponge-button" type="button" onclick="csLaunch();"><?php 
            _e('Test', 'invite-anyone');
            ?>
</button>
					<?php 
        }
        ?>

					<?php 
        if (!isset($_GET['cloudsponge-key']) && !$account_key) {
            ?>
						<span class="description"><?php 
            _e('CloudSponge integration will not work without a valid CloudSponge Key.', 'invite-anyone');
            ?>
</span>
					<?php 
        } elseif (isset($_GET['cloudsponge-key']) && !$account_key) {
            ?>
						<span class="description cs-warning"><?php 
            _e('Please, click on <strong>Save Changes</strong> to save the key!', 'invite-anyone');
            ?>
</span>
					<?php 
        } else {
            ?>
						<span class="description"><?php 
            _e('Click in the <strong>test</strong> button to test your integration.', 'invite-anyone');
            ?>
</span>
					<?php 
        }
        ?>
			<?php 
    }
    ?>

			<p class="description"><?php 
    _e('When you use CloudSponge with Invite Anyone, part of your CloudSponge monthly payment goes to the author of Invite Anyone. This is a great way to support future development of the plugin. Thanks for your support!', 'invite-anyone');
    ?>
</p>
		</div>
	</div>
<?php 
}