/**
         * Render the xprofile metabox for Community Profile screen.
         *
         * @since 2.0.0
         *
         * @param WP_User|null $user The WP_User object for the user being edited.
         * @param array        $args Aray of arguments for metaboxes.
         */
        public function user_admin_profile_metaboxes($user = null, $args = array())
        {
            // Bail if no user ID.
            if (empty($user->ID)) {
                return;
            }
            $r = bp_parse_args($args['args'], array('profile_group_id' => 0, 'user_id' => $user->ID), 'bp_xprofile_user_admin_profile_loop_args');
            // We really need these args.
            if (empty($r['profile_group_id']) || empty($r['user_id'])) {
                return;
            }
            // Bail if no profile fields are available.
            if (!bp_has_profile($r)) {
                return;
            }
            // Loop through profile groups & fields.
            while (bp_profile_groups()) {
                bp_the_profile_group();
                ?>

			<input type="hidden" name="field_ids[]" id="<?php 
                echo esc_attr('field_ids_' . bp_get_the_profile_group_slug());
                ?>
" value="<?php 
                echo esc_attr(bp_get_the_profile_group_field_ids());
                ?>
" />

			<?php 
                if (bp_get_the_profile_group_description()) {
                    ?>

				<p class="description"><?php 
                    bp_the_profile_group_description();
                    ?>
</p>

			<?php 
                }
                ?>

			<?php 
                while (bp_profile_fields()) {
                    bp_the_profile_field();
                    ?>

				<div<?php 
                    bp_field_css_class('bp-profile-field');
                    ?>
>

					<?php 
                    $field_type = bp_xprofile_create_field_type(bp_get_the_profile_field_type());
                    $field_type->edit_field_html(array('user_id' => $r['user_id']));
                    if (bp_get_the_profile_field_description()) {
                        ?>

						<p class="description"><?php 
                        bp_the_profile_field_description();
                        ?>
</p>

					<?php 
                    }
                    /**
                     * Fires before display of visibility form elements for profile metaboxes.
                     *
                     * @since 1.7.0
                     */
                    do_action('bp_custom_profile_edit_fields_pre_visibility');
                    $can_change_visibility = bp_current_user_can('bp_xprofile_change_field_visibility');
                    ?>

					<p class="field-visibility-settings-<?php 
                    echo $can_change_visibility ? 'toggle' : 'notoggle';
                    ?>
" id="field-visibility-settings-toggle-<?php 
                    bp_the_profile_field_id();
                    ?>
">

						<?php 
                    printf(__('This field can be seen by: %s', 'buddypress'), '<span class="current-visibility-level">' . bp_get_the_profile_field_visibility_level_label() . '</span>');
                    ?>

						<?php 
                    if ($can_change_visibility) {
                        ?>

							<a href="#" class="button visibility-toggle-link"><?php 
                        esc_html_e('Change', 'buddypress');
                        ?>
</a>

						<?php 
                    }
                    ?>
					</p>

					<?php 
                    if ($can_change_visibility) {
                        ?>

						<div class="field-visibility-settings" id="field-visibility-settings-<?php 
                        bp_the_profile_field_id();
                        ?>
">
							<fieldset>
								<legend><?php 
                        _e('Who can see this field?', 'buddypress');
                        ?>
</legend>

								<?php 
                        bp_profile_visibility_radio_buttons();
                        ?>

							</fieldset>
							<a class="button field-visibility-settings-close" href="#"><?php 
                        esc_html_e('Close', 'buddypress');
                        ?>
</a>
						</div>

					<?php 
                    }
                    ?>

					<?php 
                    /**
                     * Fires at end of custom profile field items on your xprofile screen tab.
                     *
                     * @since 1.1.0
                     */
                    do_action('bp_custom_profile_edit_fields');
                    ?>

				</div>

			<?php 
                }
                // End bp_profile_fields().
                ?>

		<?php 
            }
            // End bp_profile_groups.
        }
Exemplo n.º 2
0
	<?php if ( bp_has_profile() ) : ?>

		<?php while ( bp_profile_groups() ) : bp_the_profile_group(); ?>

			<?php if ( bp_profile_group_has_fields() ) : ?>

				<?php do_action( 'bp_before_profile_field_content' ) ?>

				<div class="bp-widget <?php bp_the_profile_group_slug() ?>">
					<?php if ( 1 != bp_get_the_profile_group_id() ) : ?>
						<h4><?php bp_the_profile_group_name() ?></h4>
					<?php endif; ?>

					<table class="profile-fields zebra">
						<?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>

							<?php if ( bp_field_has_data() ) : ?>
								<tr<?php bp_field_css_class() ?>>

									<td class="label">
										<?php bp_the_profile_field_name() ?>
									</td>

									<td class="data">
										<?php bp_the_profile_field_value() ?>
									</td>

								</tr>
							<?php endif; ?>
Exemplo n.º 3
0
    public static function form_settings_xprofile_fields($gmw_forms, $formID, $section, $option)
    {
        global $bp;
        if (!bp_is_active('xprofile')) {
            _e('Buddypress xprofile fields component is deactivated.  You will need to activate in in order to use this feature.', 'GMW');
            return;
        }
        if (function_exists('bp_has_profile')) {
            if (bp_has_profile('hide_empty_fields=0')) {
                $dateboxes = array();
                $dateboxes[0] = '';
                while (bp_profile_groups()) {
                    bp_the_profile_group();
                    while (bp_profile_fields()) {
                        bp_the_profile_field();
                        if (bp_get_the_profile_field_type() == 'datebox' || bp_get_the_profile_field_type() == 'birthdate') {
                            $dateboxes[] = bp_get_the_profile_field_id();
                        } else {
                            $field_id = bp_get_the_profile_field_id();
                            ?>
                                <input type="checkbox" name="<?php 
                            echo 'gmw_forms[' . $formID . '][' . $section . '][profile_fields][]';
                            ?>
" value="<?php 
                            echo $field_id;
                            ?>
" <?php 
                            if (isset($gmw_forms[$formID][$section]['profile_fields']) && in_array($field_id, $gmw_forms[$formID][$section]['profile_fields'])) {
                                echo ' checked=checked';
                            }
                            ?>
/>
                                <label><?php 
                            bp_the_profile_field_name();
                            ?>
</label>
                                <br />
                                <?php 
                        }
                    }
                }
                ?>

                    <label><strong style="margin:5px 0px;float:left;width:100%"><?php 
                _e('Choose the "Age Range" Field', 'GMW');
                ?>
</strong></label><br />
                    <select name="<?php 
                echo 'gmw_forms[' . $formID . '][' . $section . '][profile_fields_date]';
                ?>
">
                        <?php 
                foreach ($dateboxes as $datebox) {
                    $field = new BP_XProfile_Field($datebox);
                    $selected = $gmw_forms[$formID][$section]['profile_fields_date'] == $datebox ? 'selected="selected"' : '';
                    ?>
                            <option value="<?php 
                    echo $datebox;
                    ?>
" <?php 
                    echo $selected;
                    ?>
 ><?php 
                    echo $field->name;
                    ?>
</option>
                        <?php 
                }
                ?>
                    </select> 
                    <?php 
            }
        }
    }
Exemplo n.º 4
0
 /**
  * Returns an object with profile information
  * @return Object Profile Fields
  */
 public function get_profile()
 {
     /* Possible parameters:
      * String username: the username you want information from (required)
      */
     $this->initVars('profile');
     $oReturn = new stdClass();
     if ($this->username === false || !username_exists($this->username)) {
         return $this->error('profile', 1);
     }
     $oUser = get_user_by('login', $this->username);
     if (!bp_has_profile(array('user_id' => $oUser->data->ID))) {
         return $this->error('profile', 0);
     }
     while (bp_profile_groups(array('user_id' => $oUser->data->ID))) {
         bp_the_profile_group();
         if (bp_profile_group_has_fields()) {
             $sGroupName = bp_get_the_profile_group_name();
             while (bp_profile_fields()) {
                 bp_the_profile_field();
                 $sFieldName = bp_get_the_profile_field_name();
                 if (bp_field_has_data()) {
                     $sFieldValue = bp_get_the_profile_field_value();
                 }
                 $oReturn->groups->{$sGroupName}->{$sFieldName} = $sFieldValue;
             }
         }
     }
     return $oReturn;
 }
Exemplo n.º 5
0
 function rtmedia_api_process_bp_get_profile_request()
 {
     $this->rtmediajsonapifunction->rtmedia_api_verfiy_token();
     //Errors
     $ec_no_fields = 400001;
     $msg_no_fields = __('no profile found', 'rtmedia');
     $ec_profile_fields = 400002;
     $msg_profile_fields = __('profile fields', 'rtmedia');
     $profile_fields = array();
     $user_id = $loggedin_user_id = '';
     extract($_REQUEST);
     if (empty($user_id)) {
         $user_id = $this->user_id;
     } else {
         $loggedin_user_id = $this->user_id;
     }
     $user = get_userdata($user_id);
     if (empty($user)) {
         echo $this->rtmedia_api_response_object('TRUE', $ec_no_fields, $msg_no_fields);
         exit;
     }
     $user_data = $this->rtmediajsonapifunction->rtmedia_api_user_data_from_id($user_id, 250, 250, 'full');
     $profile_fields['id'] = $user_id;
     $profile_fields['avatar']['src'] = $user_data['avatar'];
     $profile_fields['avatar']['width'] = 250;
     $profile_fields['avatar']['height'] = 250;
     if (bp_has_profile(array('user_id' => $user_id))) {
         while (bp_profile_groups()) {
             bp_the_profile_group();
             if (bp_profile_group_has_fields()) {
                 while (bp_profile_fields()) {
                     bp_the_profile_field();
                     if (bp_field_has_data()) {
                         $profile_fields['fields'][bp_get_the_profile_field_name()] = array('value' => strip_tags(bp_get_the_profile_field_value()), 'privacy' => bp_get_the_profile_field_visibility_level());
                     }
                 }
             }
         }
     } else {
         echo $this->rtmedia_api_response_object('FALSE', $ec_no_fields, $msg_no_fields);
         exit;
     }
     //If followers plugin exists
     if (function_exists('rtmedia_api_followers')) {
         $followers = rtmedia_api_followers($user_id);
         $following = rtmedia_api_following($user_id);
         foreach ($followers as $follower) {
             $follower_data = $this->rtmediajsonapifunction->rtmedia_api_user_data_from_id($follower, 66, 66);
             $profile_fields['follower'][] = array('id' => $follower, 'name' => $follower_data['name'], 'avatar' => $follower_data['avatar']);
         }
         foreach ($following as $follow) {
             $follow_data = $this->rtmediajsonapifunction->rtmedia_api_user_data_from_id($follow, 66, 66);
             $profile_fields['following'][] = array('id' => $follow, 'name' => $follow_data['name'], 'avatar' => $follow_data['avatar']);
         }
     }
     if (!empty($_REQUEST['user_id']) && $loggedin_user_id != $user_id) {
         $args = array('leader_id' => $user_id, 'follower_id' => $loggedin_user_id);
         if (function_exists('bp_follow_is_following')) {
             $profile_fields['loggedin_user']['following'] = 'FALSE';
             if (bp_follow_is_following($args)) {
                 $profile_fields['loggedin_user']['following'] = 'TRUE';
             }
             $args = array('leader_id' => $loggedin_user_id, 'follower_id' => $user_id);
             $profile_fields['loggedin_user']['followed'] = 'FALSE';
             if (bp_follow_is_following($args)) {
                 $profile_fields['loggedin_user']['followed'] = 'TRUE';
             }
         }
     }
     echo $this->rtmedia_api_response_object('TRUE', $ec_profile_fields, $msg_profile_fields, $profile_fields);
     exit;
 }
Exemplo n.º 6
0
 function user_buddypress_form($content)
 {
     // displays badge list in user profile
     global $qa_request;
     $userid = $content['raw']['userid'];
     $handles = qa_userids_to_handles(array($userid));
     $handle = $handles[$userid];
     if (!$handle) {
         return;
     }
     global $bp;
     if (qa_opt('buddypress_enable_profile')) {
         $idx = 1;
         if (bp_has_profile(array('user_id' => $userid))) {
             while (bp_profile_groups()) {
                 bp_the_profile_group();
                 if (bp_profile_group_has_fields()) {
                     $fields[] = array('label' => '<span class="qa-bp-profile-group-title">' . bp_get_the_profile_group_name() . '</span>', 'type' => 'static', 'value' => qa_get_logged_in_userid() === $userid ? ' <a class="qa-bp-profile-group-edit" href="' . bp_loggedin_user_domain() . $bp->profile->slug . '/edit/group/' . $idx++ . '">' . qa_lang_html('question/edit_button') . '</a>' : '');
                     while (bp_profile_fields()) {
                         bp_the_profile_field();
                         if (bp_field_has_data()) {
                             $fields[] = array('label' => bp_get_the_profile_field_name(), 'type' => 'static', 'value' => preg_replace('|</*p>|', '', bp_get_the_profile_field_value()));
                         }
                     }
                 }
             }
         }
         $ok = null;
         $tags = null;
         $buttons = array();
         $title = '<a href="' . bp_core_get_user_domain($userid) . $bp->profile->slug . '/">' . qa_opt('buddypress_integration_title') . '</a>';
         $content = array_merge(array('form-buddypress-list' => array('ok' => $ok && !isset($error) ? $ok : null, 'style' => 'wide', 'tags' => $tags, 'title' => $title, 'fields' => $fields, 'buttons' => $buttons)), $content);
     }
     if (qa_opt('buddypress_integration_priv_message') && qa_get_logged_in_userid() && $userid != qa_get_logged_in_userid()) {
         $content = array_merge(array('form-buddypress-message' => array('fields' => array('field' => array('label' => '<a href="' . wp_nonce_url($bp->loggedin_user->domain . $bp->messages->slug . '/compose/?r=' . $handle) . '">' . qa_lang('misc/private_message_title') . '</a>', 'type' => 'static')), 'style' => 'wide')), $content);
     }
     return $content;
 }
Exemplo n.º 7
0
function jfb_output_premium_panel_tease()
{
    global $jfb_homepage;
    global $opt_jfbp_notifyusers, $opt_jfbp_notifyusers_subject, $opt_jfbp_notifyusers_content, $opt_jfbp_commentfrmlogin, $opt_jfbp_wploginfrmlogin, $opt_jfbp_registrationfrmlogin, $opt_jfbp_cache_avatars, $opt_jfbp_cache_avatars_fullsize, $opt_jfbp_cache_avatar_dir, $opt_jfbp_cachedir_changetoblog;
    global $opt_jfbp_buttonstyle, $opt_jfbp_buttonsize, $opt_jfbp_buttontext, $opt_jfbp_buttonimg, $opt_jfbp_requirerealmail;
    global $opt_jfbp_redirect_new, $opt_jfbp_redirect_new_custom, $opt_jfbp_redirect_existing, $opt_jfbp_redirect_existing_custom, $opt_jfbp_redirect_logout, $opt_jfbp_redirect_logout_custom;
    global $opt_jfbp_restrict_reg, $opt_jfbp_restrict_reg_url, $opt_jfbp_restrict_reg_uid, $opt_jfbp_restrict_reg_pid, $opt_jfbp_restrict_reg_gid;
    global $opt_jfbp_show_spinner, $opt_jfbp_allow_disassociate, $opt_jfbp_autoregistered_role, $jfb_data_url;
    global $opt_jfbp_wordbooker_integrate, $opt_jfbp_signupfrmlogin, $opt_jfbp_localize_facebook;
    global $opt_jfbp_xprofile_map, $opt_jfbp_xprofile_mappings, $jfb_xprofile_field_prefix;
    global $opt_jfbp_bpstream_login, $opt_jfbp_bpstream_logincontent, $opt_jfbp_bpstream_register, $opt_jfbp_bpstream_registercontent;
    global $opt_jfbp_latestversion;
    function disableatt()
    {
        echo defined('JFB_PREMIUM') ? "" : "disabled='disabled'";
    }
    ?>
    <!--Show the Premium version number along with a link to immediately check for updates-->
    <form name="formPremUpdateCheck" method="post" action="">
        <h3>Premium Options <?php 
    echo defined('JFB_PREMIUM_VER') ? "<small>(<a href=\"javascript:document.formPremUpdateCheck.submit();\">Version " . JFB_PREMIUM_VER . "</a>)</small>" : "";
    ?>
</h3>
        <input type="hidden" name="<?php 
    echo $opt_jfbp_latestversion;
    ?>
" value="1" />
    </form>
    
    <?php 
    if (!defined('JFB_PREMIUM')) {
        echo "<div class=\"jfb-admin_warning\"><i><b>The following options are available to Premium users only.</b><br />For information about the WP-FB-AutoConnect Premium Add-On, including purchasing instructions, please visit the plugin homepage <b><a href=\"{$jfb_homepage}#premium\">here</a></b></i>.</div>";
    }
    ?>
    
    <form name="formPremOptions" method="post" action="">
    
        <b>MultiSite Support:</b><br/>
        <input disabled='disabled' type="checkbox" name="musupport" value="1" <?php 
    echo defined('JFB_PREMIUM') && function_exists('is_multisite') && is_multisite() ? "checked='checked'" : "";
    ?>
 >
        Automatically enabled when a MultiSite install is detected
        <dfn title="The free plugin is not aware of users registered on other sites in your WPMU installation, which can result in problems i.e. if someone tries to register on more than one site.  The Premium version will actively detect and handle existing users across all your sites.">(Mouseover for more info)</dfn><br /><br />

        <b>Button Style:</b><br />
        <?php 
    add_option($opt_jfbp_buttontext, "Login with Facebook");
    add_option($opt_jfbp_buttonsize, "2");
    $btnDefault = $jfb_data_url . "/assets/btn01.png";
    add_option($opt_jfbp_buttonimg, $btnDefault);
    $btnPreview = get_option($opt_jfbp_buttonimg);
    if (!$btnPreview) {
        $btnPreview = $btnDefault;
    }
    ?>

        <input <?php 
    disableatt();
    ?>
 type="radio" style="float:left;" name="<?php 
    echo $opt_jfbp_buttonstyle;
    ?>
" value="0" <?php 
    echo get_option($opt_jfbp_buttonstyle) == 0 ? "checked='checked'" : "";
    ?>
>
        <div class="jfb-greybox" style="float:left;">
            <b>Original (xfbml):</b><br/>
            Text: <input <?php 
    disableatt();
    ?>
 type="text" size="30" name="<?php 
    echo $opt_jfbp_buttontext;
    ?>
" value="<?php 
    echo get_option($opt_jfbp_buttontext);
    ?>
" /><br />
            Style: 
            <input <?php 
    disableatt();
    ?>
 type="radio" name="<?php 
    echo $opt_jfbp_buttonsize;
    ?>
" value="2" <?php 
    echo get_option($opt_jfbp_buttonsize) == 2 ? "checked='checked'" : "";
    ?>
>Small
            <input <?php 
    disableatt();
    ?>
 type="radio" name="<?php 
    echo $opt_jfbp_buttonsize;
    ?>
" value="3" <?php 
    echo get_option($opt_jfbp_buttonsize) == 3 ? "checked='checked'" : "";
    ?>
>Medium
            <input <?php 
    disableatt();
    ?>
 type="radio" name="<?php 
    echo $opt_jfbp_buttonsize;
    ?>
" value="4" <?php 
    echo get_option($opt_jfbp_buttonsize) == 4 ? "checked='checked'" : "";
    ?>
>Large
            <input <?php 
    disableatt();
    ?>
 type="radio" name="<?php 
    echo $opt_jfbp_buttonsize;
    ?>
" value="5" <?php 
    echo get_option($opt_jfbp_buttonsize) == 5 ? "checked='checked'" : "";
    ?>
>X-Large<br />
        </div><br clear="all"/>
        <input <?php 
    disableatt();
    ?>
 type="radio" style="float:left;" name="<?php 
    echo $opt_jfbp_buttonstyle;
    ?>
" value="1" <?php 
    echo get_option($opt_jfbp_buttonstyle) == 1 ? "checked='checked'" : "";
    ?>
>
        <div class="jfb-greybox" style="float:left;">
            <b>Image (styleable):</b><br/>
            URL: <input <?php 
    disableatt();
    ?>
 type="text" size="80" name="<?php 
    echo $opt_jfbp_buttonimg;
    ?>
" value="<?php 
    echo get_option($opt_jfbp_buttonimg);
    ?>
" /><br/>
            Preview: <img style="vertical-align:middle;margin-top:5px;" src="<?php 
    echo $btnPreview;
    ?>
" alt="(Login Button)" />
        </div><br clear="all"/><br/>
        
        <b>Additional Buttons:</b><br />
        <input <?php 
    disableatt();
    ?>
 type="checkbox" name="<?php 
    echo $opt_jfbp_commentfrmlogin;
    ?>
" value="1" <?php 
    echo get_option($opt_jfbp_commentfrmlogin) ? 'checked="checked"' : '';
    ?>
 /> Add a Facebook Login button below the comment form<br />
        <input <?php 
    disableatt();
    ?>
 type="checkbox" name="<?php 
    echo $opt_jfbp_wploginfrmlogin;
    ?>
" value="1" <?php 
    echo get_option($opt_jfbp_wploginfrmlogin) ? 'checked="checked"' : '';
    ?>
 /> Add a Facebook Login button to the standard Login page (wp-login.php)<br />
        <input <?php 
    disableatt();
    ?>
 type="checkbox" name="<?php 
    echo $opt_jfbp_registrationfrmlogin;
    ?>
" value="1" <?php 
    echo get_option($opt_jfbp_registrationfrmlogin) ? 'checked="checked"' : '';
    ?>
 /> Add a Facebook Login button to the Registration page (wp-login.php)<br />
        <input <?php 
    disableatt();
    ?>
 type="checkbox" name="<?php 
    echo $opt_jfbp_signupfrmlogin;
    ?>
" value="1" <?php 
    echo get_option($opt_jfbp_signupfrmlogin) ? 'checked="checked"' : '';
    ?>
 /> Add a Facebook Login button to the Signup page (wp-signup.php) (WPMU Only)<br /><br />
                        
        <!-- Facebook's OAuth 2.0 migration BROKE my ability to localize the XFBML-generated dialog.  I've reported a bug, and will do my best to fix it as soon as possible.
         <b>Facebook Localization:</b><br />
        <?php 
    add_option($opt_jfbp_localize_facebook, 1);
    ?>
        <input <?php 
    disableatt();
    ?>
 type="checkbox" name="<?php 
    echo $opt_jfbp_localize_facebook;
    ?>
" value="1" <?php 
    echo get_option($opt_jfbp_localize_facebook) ? "checked='checked'" : "";
    ?>
 >
        Translate Facebook prompts to the same locale as your Wordpress blog (Detected locale: <i><?php 
    echo defined('WPLANG') && WPLANG != "" ? WPLANG : "en_US";
    ?>
</i>)
        <dfn title="The Wordpress locale is specified in wp-config.php, where valid language codes are of the form 'en_US', 'ja_JP', 'es_LA', etc.  Please see http://codex.wordpress.org/Installing_WordPress_in_Your_Language for more information on localizing Wordpress, and http://developers.facebook.com/docs/internationalization/ for a list of locales supported by Facebook.">(Mouseover for more info)</dfn><br /><br />
         -->
                        
        <b>Avatar Caching:</b><br />  
        <?php 
    add_option($opt_jfbp_cache_avatars_fullsize, get_option($opt_jfbp_cache_avatars));
    ?>
       
        <input <?php 
    disableatt();
    ?>
 type="checkbox" name="<?php 
    echo $opt_jfbp_cache_avatars;
    ?>
" value="1" <?php 
    echo get_option($opt_jfbp_cache_avatars) ? 'checked="checked"' : '';
    ?>
 />
        Cache Facebook avatars locally (thumbnail) <dfn title="This will make a local copy of Facebook avatars, so they'll always load reliably, even if Facebook's servers go offline or if a user deletes their photo from Facebook. They will be fetched and updated whenever a user logs in.">(Mouseover for more info)</dfn><br />
        <input <?php 
    disableatt();
    ?>
 type="checkbox" name="<?php 
    echo $opt_jfbp_cache_avatars_fullsize;
    ?>
" value="1" <?php 
    echo get_option($opt_jfbp_cache_avatars_fullsize) ? 'checked="checked"' : '';
    ?>
 />
        Cache Facebook avatars locally (fullsize) <dfn title="Because most themes only utilize thumbnail-sized avatars, caching full-sized images is often unnecessary.  If you're not actually using full-sized avatars I recommend disabling this option, as doing so will speed up logins and save space on your server (there's a small per-login performance cost to copying the files locally).">(Mouseover for more info)</dfn><br />
        
        <?php 
    add_option($opt_jfbp_cache_avatar_dir, 'facebook-avatars');
    ?>
        Cache dir:
            <?php 
    //If this is multisite, we'll allow the use of the uploaddir of *any* blog in the network (not just the current one).
    //This way, all the blogs can share the same avatar cache if desired.
    if (function_exists('is_multisite') && is_multisite()) {
        global $wpdb;
        $blogs = $wpdb->get_results($wpdb->prepare("SELECT blog_id, domain, path FROM {$wpdb->blogs} WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered ASC", $wpdb->siteid), ARRAY_A);
        echo "<select name='" . $opt_jfbp_cachedir_changetoblog . "'>";
        foreach ($blogs as $blog) {
            switch_to_blog($blog['blog_id']);
            $path = wp_upload_dir();
            restore_current_blog();
            $selectedBlogID = get_option($opt_jfbp_cachedir_changetoblog);
            if ($selectedBlogID == 0) {
                $selectedBlogID = get_current_blog_id();
            }
            $selected = $selectedBlogID == $blog['blog_id'] ? " selected='true' " : '';
            echo '<option ' . $selected . ' value="' . $blog['blog_id'] . '">' . $path['basedir'] . '</option>';
        }
        echo "</select>\\";
    } else {
        $path = wp_upload_dir();
        update_option($opt_jfbp_cachedir_changetoblog, 0);
        ?>
<span style="background-color:#FFFFFF; color:#aaaaaa; padding:2px 0;"><i><?php 
        echo $path['basedir'];
        ?>
/</i></span><?php 
    }
    ?>
        <input <?php 
    disableatt();
    ?>
 type="text" size="15" name="<?php 
    echo $opt_jfbp_cache_avatar_dir;
    ?>
" value="<?php 
    echo get_option($opt_jfbp_cache_avatar_dir);
    ?>
" />
        <dfn title="Changing the cache directory will not move existing avatars or update existing users; it only applies to subsequent logins.  It's therefore recommended that you choose a cache directory once, then leave it be.">(Mouseover for more info)</dfn><br /><br />

        <b>Double Logins:</b><br />
        <input disabled='disabled' type="checkbox" name="doublelogin" value="1" <?php 
    echo defined('JFB_PREMIUM') ? "checked='checked'" : "";
    ?>
 />
        Automatically handle double logins 
        <dfn title="If a visitor opens two browser windows, logs into one, then logs into the other, the security nonce check will fail.  This is because in the second window, the current user no longer matches the user for which the nonce was generated.  The free version of the plugin reports this to the visitor, giving them a link to their desired redirect page.  The premium version will transparently handle such double-logins: to visitors, it'll look like the page has just been refreshed and they're now logged in.  For more information on nonces, please visit http://codex.wordpress.org/WordPress_Nonces.">(Mouseover for more info)</dfn><br /><br />

        <b>E-Mail Permissions:</b><br />
        <input <?php 
    disableatt();
    ?>
 type="checkbox" name="<?php 
    echo $opt_jfbp_requirerealmail;
    ?>
" value="1" <?php 
    echo get_option($opt_jfbp_requirerealmail) ? 'checked="checked"' : '';
    ?>
 /> Enforce access to user's real (unproxied) email
        <dfn title="The basic option to request user emails will prompt your visitors, but they can still hide their true addresses by using a Facebook proxy (click 'change' in the permissions dialog, and select '*****@*****.**').  This option performs a secondary check to enforce that they allow access to their REAL e-mail.  Note that the check requires several extra queries to Facebook's servers, so it could result in a slightly longer delay before the login initiates.">(Mouseover for more info)</dfn><br /><br />
        
        <b>Wordbooker Avatar Integration:</b><br />
        <input <?php 
    disableatt();
    ?>
 type="checkbox" name="<?php 
    echo $opt_jfbp_wordbooker_integrate;
    ?>
" value="1" <?php 
    echo get_option($opt_jfbp_wordbooker_integrate) ? 'checked="checked"' : '';
    ?>
 /> Use Facebook avatars for <a href="http://wordpress.org/extend/plugins/wordbooker/">Wordbooker</a>-imported comments
        <dfn title="The Wordbooker plugin allows you to push blog posts to your Facebook wall, and also to import comments on these posts back to your blog.  This option will display real Facebook avatars for imported comments, provided the commentor logs into your site at least once.">(Mouseover for more info)</dfn><br /><br />
        
        <b>Disassociation:</b><br />
        <input <?php 
    disableatt();
    ?>
 type="checkbox" name="<?php 
    echo $opt_jfbp_allow_disassociate;
    ?>
" value="1" <?php 
    echo get_option($opt_jfbp_allow_disassociate) ? 'checked="checked"' : '';
    ?>
 /> Allow users to disassociate their Wordpress accounts from Facebook
        <dfn title="This will add a button to each connected user's Wordpress profile page, allowing them to disassociate their blog account from their Facebook profile.  User accounts which are not connected to Facebook will display 'Not Connected' in place of a button.">(Mouseover for more info)</dfn><br />
        <input disabled='disabled' type="checkbox" name="admindisassociate" value="1" <?php 
    echo defined('JFB_PREMIUM') ? "checked='checked'" : "";
    ?>
 /> Allow administrators to disassociate Wordpress user accounts from Facebook
        <dfn title="This option is always enabled for administrators.">(Mouseover for more info)</dfn><br /><br />

        <b>Autoregistered User Role:</b><br />
        <?php 
    add_option($opt_jfbp_autoregistered_role, get_option('default_role'));
    $currSelection = get_option($opt_jfbp_autoregistered_role);
    $editable_roles = get_editable_roles();
    if (empty($editable_roles[$currSelection])) {
        $currSelection = get_option('default_role');
    }
    ?>
        Users who are autoregistered with Facebook will be created with the role: 
        <select <?php 
    disableatt();
    ?>
 name="<?php 
    echo $opt_jfbp_autoregistered_role;
    ?>
" id="<?php 
    echo $opt_jfbp_autoregistered_role;
    ?>
">
            <?php 
    wp_dropdown_roles($currSelection);
    ?>
        </select><br /><br />

        <b>Widget Appearance:</b><br />
        Please use the <a href="<?php 
    echo admin_url('widgets.php');
    ?>
" target="widgets">WP-FB AutoConnect <b><i>Premium</i></b> Widget</a> if you'd like to:<br />
        &bull; Customize the Widget's text <dfn title="You can customize the text of: User, Pass, Login, Remember, Forgot, Logout, Edit Profile, Welcome.">(Mouseover for more info)</dfn><br />
        &bull; Show/Hide the User/Pass fields (leaving Facebook as the only way to login)<br />
        &bull; Show/Hide the user's avatar (when logged in)<br />
        &bull; Show/Hide a "Remember" tickbox<br />
        &bull; Show/Hide the "Register" link (only applicable if registration is enabled on the site/network)<br/>
        &bull; Show/Hide the "Edit Profile" link<br/>
        &bull; Point the "Edit Profile" link to the BP profile, rather than WP (if available)<br/>
        &bull; Allow the user to simultaneously logout of your site <i>and</i> Facebook<br /><br />
            
        <b>AJAX Spinner:</b><br />
        <input <?php 
    disableatt();
    ?>
 type="radio" name="<?php 
    echo $opt_jfbp_show_spinner;
    ?>
" value="0" <?php 
    echo get_option($opt_jfbp_show_spinner) == 0 ? "checked='checked'" : "";
    ?>
 >Don't show an AJAX spinner<br />
        <input <?php 
    disableatt();
    ?>
 type="radio" name="<?php 
    echo $opt_jfbp_show_spinner;
    ?>
" value="1" <?php 
    echo get_option($opt_jfbp_show_spinner) == 1 ? "checked='checked'" : "";
    ?>
 >Show a white AJAX spinner to indicate the login process has started (<img src=" <?php 
    echo $jfb_data_url;
    ?>
/assets/spinner_white.gif" alt="spinner" />)<br />
        <input <?php 
    disableatt();
    ?>
 type="radio" name="<?php 
    echo $opt_jfbp_show_spinner;
    ?>
" value="2" <?php 
    echo get_option($opt_jfbp_show_spinner) == 2 ? "checked='checked'" : "";
    ?>
 >Show a black AJAX spinner to indicate the login process has started (<img src=" <?php 
    echo $jfb_data_url;
    ?>
/assets/spinner_black.gif" alt="spinner" />)<br /><br />
                
        <b>AutoRegistration Restrictions:</b><br />
        <?php 
    add_option($opt_jfbp_restrict_reg_url, '/');
    ?>
        <input <?php 
    disableatt();
    ?>
 type="radio" name="<?php 
    echo $opt_jfbp_restrict_reg;
    ?>
" value="0" <?php 
    echo get_option($opt_jfbp_restrict_reg) == 0 ? "checked='checked'" : "";
    ?>
>Open: Anyone can login (Default)<br />
        <input <?php 
    disableatt();
    ?>
 type="radio" name="<?php 
    echo $opt_jfbp_restrict_reg;
    ?>
" value="1" <?php 
    echo get_option($opt_jfbp_restrict_reg) == 1 ? "checked='checked'" : "";
    ?>
>Closed: Only login existing blog users<br />
        <input <?php 
    disableatt();
    ?>
 type="radio" name="<?php 
    echo $opt_jfbp_restrict_reg;
    ?>
" value="2" <?php 
    echo get_option($opt_jfbp_restrict_reg) == 2 ? "checked='checked'" : "";
    ?>
>Invitational: Only login users who've been invited via the <a href="http://wordpress.org/extend/plugins/wordpress-mu-secure-invites/">Secure Invites</a> plugin <dfn title="For invites to work, the connecting user's Facebook email must be accessible, and it must match the email to which the invitation was sent.">(Mouseover for more info)</dfn><br />
        <input <?php 
    disableatt();
    ?>
 type="radio" name="<?php 
    echo $opt_jfbp_restrict_reg;
    ?>
" value="3" <?php 
    echo get_option($opt_jfbp_restrict_reg) == 3 ? "checked='checked'" : "";
    ?>
>Friendship: Only login users who are friends with uid <input <?php 
    disableatt();
    ?>
 type="text" size="15" name="<?php 
    echo $opt_jfbp_restrict_reg_uid;
    ?>
" value="<?php 
    echo get_option($opt_jfbp_restrict_reg_uid);
    ?>
" /> on Facebook <dfn title="To find your Facebook uid, login and view your Profile Pictures album.  The URL will be something like 'http://www.facebook.com/media/set/?set=a.123.456.789'.  In this example, your uid would be 789 (the numbers after the last decimal point).">(Mouseover for more info)</dfn><br />
        <input <?php 
    disableatt();
    ?>
 type="radio" name="<?php 
    echo $opt_jfbp_restrict_reg;
    ?>
" value="4" <?php 
    echo get_option($opt_jfbp_restrict_reg) == 4 ? "checked='checked'" : "";
    ?>
>Membership: Only login users who are members of group id <input <?php 
    disableatt();
    ?>
 type="text" size="15" name="<?php 
    echo $opt_jfbp_restrict_reg_gid;
    ?>
" value="<?php 
    echo get_option($opt_jfbp_restrict_reg_gid);
    ?>
" /> on Facebook <dfn title="To find a groups's id, view its URL.  It will be something like 'http://www.facebook.com/group.php?gid=12345678'.  In this example, the group id would be 12345678.">(Mouseover for more info)</dfn><br />
        <input <?php 
    disableatt();
    ?>
 type="radio" name="<?php 
    echo $opt_jfbp_restrict_reg;
    ?>
" value="5" <?php 
    echo get_option($opt_jfbp_restrict_reg) == 5 ? "checked='checked'" : "";
    ?>
>Fanpage: Only login users who are fans of page id <input <?php 
    disableatt();
    ?>
 type="text" size="15" name="<?php 
    echo $opt_jfbp_restrict_reg_pid;
    ?>
" value="<?php 
    echo get_option($opt_jfbp_restrict_reg_pid);
    ?>
" /> on Facebook <dfn title="To find a page's id, view one of its photo albums.  The URL will be something like 'http://www.facebook.com/media/set/?set=a.123.456.789'.  In this example, the id would be 789 (the numbers after the last decimal point).">(Mouseover for more info)</dfn><br />
        Redirect URL for denied logins: <input <?php 
    disableatt();
    ?>
 type="text" size="30" name="<?php 
    echo $opt_jfbp_restrict_reg_url;
    ?>
" value="<?php 
    echo get_option($opt_jfbp_restrict_reg_url);
    ?>
" /><br /><br />
                
        <b>Custom Redirects:</b><br />
        <?php 
    add_option($opt_jfbp_redirect_new, "1");
    ?>
        <?php 
    add_option($opt_jfbp_redirect_existing, "1");
    ?>
        <?php 
    add_option($opt_jfbp_redirect_logout, "1");
    ?>
        When a new user is autoregistered on your site, redirect them to:<br />
        <input <?php 
    disableatt();
    ?>
 type="radio" name="<?php 
    echo $opt_jfbp_redirect_new;
    ?>
" value="1" <?php 
    echo get_option($opt_jfbp_redirect_new) == 1 ? "checked='checked'" : "";
    ?>
 >Default (refresh current page)<br />
        <input <?php 
    disableatt();
    ?>
 type="radio" name="<?php 
    echo $opt_jfbp_redirect_new;
    ?>
" value="2" <?php 
    echo get_option($opt_jfbp_redirect_new) == 2 ? "checked='checked'" : "";
    ?>
 >Custom URL:
        <input <?php 
    disableatt();
    ?>
 type="text" size="47" name="<?php 
    echo $opt_jfbp_redirect_new_custom;
    ?>
" value="<?php 
    echo get_option($opt_jfbp_redirect_new_custom);
    ?>
" /> <small>(Supports %username% variables)</small><br /><br />
        When an existing user returns to your site, redirect them to:<br />
        <input <?php 
    disableatt();
    ?>
 type="radio" name="<?php 
    echo $opt_jfbp_redirect_existing;
    ?>
" value="1" <?php 
    echo get_option($opt_jfbp_redirect_existing) == 1 ? "checked='checked'" : "";
    ?>
 >Default (refresh current page)<br />
        <input <?php 
    disableatt();
    ?>
 type="radio" name="<?php 
    echo $opt_jfbp_redirect_existing;
    ?>
" value="2" <?php 
    echo get_option($opt_jfbp_redirect_existing) == 2 ? "checked='checked'" : "";
    ?>
 >Custom URL:
        <input <?php 
    disableatt();
    ?>
 type="text" size="47" name="<?php 
    echo $opt_jfbp_redirect_existing_custom;
    ?>
" value="<?php 
    echo get_option($opt_jfbp_redirect_existing_custom);
    ?>
" /> <small>(Supports %username% variables)</small><br /><br />
        When a user logs out of your site, redirect them to:<br />
        <input <?php 
    disableatt();
    ?>
 type="radio" name="<?php 
    echo $opt_jfbp_redirect_logout;
    ?>
" value="1" <?php 
    echo get_option($opt_jfbp_redirect_logout) == 1 ? "checked='checked'" : "";
    ?>
 >Default (refresh current page)<br />
        <input <?php 
    disableatt();
    ?>
 type="radio" name="<?php 
    echo $opt_jfbp_redirect_logout;
    ?>
" value="2" <?php 
    echo get_option($opt_jfbp_redirect_logout) == 2 ? "checked='checked'" : "";
    ?>
 >Custom URL:
        <input <?php 
    disableatt();
    ?>
 type="text" size="47" name="<?php 
    echo $opt_jfbp_redirect_logout_custom;
    ?>
" value="<?php 
    echo get_option($opt_jfbp_redirect_logout_custom);
    ?>
" /><br /><br />

        <b>Welcome Message:</b><br />
        <?php 
    add_option($opt_jfbp_notifyusers_content, "Thank you for logging into " . get_option('blogname') . " with Facebook.\nIf you would like to login manually, you may do so with the following credentials.\n\nUsername: %username%\nPassword: %password%");
    ?>
        <?php 
    add_option($opt_jfbp_notifyusers_subject, "Welcome to " . get_option('blogname'));
    ?>
        <input <?php 
    disableatt();
    ?>
 type="checkbox" name="<?php 
    echo $opt_jfbp_notifyusers;
    ?>
" value="1" <?php 
    echo get_option($opt_jfbp_notifyusers) ? 'checked="checked"' : '';
    ?>
 /> Send a custom welcome e-mail to users who register via Facebook <small>(*If we know their address)</small><br />
        <input <?php 
    disableatt();
    ?>
 type="text" size="102" name="<?php 
    echo $opt_jfbp_notifyusers_subject;
    ?>
" value="<?php 
    echo get_option($opt_jfbp_notifyusers_subject);
    ?>
" /><br />
        <textarea <?php 
    disableatt();
    ?>
 cols="85" rows="5" name="<?php 
    echo $opt_jfbp_notifyusers_content;
    ?>
"><?php 
    echo get_option($opt_jfbp_notifyusers_content);
    ?>
</textarea><br /><br />

        <b>BuddyPress Activity Stream:</b><br />
        <?php 
    add_option($opt_jfbp_bpstream_logincontent, "%user% logged in with Facebook");
    ?>
        <?php 
    add_option($opt_jfbp_bpstream_registercontent, "%user% registered with Facebook");
    ?>
        <input <?php 
    disableatt();
    ?>
 type="checkbox" name="<?php 
    echo $opt_jfbp_bpstream_register;
    ?>
" value="1" <?php 
    echo get_option($opt_jfbp_bpstream_register) ? 'checked="checked"' : '';
    ?>
 /> When a new user autoconnects to your site, post to the BP Activity Stream:
        <input <?php 
    disableatt();
    ?>
 type="text" size="50" name="<?php 
    echo $opt_jfbp_bpstream_registercontent;
    ?>
" value="<?php 
    echo get_option($opt_jfbp_bpstream_registercontent);
    ?>
" /><br />
        <input <?php 
    disableatt();
    ?>
 type="checkbox" name="<?php 
    echo $opt_jfbp_bpstream_login;
    ?>
" value="1" <?php 
    echo get_option($opt_jfbp_bpstream_login) ? 'checked="checked"' : '';
    ?>
 /> When an existing user returns to your site, post to the BP Activity Stream:
        <input <?php 
    disableatt();
    ?>
 type="text" size="50" name="<?php 
    echo $opt_jfbp_bpstream_logincontent;
    ?>
" value="<?php 
    echo get_option($opt_jfbp_bpstream_logincontent);
    ?>
" /><br /><br />
 
        <b>BuddyPress X-Profile Mappings</b><br />
        This section will let you automatically fill in your Buddypress users' X-Profile data from their Facebook profiles.<br />
        <small>&bull; Facebook fields marked with an asterisk (i.e. Birthday*) require the user to approve extra permissions during login.</small><br />
        <small>&bull; Some limitations exist regarding which X-Profile fields can be populated <dfn title="Only 'Text Box,' 'Multi-Line Text Box,' and 'Date Selector'-type profile fields can be mapped at this time.  Due to unpredictability in matching freeform values from Facebook to pre-defined values on BuddyPress, support for dropdowns, radiobuttons, and checkboxes MAY be added in the future.">(Mouseover for more info)</dfn></small><br />
        <small>&bull; Some limitations exist regarding which Facebook fields can be imported <dfn title="Because some Facebook fields are formatted differently, each one needs to be explicitly implemented.  I've included an initial selection of fields (i.e. Name, Gender, Birthday, Bio, etc), but if you need another field to be available, please request it on the support page and I'll do my best to add it to the next update.">(Mouseover for more info)</dfn></small><br /><br />
        
         <?php 
    //If people report problems with Buddypress detection, use this more robust method: http://codex.buddypress.org/plugin-development/checking-buddypress-is-active/
    if (!function_exists('bp_has_profile')) {
        echo "<i>BuddyPress Not Found.  This section is only available on BuddyPress-enabled sites.</i>";
    } else {
        if (!bp_has_profile()) {
            echo "Error: BuddyPress Profile Not Found.  This should never happen - if you see this message, please report it on the plugin support page.";
        } else {
            //Present the 3 mapping options: disable mapping, map new users, or map new and returning users
            ?>
 
            <input <?php 
            disableatt();
            ?>
 type="radio" name="<?php 
            echo $opt_jfbp_xprofile_map;
            ?>
" value="0" <?php 
            echo get_option($opt_jfbp_xprofile_map) == 0 ? "checked='checked'" : "";
            ?>
 >Disable Mapping
            <input <?php 
            disableatt();
            ?>
 type="radio" name="<?php 
            echo $opt_jfbp_xprofile_map;
            ?>
" value="1" <?php 
            echo get_option($opt_jfbp_xprofile_map) == 1 ? "checked='checked'" : "";
            ?>
 >Map New Users Only
            <input <?php 
            disableatt();
            ?>
 type="radio" name="<?php 
            echo $opt_jfbp_xprofile_map;
            ?>
" value="2" <?php 
            echo get_option($opt_jfbp_xprofile_map) == 2 ? "checked='checked'" : "";
            ?>
 >Map New And Returning Users<br /><?php 
            //Make a list of which Facebook fields may be mapped to each type of xProfile field.  Omitted types (i.e. checkbox) are treated as "unmappable."
            //The format is "xprofile_field_type"->"(fbfieldname1, fbfieldDisplayname1), (fbfieldname2, fbfieldDisplayname2), ..."
            //(Available FB fields are documented at: https://developers.facebook.com/docs/reference/api/user/)
            $allowed_mappings = array('textbox' => array('id' => "ID", 'name' => "Name", 'first_name' => "First Name", 'middle_name' => "Middle Name", 'last_name' => "Last Name", 'username' => "Username", 'gender' => "Gender", 'link' => "Profile URL", "website" => "Website*", 'bio' => "Bio*", 'political' => "Political*", "religion" => "Religion*", 'relationship_status' => "Relationship*", "location" => "City*", 'hometown' => "Hometown*", 'languages' => "Languages*", 'music' => 'Music*', 'interests' => 'Interests*'), 'textarea' => array('id' => "ID", 'name' => "Name", 'first_name' => "First Name", 'middle_name' => "Middle Name", 'last_name' => "Last Name", 'username' => "Username", 'gender' => "Gender", 'link' => "Profile URL", "website" => "Website*", 'bio' => "Bio*", 'political' => "Political*", "religion" => "Religion*", 'relationship_status' => "Relationship*", "location" => "City*", 'hometown' => "Hometown*", 'languages' => "Languages*", 'music' => 'Music*', 'interests' => 'Interests*'), 'datebox' => array('birthday' => 'Birthday*'));
            $allowed_mappings = apply_filters('wpfb_xprofile_allowed_mappings', $allowed_mappings);
            //Go through all of the XProfile fields and offer possible Facebook mappings for each (in a dropdown).
            //(current_mappings is used to set the initial state of the panel, i.e. based on what mappings are already in the db)
            $current_mappings = get_option($opt_jfbp_xprofile_mappings);
            while (bp_profile_groups()) {
                //Create a "box" for each XProfile Group
                global $group;
                bp_the_profile_group();
                ?>
<div style="width:420px; padding:5px; margin:2px 0; background-color:#EEEDDA; border:1px solid #CCC;"><?php 
                echo "Group \"{$group->name}\":<br />";
                //And populate the group box with Textarea(xprofile field)->Dropdown(possible facebook mappings)
                while (bp_profile_fields()) {
                    //Output the X-Profile field textarea
                    global $field;
                    bp_the_profile_field();
                    ?>
<input disabled='disabled' type="text" size="20" name="<?php 
                    echo $field->name;
                    ?>
" value="<?php 
                    echo $field->name;
                    ?>
" /> -&gt;
                    
                    <?php 
                    //If there aren't any available Facebook mappings, just put a disabled textbox and "hidden" field that sets this option as '0'
                    if (!$allowed_mappings[$field->type]) {
                        echo "<input disabled='disabled' type='text' size='30' name='{$field->name}" . "_unavail" . "' value='(No Mappings Available)' />";
                        echo "<input type='hidden' name='{$field->id}' value='0' />";
                        continue;
                    }
                    //Otherwise, list all of the available mappings in a dropdown.
                    ?>
<select name="<?php 
                    echo $jfb_xprofile_field_prefix . $field->id;
                    ?>
">
                        <option value="0">(No Mapping)</option><?php 
                    foreach ($allowed_mappings[$field->type] as $fbname => $userfriendlyname) {
                        echo "<option " . ($current_mappings[$field->id] == $fbname ? "selected" : "") . " value=\"{$fbname}\">{$userfriendlyname}</option>";
                    }
                    ?>
</select><br /><?php 
                }
                ?>
</div><?php 
            }
        }
    }
    ?>
                                        
        <input type="hidden" name="prem_opts_updated" value="1" />
        <div class="submit"><input <?php 
    disableatt();
    ?>
 type="submit" name="Submit" value="Save Premium" /></div>
    </form>
    <?php 
}
Exemplo n.º 8
0
    /**
     * Renders BuddyPress account extra fields.
     *
     * @since 3.5
     *
     * @access private
     */
    private function _render_buddypress_account_extra_fields()
    {
        if (!bp_is_active('xprofile')) {
            return;
        }
        do_action('bp_before_signup_profile_fields');
        ?>
<div class="register-section" id="profile-details-section">
			<h4><?php 
        _e('Profile Details', 'membership');
        ?>
</h4>

			<?php 
        if (bp_has_profile('profile_group_id=1&hide_empty_fields=0')) {
            ?>
				<?php 
            while (bp_profile_groups()) {
                bp_the_profile_group();
                ?>
					<?php 
                while (bp_profile_fields()) {
                    bp_the_profile_field();
                    ?>

						<?php 
                    $field_name = bp_get_the_profile_field_input_name();
                    ?>
						<?php 
                    $field_name_esc = esc_attr($field_name);
                    ?>
						<?php 
                    $field_type = bp_get_the_profile_field_type();
                    ?>

						<div class="editfield">
							<?php 
                    if ('textbox' == $field_type) {
                        ?>
								<label for="<?php 
                        echo $field_name_esc;
                        ?>
">
									<?php 
                        if (bp_get_the_profile_field_is_required()) {
                            ?>
										<?php 
                            printf(_x('%s (required)', '{Profile field} (required)', 'membership'), bp_get_the_profile_field_name());
                            ?>
									<?php 
                        } else {
                            ?>
										<?php 
                            bp_the_profile_field_name();
                            ?>
									<?php 
                        }
                        ?>
								</label>
								<?php 
                        do_action("bp_{$field_name}_errors");
                        ?>
								<input type="text" name="<?php 
                        echo $field_name_esc;
                        ?>
" id="<?php 
                        echo $field_name_esc;
                        ?>
" value="<?php 
                        bp_the_profile_field_edit_value();
                        ?>
" />
							<?php 
                    }
                    ?>

							<?php 
                    if ('textarea' == $field_type) {
                        ?>
								<label for="<?php 
                        echo $field_name_esc;
                        ?>
">
									<?php 
                        if (bp_get_the_profile_field_is_required()) {
                            ?>
										<?php 
                            printf(_x('%s (required)', '{Profile field} (required)', 'membership'), bp_get_the_profile_field_name());
                            ?>
									<?php 
                        } else {
                            ?>
										<?php 
                            bp_the_profile_field_name();
                            ?>
									<?php 
                        }
                        ?>
								</label>
								<?php 
                        do_action("bp_{$field_name}_errors");
                        ?>
								<textarea rows="5" cols="40" name="<?php 
                        echo $field_name_esc;
                        ?>
" id="<?php 
                        echo $field_name_esc;
                        ?>
"><?php 
                        bp_the_profile_field_edit_value();
                        ?>
</textarea>
							<?php 
                    }
                    ?>

							<?php 
                    if ('selectbox' == $field_type) {
                        ?>
								<label for="<?php 
                        echo $field_name_esc;
                        ?>
">
									<?php 
                        if (bp_get_the_profile_field_is_required()) {
                            ?>
										<?php 
                            printf(_x('%s (required)', '{Profile field} (required)', 'membership'), bp_get_the_profile_field_name());
                            ?>
									<?php 
                        } else {
                            ?>
										<?php 
                            bp_the_profile_field_name();
                            ?>
									<?php 
                        }
                        ?>
								</label>
								<?php 
                        do_action("bp_{$field_name}_errors");
                        ?>
								<select name="<?php 
                        echo $field_name_esc;
                        ?>
" id="<?php 
                        echo $field_name_esc;
                        ?>
">
									<?php 
                        bp_the_profile_field_options();
                        ?>
								</select>
							<?php 
                    }
                    ?>

							<?php 
                    if ('multiselectbox' == $field_type) {
                        ?>
								<label for="<?php 
                        echo $field_name_esc;
                        ?>
">
									<?php 
                        if (bp_get_the_profile_field_is_required()) {
                            ?>
										<?php 
                            printf(_x('%s (required)', '{Profile field} (required)', 'membership'), bp_get_the_profile_field_name());
                            ?>
									<?php 
                        } else {
                            ?>
										<?php 
                            bp_the_profile_field_name();
                            ?>
									<?php 
                        }
                        ?>
								</label>
								<?php 
                        do_action("bp_{$field_name}_errors");
                        ?>
								<select name="<?php 
                        echo $field_name_esc;
                        ?>
" id="<?php 
                        echo $field_name_esc;
                        ?>
" multiple="multiple">
									<?php 
                        bp_the_profile_field_options();
                        ?>
								</select>
							<?php 
                    }
                    ?>

							<?php 
                    if ('radio' == $field_type) {
                        ?>
								<div class="radio">
									<span class="label">
										<?php 
                        if (bp_get_the_profile_field_is_required()) {
                            ?>
											<?php 
                            printf(_x('%s (required)', '{Profile field} (required)', 'membership'), bp_get_the_profile_field_name());
                            ?>
										<?php 
                        } else {
                            ?>
											<?php 
                            bp_the_profile_field_name();
                            ?>
										<?php 
                        }
                        ?>
									</span>

									<?php 
                        do_action("bp_{$field_name}_errors");
                        ?>
									<?php 
                        bp_the_profile_field_options();
                        ?>

									<?php 
                        if (!bp_get_the_profile_field_is_required()) {
                            ?>
										<a class="clear-value" href="javascript:clear( '<?php 
                            echo $field_name_esc;
                            ?>
' );"><?php 
                            _e('Clear', 'membership');
                            ?>
</a>
									<?php 
                        }
                        ?>
								</div>
							<?php 
                    }
                    ?>

							<?php 
                    if ('checkbox' == $field_type) {
                        ?>
								<div class="checkbox">
									<span class="label">
										<?php 
                        if (bp_get_the_profile_field_is_required()) {
                            ?>
											<?php 
                            printf(_x('%s (required)', '{Profile field} (required)', 'membership'), bp_get_the_profile_field_name());
                            ?>
										<?php 
                        } else {
                            ?>
											<?php 
                            bp_the_profile_field_name();
                            ?>
										<?php 
                        }
                        ?>
									</span>

									<?php 
                        do_action("bp_{$field_name}_errors");
                        ?>
									<?php 
                        bp_the_profile_field_options();
                        ?>
								</div>
							<?php 
                    }
                    ?>

							<?php 
                    if ('datebox' == $field_type) {
                        ?>
								<div class="datebox">
									<label for="<?php 
                        echo $field_name_esc;
                        ?>
_day">
										<?php 
                        if (bp_get_the_profile_field_is_required()) {
                            ?>
											<?php 
                            printf(_x('%s (required)', '{Profile field} (required)', 'membership'), bp_get_the_profile_field_name());
                            ?>
										<?php 
                        } else {
                            ?>
											<?php 
                            bp_the_profile_field_name();
                            ?>
										<?php 
                        }
                        ?>
									</label>

									<?php 
                        do_action("bp_{$field_name}_errors");
                        ?>

									<select name="<?php 
                        echo $field_name_esc;
                        ?>
_day" id="<?php 
                        echo $field_name_esc;
                        ?>
_day">
										<?php 
                        bp_the_profile_field_options('type=day');
                        ?>
									</select>

									<select name="<?php 
                        echo $field_name_esc;
                        ?>
_month" id="<?php 
                        echo $field_name_esc;
                        ?>
_month">
										<?php 
                        bp_the_profile_field_options('type=month');
                        ?>
									</select>

									<select name="<?php 
                        echo $field_name_esc;
                        ?>
_year" id="<?php 
                        echo $field_name_esc;
                        ?>
_year">
										<?php 
                        bp_the_profile_field_options('type=year');
                        ?>
									</select>
								</div>
							<?php 
                    }
                    ?>

							<?php 
                    do_action('bp_custom_profile_edit_fields_pre_visibility');
                    ?>

							<?php 
                    if (bp_current_user_can('bp_xprofile_change_field_visibility')) {
                        ?>
								<p class="field-visibility-settings-toggle" id="field-visibility-settings-toggle-<?php 
                        bp_the_profile_field_id();
                        ?>
">
									<?php 
                        printf(_x('This field can be seen by: %s', 'This field can be seen by: {Administrator}', 'membership'), '<span class="current-visibility-level">' . bp_get_the_profile_field_visibility_level_label() . '</span>');
                        ?>
 <a href="#" class="visibility-toggle-link"><?php 
                        _ex('Change', 'Change profile field visibility level', 'membership');
                        ?>
</a>
								</p>

								<div class="field-visibility-settings" id="field-visibility-settings-<?php 
                        bp_the_profile_field_id();
                        ?>
">
									<fieldset>
										<legend><?php 
                        _e('Who can see this field?', 'membership');
                        ?>
</legend>
										<?php 
                        bp_profile_visibility_radio_buttons();
                        ?>
									</fieldset>
									<a class="field-visibility-settings-close" href="#"><?php 
                        _e('Close', 'membership');
                        ?>
</a>
								</div>
							<?php 
                    } else {
                        ?>
								<p class="field-visibility-settings-notoggle" id="field-visibility-settings-toggle-<?php 
                        bp_the_profile_field_id();
                        ?>
">
									<?php 
                        printf(__('This field can be seen by: <span class="current-visibility-level">%s</span>', 'membership'), bp_get_the_profile_field_visibility_level_label());
                        ?>
								</p>
							<?php 
                    }
                    ?>

							<?php 
                    do_action('bp_custom_profile_edit_fields');
                    ?>
							<p class="description"><?php 
                    bp_the_profile_field_description();
                    ?>
</p>
						</div>
					<?php 
                }
                ?>
					<input type="hidden" name="signup_profile_field_ids" id="signup_profile_field_ids" value="<?php 
                bp_the_profile_group_field_ids();
                ?>
">
				<?php 
            }
            ?>
			<?php 
        }
        ?>
		</div><!-- #profile-details-section --><?php 
        do_action('bp_after_signup_profile_fields');
    }
Exemplo n.º 9
0
function bp_ajax_register_form_function()
{
    ob_start();
    ?>

<style>


#ajax_signup_form { text-align:left; color:#cfcfcf; } 
#ajax_signup_form input[type=text], #ajax_signup_form input[type=password] {
	width:95% !important; height:1.7em !important; border-radius:4px !important;
}

#ajax_signup_form label, #ajax_signup_form span.label {
    display: block; font-weight: bold; margin: 10px 0 4px; text-align: left; color:#DDD;
}

#ajax_signup_form #blog-details-section, #ajax_signup_form #profile-details-section {
	width:auto;	float:none;
}

#ajax_signup_form.standard-form div div.error {
    background: none repeat scroll 0 0 #E41717; border-radius: 3px 3px 3px 3px; color: #FFFFFF; margin: 0 0 3px; padding: 1px 4px; font-size:12px; display:none;
}

.errorField {
    background: none repeat scroll 0 0 #FF9999; outline: 0 none;
}
div#si_refresh_reg { display:inline; } 

div.ctrlHolder {
	float: left; margin-left:30px; width: 44%;
}

.fullwidth { width:96% !important; } 

div.ctrlHolder span.help { font-style:italic; font-size:12px;} 
div#blog_template-selection { float:left; margin-left:30px; } 
div.blog_template-item { 
    margin-left: 2px !important; padding: 2px 2px 5px 2px !important; width: 80px !important;
 }
	
div.blog_template-item div.blog_template-description { display:none; } 
div.blog_template-selected {
   background: none repeat scroll 0 0 #DDDDDD !important; color: #000000 !important;
}
#ajax_signup_form div.submit { margin-left:30px; }  

div.register-section input#captcha_code { width:160px !important; } 

img#si_image_reg { margin-top:10px;border: 2px solid #222222; } 

div.success_message { background: none repeat scroll 0 0 #555555;
    border: 1px solid #ACACAC;
    border-radius: 8px 8px 8px 8px;
    box-shadow: 0 0px 2px 1px #CCCCCC inset;
    color: #FFFFFF;
    padding: 15px;
	margin-top:60px;
	display:none;
}

#signup_submit {
    background: none repeat scroll 0 0 #0099CC;
    border: medium none;
	border-radius:0 !important;
    color: #FFFFFF;
    cursor: pointer;
    display: inline-block;
    font-family: "Helvetica Neue","Helvetica",Arial,Verdana,sans-serif;
    font-size: 1.3rem;
    line-height: 1;
    margin: 1em 0 0;
    outline: medium none;
    padding: 0.5em 2em;
    position: relative;
    text-align: center;
    text-decoration: none;
}

#signup_submit:hover, #signup_submit:focus  { 
	background-color: #666666 !important; color: #FFFFFF;
}

.captchaSizeDivLarge { float:left; } 

#blog-details-section  { margin-bottom:10px; } 
</style>

<script type="text/javascript">
	jQuery(document).ready( function() {
		
		//jQuery('div#blog-details').show();

		//jQuery( 'input#signup_with_blog' ).removeAttr("checked");
		//if ( jQuery('div#blog-details').length && !jQuery('div#blog-details').hasClass('show') )
			//jQuery('div#blog-details').toggle();

		//jQuery( 'input#signup_with_blog' ).click( function() {
			//jQuery('div#blog-details').fadeOut().toggle();
		//});

		jQuery( '#ajax_signup_form input' ).focus(function(e) {
            var name = jQuery(this).attr('name');
			jQuery(this).removeClass('errorField');
			//jQuery('#'+name+"_error").fadeOut(400);
        });
		
		jQuery('#captcha_code').parent().find('label').append('<div id="captcha_code_error" class="error"></div>');
		jQuery('.captchaSizeDivLarge').parent().css('margin-left','30px');
	});
</script>

<script language="javascript" type="text/javascript">
	var ajaxurl = '<?php 
    echo admin_url('admin-ajax.php');
    ?>
 ' ;
	var myinterval;

	function hideSuccessMessage() { 
		window.clearInterval(myinterval);
		jQuery('.success_message').fadeOut(300,function(){
			jQuery('#ajax_signup_form').fadeIn(400,function(){});
		});
	}
	
	function bp_ajax_submit_register_form()
	{
		jQuery('.error').hide();
		var serialized = jQuery('#ajax_signup_form').serialize();
		var data = serialized;
		jQuery.post(ajaxurl, data, function(response) {
			response = eval('('+response+')');
			if(response['status'] == 'error') {
				var errors = response['errors'];
				for(i in errors) {
					jQuery('#'+i+"_error").html(errors[i]);
					jQuery('#'+i+"_error").fadeIn(300);
				}
			} else {
				if(response['status'] == 'user-error') {
					alert(response['error-msg']);
				} else if (response['status'] == 'success') {
					document.getElementById('ajax_signup_form').reset();
					
					jQuery('#ajax_signup_form').fadeOut(300,function(){
						jQuery('.success_message').fadeIn(400,function(){
							myinterval = window.setInterval(hideSuccessMessage, 4000);
						});
					});
				} else {
					alert('Unknown Error Occured.');
				}
			}
			jQuery('#si_refresh_reg a').trigger('click');
		});
	}
</script>
<div class="success_message">
<?php 
    if (bp_registration_needs_activation()) {
        ?>
					<p><?php 
        _e('You have successfully created your account! To begin using this site you will need to activate your account via the email we have just sent to your address.', 'buddypress');
        ?>
</p>
				<?php 
    } else {
        ?>
					<p><?php 
        _e('You have successfully created your account! Please log in using the username and password you have just created.', 'buddypress');
        ?>
</p>
				<?php 
    }
    ?>
</div>
<form action="" onSubmit="bp_ajax_submit_register_form(); return false;" name="signup_form" id="ajax_signup_form" class="standard-form" method="post" enctype="multipart/form-data">
			
				<h2><?php 
    _e('&nbsp;', 'buddypress');
    ?>
</h2>

				<?php 
    do_action('template_notices');
    ?>

				<?php 
    do_action('bp_before_account_details_fields');
    ?>

				<div class="register-section ajax-register-section" id="basic-details-section">

					<?php 
    /***** Basic Account Details ******/
    ?>

					<div class="ctrlHolder">
					<label for="signup_username"><?php 
    _e('Username', 'buddypress');
    ?>
 <?php 
    _e('', 'buddypress');
    ?>
</label>
					<div id="signup_username_error" class="error"></div>
					<input type="text" name="signup_username" id="signup_username" value="<?php 
    bp_signup_username_value();
    ?>
" />
                    </div>

					<div class="ctrlHolder">
					<label for="signup_email"><?php 
    _e('Email Address', 'buddypress');
    ?>
 <?php 
    _e('', 'buddypress');
    ?>
</label>
					<div id="signup_email_error" class="error"></div>
					<input type="text" name="signup_email" id="signup_email" value="<?php 
    bp_signup_email_value();
    ?>
" />
					</div>
                    
                    <div class="ctrlHolder">
					<label for="signup_password"><?php 
    _e('Choose a Password', 'buddypress');
    ?>
 <?php 
    _e('', 'buddypress');
    ?>
</label>
					<div id="signup_password_error" class="error"></div>
					<input type="password" name="signup_password" id="signup_password" value="" />
					</div>
                    
                    <div class="ctrlHolder">
					<label for="signup_password_confirm"><?php 
    _e('Confirm Password', 'buddypress');
    ?>
 <?php 
    _e('', 'buddypress');
    ?>
</label>
					<div id="signup_password_confirm_error" class="error"></div>
					<input type="password" name="signup_password_confirm" id="signup_password_confirm" value="" />
					</div>
				</div><!-- #basic-details-section -->

				<?php 
    do_action('bp_after_account_details_fields');
    ?>

				<?php 
    /***** Extra Profile Details ******/
    ?>

				<?php 
    if (bp_is_active('xprofile')) {
        ?>

					<?php 
        do_action('bp_before_signup_profile_fields');
        ?>

					<div class="register-section ajax-register-section" id="profile-details-section">

						<?php 
        /* Use the profile field loop to render input fields for the 'base' profile field group */
        ?>
						<?php 
        if (bp_is_active('xprofile')) {
            if (bp_has_profile('profile_group_id=1&hide_empty_fields=0')) {
                while (bp_profile_groups()) {
                    bp_the_profile_group();
                    ?>

						<?php 
                    while (bp_profile_fields()) {
                        bp_the_profile_field();
                        ?>

							<div class="ctrlHolder fullwidth">

								<?php 
                        if ('textbox' == bp_get_the_profile_field_type()) {
                            ?>

									<label for="<?php 
                            bp_the_profile_field_input_name();
                            ?>
"><?php 
                            bp_the_profile_field_name();
                            ?>
 <?php 
                            if (bp_get_the_profile_field_is_required()) {
                                _e('', 'buddypress');
                            }
                            ?>
</label>
									<div id="<?php 
                            bp_the_profile_field_input_name();
                            ?>
_error" class="error"></div>
									<input type="text" name="<?php 
                            bp_the_profile_field_input_name();
                            ?>
" id="<?php 
                            bp_the_profile_field_input_name();
                            ?>
" value="<?php 
                            bp_the_profile_field_edit_value();
                            ?>
" />

								<?php 
                        }
                        ?>

								<?php 
                        if ('textarea' == bp_get_the_profile_field_type()) {
                            ?>

									<label for="<?php 
                            bp_the_profile_field_input_name();
                            ?>
"><?php 
                            bp_the_profile_field_name();
                            ?>
 <?php 
                            if (bp_get_the_profile_field_is_required()) {
                                _e('', 'buddypress');
                            }
                            ?>
</label>
									<div id="<?php 
                            bp_the_profile_field_input_name();
                            ?>
_error" class="error"></div>
									<textarea rows="5" cols="40" name="<?php 
                            bp_the_profile_field_input_name();
                            ?>
" id="<?php 
                            bp_the_profile_field_input_name();
                            ?>
"><?php 
                            bp_the_profile_field_edit_value();
                            ?>
</textarea>

								<?php 
                        }
                        ?>

								<?php 
                        if ('selectbox' == bp_get_the_profile_field_type()) {
                            ?>

									<label for="<?php 
                            bp_the_profile_field_input_name();
                            ?>
"><?php 
                            bp_the_profile_field_name();
                            ?>
 <?php 
                            if (bp_get_the_profile_field_is_required()) {
                                _e('', 'buddypress');
                            }
                            ?>
</label>
									<div id="<?php 
                            bp_the_profile_field_input_name();
                            ?>
_error" class="error"></div>
									<select name="<?php 
                            bp_the_profile_field_input_name();
                            ?>
" id="<?php 
                            bp_the_profile_field_input_name();
                            ?>
">
										<?php 
                            bp_the_profile_field_options();
                            ?>
									</select>

								<?php 
                        }
                        ?>

								<?php 
                        if ('multiselectbox' == bp_get_the_profile_field_type()) {
                            ?>

									<label for="<?php 
                            bp_the_profile_field_input_name();
                            ?>
"><?php 
                            bp_the_profile_field_name();
                            ?>
 <?php 
                            if (bp_get_the_profile_field_is_required()) {
                                _e('', 'buddypress');
                            }
                            ?>
</label>
									<div id="<?php 
                            bp_the_profile_field_input_name();
                            ?>
_error" class="error"></div>
									<select name="<?php 
                            bp_the_profile_field_input_name();
                            ?>
" id="<?php 
                            bp_the_profile_field_input_name();
                            ?>
" multiple="multiple">
										<?php 
                            bp_the_profile_field_options();
                            ?>
									</select>

								<?php 
                        }
                        ?>

								<?php 
                        if ('radio' == bp_get_the_profile_field_type()) {
                            ?>

									<div class="radio">
										<span class="label"><?php 
                            bp_the_profile_field_name();
                            ?>
 <?php 
                            if (bp_get_the_profile_field_is_required()) {
                                _e('', 'buddypress');
                            }
                            ?>
</span>

										<div id="<?php 
                            bp_the_profile_field_input_name();
                            ?>
_error" class="error"></div>
										<?php 
                            bp_the_profile_field_options();
                            ?>

										<?php 
                            if (!bp_get_the_profile_field_is_required()) {
                                ?>
											<a class="clear-value" href="javascript:clear( '<?php 
                                bp_the_profile_field_input_name();
                                ?>
' );"><?php 
                                _e('Clear', 'buddypress');
                                ?>
</a>
										<?php 
                            }
                            ?>
									</div>

								<?php 
                        }
                        ?>

								<?php 
                        if ('checkbox' == bp_get_the_profile_field_type()) {
                            ?>

									<div class="checkbox">
										<span class="label"><?php 
                            bp_the_profile_field_name();
                            ?>
 <?php 
                            if (bp_get_the_profile_field_is_required()) {
                                _e('', 'buddypress');
                            }
                            ?>
</span>

										<div id="<?php 
                            bp_the_profile_field_input_name();
                            ?>
_error" class="error"></div>
										<?php 
                            bp_the_profile_field_options();
                            ?>
									</div>

								<?php 
                        }
                        ?>

								<?php 
                        if ('datebox' == bp_get_the_profile_field_type()) {
                            ?>

									<div class="datebox">
										<label for="<?php 
                            bp_the_profile_field_input_name();
                            ?>
_day"><?php 
                            bp_the_profile_field_name();
                            ?>
 <?php 
                            if (bp_get_the_profile_field_is_required()) {
                                _e('', 'buddypress');
                            }
                            ?>
</label>
										<div id="<?php 
                            bp_the_profile_field_input_name();
                            ?>
_error" class="error"></div>

										<select name="<?php 
                            bp_the_profile_field_input_name();
                            ?>
_day" id="<?php 
                            bp_the_profile_field_input_name();
                            ?>
_day">
											<?php 
                            bp_the_profile_field_options('type=day');
                            ?>
										</select>

										<select name="<?php 
                            bp_the_profile_field_input_name();
                            ?>
_month" id="<?php 
                            bp_the_profile_field_input_name();
                            ?>
_month">
											<?php 
                            bp_the_profile_field_options('type=month');
                            ?>
										</select>

										<select name="<?php 
                            bp_the_profile_field_input_name();
                            ?>
_year" id="<?php 
                            bp_the_profile_field_input_name();
                            ?>
_year">
											<?php 
                            bp_the_profile_field_options('type=year');
                            ?>
										</select>
									</div>

								<?php 
                        }
                        ?>

								<?php 
                        do_action('bp_custom_profile_edit_fields');
                        ?>

								<p class="description"><?php 
                        bp_the_profile_field_description();
                        ?>
</p>

							</div>

						<?php 
                    }
                    ?>

						<input type="hidden" name="signup_profile_field_ids" id="signup_profile_field_ids" value="<?php 
                    bp_the_profile_group_field_ids();
                    ?>
" />

						<?php 
                }
            }
        }
        ?>

					</div><!-- #profile-details-section -->

					<?php 
        do_action('bp_after_signup_profile_fields');
        ?>


				<?php 
        if (bp_get_blog_signup_allowed()) {
            ?>

					<?php 
            do_action('bp_before_blog_details_fields');
            ?>

					<?php 
            /***** Blog Creation Details ******/
            ?>

					<div class="register-section clearfix" id="blog-details-section ">

						<div style="display:none" class="ctrlHolder">
						<p><input type="checkbox" name="signup_with_blog" id="signup_with_blog" value="1" checked="checked" /> <?php 
            _e('Yes, I\'d like to create a new site', 'buddypress');
            ?>
</p>
						</div>
                        <div style="clear:both"></div>
						<div id="blog-details">
							<div class="ctrlHolder fullwidth">
							<label for="signup_blog_url"><?php 
            _e('Choose Site Name', 'buddypress');
            ?>
 <?php 
            _e('', 'buddypress');
            ?>
</label>
							<div id="signup_blog_url_error" class="error"></div>

							<?php 
            if (is_subdomain_install()) {
                ?>
								<input  type="text" name="signup_blog_url" id="signup_blog_url" value="<?php 
                bp_signup_blog_url_value();
                ?>
" /> .<?php 
                bp_blogs_subdomain_base();
                ?>
							<?php 
            } else {
                ?>
								<?php 
                echo site_url();
                ?>
/ <input type="text" name="signup_blog_url" id="signup_blog_url" value="<?php 
                bp_signup_blog_url_value();
                ?>
" />
							<?php 
            }
            ?>
                            <br/><span class="help">Example: NewBusiness.webento.com</span>
							</div>
                            
                            <div style="clear:both"></div>
                            
                            <div class="ctrlHolder fullwidth">
							<label for="signup_blog_title"><?php 
            _e('Site Title', 'buddypress');
            ?>
 <?php 
            _e('', 'buddypress');
            ?>
</label>
							<div id="signup_blog_title_error" class="error"></div>
							<input type="text" name="signup_blog_title" id="signup_blog_title" value="<?php 
            bp_signup_blog_title_value();
            ?>
" />
                            <br/><span class="help">Example: New Business</span>
							</div>
                            
							<span style=" display: block;float: left;margin-left: 30px; color:#fff; background:none !important;" class="label"><?php 
            _e('I would like my site to appear in search engines, and in public listings around this network.', 'buddypress');
            ?>
:</span>
                            
							<div class="ctrlHolder">
							<div id="signup_blog_privacy_error" class="error"></div>
							<label style="display:inline-block; "><input type="radio" name="signup_blog_privacy" id="signup_blog_privacy_public" value="public"<?php 
            if ('public' == bp_get_signup_blog_privacy_value() || !bp_get_signup_blog_privacy_value()) {
                ?>
 checked="checked"<?php 
            }
            ?>
 /> <?php 
            _e('Yes', 'buddypress');
            ?>
</label>
							<label style="display:inline-block; margin-left:10px;"><input type="radio" name="signup_blog_privacy" id="signup_blog_privacy_private" value="private"<?php 
            if ('private' == bp_get_signup_blog_privacy_value()) {
                ?>
 checked="checked"<?php 
            }
            ?>
 /> <?php 
            _e('No', 'buddypress');
            ?>
</label>
                            </div>
							
                            <?php 
            do_action('bp_after_blog_details_fields');
            ?>
						</div>
						
					</div><!-- #blog-details-section -->
					
					

				<?php 
        }
        ?>

				<?php 
        do_action('bp_before_registration_submit_buttons');
        ?>

				<div class="submit">
					<input type="submit"  name="signup_submit" id="signup_submit" value="<?php 
        _e('Sign Up', 'buddypress');
        ?>
" />
                    <input type="hidden" value="bp_ajax_submit_register_form" name="action" />
				</div>

				<?php 
        do_action('bp_after_registration_submit_buttons');
        ?>

				<?php 
        wp_nonce_field('bp_new_signup');
        ?>

			<?php 
    }
    // request-details signup step
    ?>

			<?php 
    do_action('bp_custom_signup_steps');
    ?>

			</form>
<?php 
    $output = ob_get_clean();
    return $output;
}
function buatp_generate_fields($query = '')
{
    $html = '';
    ob_start();
    if (bp_has_profile($query)) {
        while (bp_profile_groups()) {
            bp_the_profile_group();
            while (bp_profile_fields()) {
                bp_the_profile_field();
                ?>
            <div class="editfield">

                    <?php 
                if ('textbox' == bp_get_the_profile_field_type()) {
                    ?>

                            <label for="<?php 
                    bp_the_profile_field_input_name();
                    ?>
"><?php 
                    bp_the_profile_field_name();
                    ?>
 <?php 
                    if (bp_get_the_profile_field_is_required()) {
                        _e('(required)', 'buddypress');
                    }
                    ?>
</label>
                            <?php 
                    do_action(bp_get_the_profile_field_errors_action());
                    ?>
                            <input type="text" name="<?php 
                    bp_the_profile_field_input_name();
                    ?>
" id="<?php 
                    bp_the_profile_field_input_name();
                    ?>
" value="<?php 
                    bp_the_profile_field_edit_value();
                    ?>
" />

                    <?php 
                }
                ?>

                    <?php 
                if ('textarea' == bp_get_the_profile_field_type()) {
                    ?>

                            <label for="<?php 
                    bp_the_profile_field_input_name();
                    ?>
"><?php 
                    bp_the_profile_field_name();
                    ?>
 <?php 
                    if (bp_get_the_profile_field_is_required()) {
                        _e('(required)', 'buddypress');
                    }
                    ?>
</label>
                            <?php 
                    do_action(bp_get_the_profile_field_errors_action());
                    ?>
                            <textarea rows="5" cols="40" name="<?php 
                    bp_the_profile_field_input_name();
                    ?>
" id="<?php 
                    bp_the_profile_field_input_name();
                    ?>
"><?php 
                    bp_the_profile_field_edit_value();
                    ?>
</textarea>

                    <?php 
                }
                ?>

                    <?php 
                if ('selectbox' == bp_get_the_profile_field_type()) {
                    ?>

                            <label for="<?php 
                    bp_the_profile_field_input_name();
                    ?>
"><?php 
                    bp_the_profile_field_name();
                    ?>
 <?php 
                    if (bp_get_the_profile_field_is_required()) {
                        _e('(required)', 'buddypress');
                    }
                    ?>
</label>
                            <?php 
                    do_action(bp_get_the_profile_field_errors_action());
                    ?>
                            <select name="<?php 
                    bp_the_profile_field_input_name();
                    ?>
" id="<?php 
                    bp_the_profile_field_input_name();
                    ?>
">
                                    <?php 
                    bp_the_profile_field_options();
                    ?>
                            </select>

                    <?php 
                }
                ?>

                    <?php 
                if ('multiselectbox' == bp_get_the_profile_field_type()) {
                    ?>

                            <label for="<?php 
                    bp_the_profile_field_input_name();
                    ?>
"><?php 
                    bp_the_profile_field_name();
                    ?>
 <?php 
                    if (bp_get_the_profile_field_is_required()) {
                        _e('(required)', 'buddypress');
                    }
                    ?>
</label>
                            <?php 
                    do_action(bp_get_the_profile_field_errors_action());
                    ?>
                            <select name="<?php 
                    bp_the_profile_field_input_name();
                    ?>
" id="<?php 
                    bp_the_profile_field_input_name();
                    ?>
" multiple="multiple">
                                    <?php 
                    bp_the_profile_field_options();
                    ?>
                            </select>

                    <?php 
                }
                ?>

                    <?php 
                if ('radio' == bp_get_the_profile_field_type()) {
                    ?>

                            <div class="radio">
                                    <span class="label"><?php 
                    bp_the_profile_field_name();
                    ?>
 <?php 
                    if (bp_get_the_profile_field_is_required()) {
                        _e('(required)', 'buddypress');
                    }
                    ?>
</span>

                                    <?php 
                    do_action(bp_get_the_profile_field_errors_action());
                    ?>
                                    <?php 
                    bp_the_profile_field_options();
                    ?>

                                    <?php 
                    if (!bp_get_the_profile_field_is_required()) {
                        ?>
                                            <a class="clear-value" href="javascript:clear( '<?php 
                        bp_the_profile_field_input_name();
                        ?>
' );"><?php 
                        _e('Clear', 'buddypress');
                        ?>
</a>
                                    <?php 
                    }
                    ?>
                            </div>

                    <?php 
                }
                ?>

                    <?php 
                if ('checkbox' == bp_get_the_profile_field_type()) {
                    ?>

                            <div class="checkbox">
                                    <span class="label"><?php 
                    bp_the_profile_field_name();
                    ?>
 <?php 
                    if (bp_get_the_profile_field_is_required()) {
                        _e('(required)', 'buddypress');
                    }
                    ?>
</span>

                                    <?php 
                    do_action(bp_get_the_profile_field_errors_action());
                    ?>
                                    <?php 
                    bp_the_profile_field_options();
                    ?>
                            </div>

                    <?php 
                }
                ?>

                    <?php 
                if ('datebox' == bp_get_the_profile_field_type()) {
                    ?>

                            <div class="datebox">
                                    <label for="<?php 
                    bp_the_profile_field_input_name();
                    ?>
_day"><?php 
                    bp_the_profile_field_name();
                    ?>
 <?php 
                    if (bp_get_the_profile_field_is_required()) {
                        _e('(required)', 'buddypress');
                    }
                    ?>
</label>
                                    <?php 
                    do_action(bp_get_the_profile_field_errors_action());
                    ?>

                                    <select name="<?php 
                    bp_the_profile_field_input_name();
                    ?>
_day" id="<?php 
                    bp_the_profile_field_input_name();
                    ?>
_day">
                                            <?php 
                    bp_the_profile_field_options('type=day');
                    ?>
                                    </select>

                                    <select name="<?php 
                    bp_the_profile_field_input_name();
                    ?>
_month" id="<?php 
                    bp_the_profile_field_input_name();
                    ?>
_month">
                                            <?php 
                    bp_the_profile_field_options('type=month');
                    ?>
                                    </select>

                                    <select name="<?php 
                    bp_the_profile_field_input_name();
                    ?>
_year" id="<?php 
                    bp_the_profile_field_input_name();
                    ?>
_year">
                                            <?php 
                    bp_the_profile_field_options('type=year');
                    ?>
                                    </select>
                            </div>

                    <?php 
                }
                ?>

                    <?php 
                do_action('bp_custom_profile_edit_fields_pre_visibility');
                ?>

                    <?php 
                if (bp_current_user_can('bp_xprofile_change_field_visibility')) {
                    ?>
                            <p class="field-visibility-settings-toggle" id="field-visibility-settings-toggle-<?php 
                    bp_the_profile_field_id();
                    ?>
">
                                    <?php 
                    printf(__('This field can be seen by: <span class="current-visibility-level">%s</span>', 'buddypress'), bp_get_the_profile_field_visibility_level_label());
                    ?>
 <a href="#" class="visibility-toggle-link"><?php 
                    _ex('Change', 'Change profile field visibility level', 'buddypress');
                    ?>
</a>
                            </p>

                            <div class="field-visibility-settings" id="field-visibility-settings-<?php 
                    bp_the_profile_field_id();
                    ?>
">
                                    <fieldset>
                                            <legend><?php 
                    _e('Who can see this field?', 'buddypress');
                    ?>
</legend>

                                            <?php 
                    bp_profile_visibility_radio_buttons();
                    ?>

                                    </fieldset>
                                    <a class="field-visibility-settings-close" href="#"><?php 
                    _e('Close', 'buddypress');
                    ?>
</a>

                            </div>
                    <?php 
                } else {
                    ?>
                            <p class="field-visibility-settings-notoggle" id="field-visibility-settings-toggle-<?php 
                    bp_the_profile_field_id();
                    ?>
">
                                    <?php 
                    printf(__('This field can be seen by: <span class="current-visibility-level">%s</span>', 'buddypress'), bp_get_the_profile_field_visibility_level_label());
                    ?>
                            </p>
                    <?php 
                }
                ?>

                    <?php 
                do_action('bp_custom_profile_edit_fields');
                ?>

                    <p class="description"><?php 
                bp_the_profile_field_description();
                ?>
</p>

            </div>
        
        <?php 
            }
        }
    }
    $html = ob_get_clean();
    return $html;
}
Exemplo n.º 11
0
 function rtmedia_api_process_bp_get_profile_request()
 {
     $this->rtmediajsonapifunction->rtmedia_api_verfiy_token();
     //Errors
     $ec_no_fields = 400001;
     $msg_no_fields = esc_html__('no profile found', 'buddypress-media');
     $ec_profile_fields = 400002;
     $msg_profile_fields = esc_html__('profile fields', 'buddypress-media');
     $profile_fields = array();
     $user_id = $loggedin_user_id = '';
     $user_id = filter_input(INPUT_POST, 'user_id', FILTER_SANITIZE_NUMBER_INT);
     $loggedin_user_id = filter_input(INPUT_POST, 'loggedin_user_id', FILTER_SANITIZE_NUMBER_INT);
     if (empty($user_id)) {
         $user_id = $this->user_id;
     } else {
         $loggedin_user_id = $this->user_id;
     }
     $user = get_userdata($user_id);
     if (empty($user)) {
         wp_send_json($this->rtmedia_api_response_object('TRUE', $ec_no_fields, $msg_no_fields));
     }
     $user_data = $this->rtmediajsonapifunction->rtmedia_api_user_data_from_id($user_id, 250, 250, 'full');
     $profile_fields['id'] = $user_id;
     $profile_fields['avatar']['src'] = esc_url($user_data['avatar']);
     $profile_fields['avatar']['width'] = 250;
     $profile_fields['avatar']['height'] = 250;
     if (bp_has_profile(array('user_id' => $user_id))) {
         while (bp_profile_groups()) {
             bp_the_profile_group();
             if (bp_profile_group_has_fields()) {
                 while (bp_profile_fields()) {
                     bp_the_profile_field();
                     if (bp_field_has_data()) {
                         $profile_fields['fields'][bp_get_the_profile_field_name()] = array('value' => strip_tags(bp_get_the_profile_field_value()), 'privacy' => bp_get_the_profile_field_visibility_level());
                     }
                 }
             }
         }
     } else {
         wp_send_json($this->rtmedia_api_response_object('FALSE', $ec_no_fields, $msg_no_fields));
     }
     //If followers plugin exists
     if (function_exists('rtmedia_api_followers')) {
         $followers = rtmedia_api_followers($user_id);
         $following = $this->rtmediajsonapifunction->rtmedia_api_following($user_id);
         foreach ($followers as $follower) {
             $follower_data = $this->rtmediajsonapifunction->rtmedia_api_user_data_from_id($follower, 66, 66);
             $profile_fields['follower'][] = array('id' => $follower, 'name' => $follower_data['name'], 'avatar' => $follower_data['avatar']);
         }
         foreach ($following as $follow) {
             $follow_data = $this->rtmediajsonapifunction->rtmedia_api_user_data_from_id($follow, 66, 66);
             $profile_fields['following'][] = array('id' => $follow, 'name' => $follow_data['name'], 'avatar' => $follow_data['avatar']);
         }
     }
     if (!empty($user_id) && intval($loggedin_user_id) !== intval($user_id)) {
         $args = array('leader_id' => $user_id, 'follower_id' => $loggedin_user_id);
         if (function_exists('bp_follow_is_following')) {
             $profile_fields['loggedin_user']['following'] = 'FALSE';
             if (bp_follow_is_following($args)) {
                 $profile_fields['loggedin_user']['following'] = 'TRUE';
             }
             $args = array('leader_id' => $loggedin_user_id, 'follower_id' => $user_id);
             $profile_fields['loggedin_user']['followed'] = 'FALSE';
             if (bp_follow_is_following($args)) {
                 $profile_fields['loggedin_user']['followed'] = 'TRUE';
             }
         }
     }
     wp_send_json($this->rtmedia_api_response_object('TRUE', $ec_profile_fields, $msg_profile_fields, $profile_fields));
 }
Exemplo n.º 12
0
    function bp_mtc_screen_two_content()
    {
        global $bp, $wpdb, $creds, $profile_template, $groups;
        ?>
    <p>Please select any tags that you would like to include in your followed content.</p>

<?php 
        if (bp_has_profile()) {
            while (bp_profile_groups()) {
                bp_the_profile_group();
                if ('mtc' == bp_get_the_profile_group_name()) {
                    ?>
<form action="<?php 
                    bp_the_profile_group_edit_form_action();
                    ?>
" method="post" id="profile-edit-form" class="standard-form <?php 
                    bp_the_profile_group_slug();
                    ?>
">


	   <?php 
                    while (bp_profile_fields()) {
                        bp_the_profile_field();
                        ?>

			<fieldset<?php 
                        bp_field_css_class('editfield');
                        ?>
>

        

					<div class="checkbox">
						<span class="label"><?php 
                        bp_the_profile_field_name();
                        ?>
 <?php 
                        if (bp_get_the_profile_field_is_required()) {
                            _e('(required)', 'buddypress');
                        }
                        ?>
</span>

						<?php 
                        bp_the_profile_field_options();
                        ?>
					</div>

				



				<?php 
                        do_action('bp_custom_profile_edit_fields');
                        ?>

				<p class="description"><?php 
                        bp_the_profile_field_description();
                        ?>
</p>
			</fieldset>

		 <?php 
                    }
                    ?>



	<div class="submit">
		<input type="submit" name="profile-group-edit-submit" id="profile-group-edit-submit" value="<?php 
                    _e('Save selection', 'buddypress');
                    ?>
 " />
	</div>

	<input type="hidden" name="field_ids" id="field_ids" value="<?php 
                    bp_the_profile_group_field_ids();
                    ?>
" />
	<?php 
                    wp_nonce_field('bp_xprofile_edit');
                    ?>

</form>
<?php 
                }
            }
        }
        ?>


  <?php 
        /* 
           if ( function_exists('xprofile_get_profile') ) : 
        	  if ( bp_has_profile() ) : 
        
        		  while ( bp_profile_groups() ) : bp_the_profile_group(); 
               print_r(bp_get_the_profile_group_name()); 
        
             endwhile; 
            endif; 
           
          endif; */
        ?>
  
  <?php 
    }
Exemplo n.º 13
0
        /**
         * Render the xprofile metabox for Community Profile screen.
         *
         * @access public
         * @since BuddyPress (2.0.0)
         *
         * @param WP_User $user The WP_User object for the user being edited.
         */
        public function user_admin_profile_metaboxes($user = null, $args = array())
        {
            if (empty($user->ID)) {
                return;
            }
            $r = bp_parse_args($args['args'], array('profile_group_id' => 0, 'user_id' => $user->ID), 'bp_xprofile_user_admin_profile_loop_args');
            // We really need these args
            if (empty($r['profile_group_id']) || empty($r['user_id'])) {
                return;
            }
            if (bp_has_profile($r)) {
                while (bp_profile_groups()) {
                    bp_the_profile_group();
                    ?>
				<input type="hidden" name="field_ids[]" id="<?php 
                    echo esc_attr('field_ids_' . bp_get_the_profile_group_slug());
                    ?>
" value="<?php 
                    echo esc_attr(bp_get_the_profile_group_field_ids());
                    ?>
" />

				<?php 
                    if (bp_get_the_profile_group_description()) {
                        ?>
					<p class="description"><?php 
                        bp_the_profile_group_description();
                        ?>
</p>
				<?php 
                    }
                    while (bp_profile_fields()) {
                        bp_the_profile_field();
                        ?>

					<div<?php 
                        bp_field_css_class('bp-profile-field');
                        ?>
>
						<?php 
                        $field_type = bp_xprofile_create_field_type(bp_get_the_profile_field_type());
                        $field_type->edit_field_html(array('user_id' => $r['user_id']));
                        if (bp_get_the_profile_field_description()) {
                            ?>
							<p class="description"><?php 
                            bp_the_profile_field_description();
                            ?>
</p>
						<?php 
                        }
                        do_action('bp_custom_profile_edit_fields_pre_visibility');
                        $can_change_visibility = bp_current_user_can('bp_xprofile_change_field_visibility');
                        ?>

						<p class="field-visibility-settings-<?php 
                        echo $can_change_visibility ? 'toggle' : 'notoggle';
                        ?>
" id="field-visibility-settings-toggle-<?php 
                        bp_the_profile_field_id();
                        ?>
">
							<?php 
                        printf(__('This field can be seen by: <span class="%s">%s</span>', 'buddypress'), esc_attr('current-visibility-level'), bp_get_the_profile_field_visibility_level_label());
                        if ($can_change_visibility) {
                            ?>
								 <a href="#" class="button visibility-toggle-link"><?php 
                            _e('Change', 'buddypress');
                            ?>
</a>
							<?php 
                        }
                        ?>
						</p>

						<?php 
                        if ($can_change_visibility) {
                            ?>
							<div class="field-visibility-settings" id="field-visibility-settings-<?php 
                            bp_the_profile_field_id();
                            ?>
">
								<fieldset>
									<legend><?php 
                            _e('Who can see this field?', 'buddypress');
                            ?>
</legend>
									<?php 
                            bp_profile_visibility_radio_buttons();
                            ?>
								</fieldset>
								<a class="button field-visibility-settings-close" href="#"><?php 
                            _e('Close', 'buddypress');
                            ?>
</a>
							</div>
						<?php 
                        }
                        do_action('bp_custom_profile_edit_fields');
                        ?>
					</div>

				<?php 
                    }
                    // bp_profile_fields()
                }
                // bp_profile_groups()
            }
        }
Exemplo n.º 14
0
 public function evaluate($user_id, $from_time)
 {
     global $wpdb, $bp, $creds;
     $questionsAsked = 0;
     $questionsAnswered = 0;
     $requiredAsked = 0;
     $RequiredAnswered = 0;
     if (function_exists('xprofile_get_profile')) {
         if (bp_has_profile('user_id=' . $bp->loggedin_user->id)) {
             while (bp_profile_groups()) {
                 bp_the_profile_group();
                 while (bp_profile_fields()) {
                     bp_the_profile_field();
                     $questionsAsked++;
                     if (bp_get_the_profile_field_is_required()) {
                         $requiredAsked++;
                     }
                     if (bp_field_has_data()) {
                         if (bp_get_the_profile_field_is_required()) {
                             $requiredAnswered++;
                         }
                         $questionsAnswered++;
                     }
                 }
             }
         }
     }
     if ($questionsAnswered >= ($questionsAsked - 2) / $questionsAsked) {
         return True;
     } else {
         return False;
     }
 }
function wsl_component_buddypress_setup_profile_mapping()
{
    $assets_base_url = WORDPRESS_SOCIAL_LOGIN_PLUGIN_URL . 'assets/img/';
    $wsl_settings_buddypress_enable_mapping = get_option('wsl_settings_buddypress_enable_mapping');
    $wsl_settings_buddypress_xprofile_map = get_option('wsl_settings_buddypress_xprofile_map');
    # http://hybridauth.sourceforge.net/userguide/Profile_Data_User_Profile.html
    $ha_profile_fields = array(array('field' => 'provider', 'label' => _wsl__("Provider name", 'wordpress-social-login'), 'description' => _wsl__("The the provider or social network name the user used to connected", 'wordpress-social-login')), array('field' => 'identifier', 'label' => _wsl__("Provider user Identifier", 'wordpress-social-login'), 'description' => _wsl__("The Unique user's ID on the connected provider. Depending on the provider, this field can be an number, Email, URL, etc", 'wordpress-social-login')), array('field' => 'profileURL', 'label' => _wsl__("Profile URL", 'wordpress-social-login'), 'description' => _wsl__("Link to the user profile on the provider web site", 'wordpress-social-login')), array('field' => 'webSiteURL', 'label' => _wsl__("Website URL", 'wordpress-social-login'), 'description' => _wsl__("User website, blog or web page", 'wordpress-social-login')), array('field' => 'photoURL', 'label' => _wsl__("Photo URL", 'wordpress-social-login'), 'description' => _wsl__("Link to user picture or avatar on the provider web site", 'wordpress-social-login')), array('field' => 'displayName', 'label' => _wsl__("Display name", 'wordpress-social-login'), 'description' => _wsl__("User Display name. If not provided by social network, WSL will return a concatenation of the user first and last name", 'wordpress-social-login')), array('field' => 'description', 'label' => _wsl__("Description", 'wordpress-social-login'), 'description' => _wsl__("A short about me", 'wordpress-social-login')), array('field' => 'firstName', 'label' => _wsl__("First name", 'wordpress-social-login'), 'description' => _wsl__("User's first name", 'wordpress-social-login')), array('field' => 'lastName', 'label' => _wsl__("Last name", 'wordpress-social-login'), 'description' => _wsl__("User's last name", 'wordpress-social-login')), array('field' => 'gender', 'label' => _wsl__("Gender", 'wordpress-social-login'), 'description' => _wsl__("User's gender. Values are 'female', 'male' or blank", 'wordpress-social-login')), array('field' => 'language', 'label' => _wsl__("Language", 'wordpress-social-login'), 'description' => _wsl__("User's language", 'wordpress-social-login')), array('field' => 'age', 'label' => _wsl__("Age", 'wordpress-social-login'), 'description' => _wsl__("User' age. Note that WSL do not calculate this field. We return it as it was provided", 'wordpress-social-login')), array('field' => 'birthDay', 'label' => _wsl__("Birth day", 'wordpress-social-login'), 'description' => _wsl__("The day in the month in which the person was born. Not to confuse it with 'Birth date'", 'wordpress-social-login')), array('field' => 'birthMonth', 'label' => _wsl__("Birth month", 'wordpress-social-login'), 'description' => _wsl__("The month in which the person was born", 'wordpress-social-login')), array('field' => 'birthYear', 'label' => _wsl__("Birth year", 'wordpress-social-login'), 'description' => _wsl__("The year in which the person was born", 'wordpress-social-login')), array('field' => 'birthDate', 'label' => _wsl__("Birth date", 'wordpress-social-login'), 'description' => _wsl__("Complete birthday in which the person was born. Format: YYYY-MM-DD", 'wordpress-social-login')), array('field' => 'email', 'label' => _wsl__("Email", 'wordpress-social-login'), 'description' => _wsl__("User's email address. Not all of provider grant access to the user email", 'wordpress-social-login')), array('field' => 'phone', 'label' => _wsl__("Phone", 'wordpress-social-login'), 'description' => _wsl__("User's phone number", 'wordpress-social-login')), array('field' => 'address', 'label' => _wsl__("Address", 'wordpress-social-login'), 'description' => _wsl__("User's address", 'wordpress-social-login')), array('field' => 'country', 'label' => _wsl__("Country", 'wordpress-social-login'), 'description' => _wsl__("User's country", 'wordpress-social-login')), array('field' => 'region', 'label' => _wsl__("Region", 'wordpress-social-login'), 'description' => _wsl__("User's state or region", 'wordpress-social-login')), array('field' => 'city', 'label' => _wsl__("City", 'wordpress-social-login'), 'description' => _wsl__("User's city", 'wordpress-social-login')), array('field' => 'zip', 'label' => _wsl__("Zip", 'wordpress-social-login'), 'description' => _wsl__("User's zipcode", 'wordpress-social-login')));
    ?>
<div class="stuffbox">
	<h3>
		<label><?php 
    _wsl_e("Profile mappings", 'wordpress-social-login');
    ?>
</label>
	</h3>
	<div class="inside">
		<p>
			<?php 
    _wsl_e("When <b>Profile mapping</b> is enabled, WSL will try to automatically fill in Buddypress users profiles from their social networks profiles", 'wordpress-social-login');
    ?>
.
		</p>

		<p>
			<b><?php 
    _wsl_e('Notes', 'wordpress-social-login');
    ?>
:</b>
		</p>

		<p class="description">
			1. <?php 
    _wsl_e('<b>Profile mapping</b> will only work for new users. Profile mapping for returning users will implemented in future version of WSL', 'wordpress-social-login');
    ?>
.
			<br />
			2. <?php 
    _wsl_e('Not all the mapped fields will be filled. Some providers and social networks do not give away many information about their users', 'wordpress-social-login');
    ?>
.
			<br />
			3. <?php 
    _wsl_e('WSL can only map <b>Single Fields</b>. Supported fields types are: Multi-line Text Areax, Text Box, URL, Date Selector and Number', 'wordpress-social-login');
    ?>
.
		</p>

		<table width="100%" border="0" cellpadding="5" cellspacing="2" style="border-top:1px solid #ccc;">
		  <tr>
			<td width="200" align="right"><strong><?php 
    _wsl_e("Enable profile mapping", 'wordpress-social-login');
    ?>
 :</strong></td>
			<td>
				<select name="wsl_settings_buddypress_enable_mapping" id="wsl_settings_buddypress_enable_mapping" style="width:100px" onChange="toggleMapDiv();">
					<option <?php 
    if ($wsl_settings_buddypress_enable_mapping == 1) {
        echo "selected";
    }
    ?>
 value="1"><?php 
    _wsl_e("Yes", 'wordpress-social-login');
    ?>
</option>
					<option <?php 
    if ($wsl_settings_buddypress_enable_mapping == 2) {
        echo "selected";
    }
    ?>
 value="2"><?php 
    _wsl_e("No", 'wordpress-social-login');
    ?>
</option>
				</select>
			</td>
		  </tr>
		</table>
		<br>
	</div>
</div>

<div id="xprofilemapdiv" class="stuffbox" style="<?php 
    if ($wsl_settings_buddypress_enable_mapping == 2) {
        echo "display:none;";
    }
    ?>
">
	<h3>
		<label><?php 
    _wsl_e("Fields Map", 'wordpress-social-login');
    ?>
</label>
	</h3>

	<div class="inside">
		<p>
			<?php 
    _wsl_e("Here you can create a new map by placing WSL users profiles fields to the appropriate destination fields", 'wordpress-social-login');
    ?>
.
			<?php 
    _wsl_e('The left column shows the available <b>WSL users profiles fields</b>: These select boxes are called <b>source</b> fields', 'wordpress-social-login');
    ?>
.
			<?php 
    _wsl_e('The right column shows the list of <b>Buddypress profiles fields</b>: Those are the <b>destination</b> fields', 'wordpress-social-login');
    ?>
.
			<?php 
    _wsl_e('If you don\'t want to map a particular Buddypress field, then leave the source for that field blank', 'wordpress-social-login');
    ?>
.
		</p>

		<hr />

		<?php 
    if (bp_has_profile()) {
        while (bp_profile_groups()) {
            global $group;
            bp_the_profile_group();
            ?>
						<h4><?php 
            echo sprintf(_wsl__("Fields Group '%s'", 'wordpress-social-login'), $group->name);
            ?>
 :</h4>

						<table width="100%" border="0" cellpadding="5" cellspacing="2" style="border-top:1px solid #ccc;">
							<?php 
            while (bp_profile_fields()) {
                global $field;
                bp_the_profile_field();
                ?>
										<tr>
											<td width="270" align="right" valign="top">
												<?php 
                $map = isset($wsl_settings_buddypress_xprofile_map[$field->id]) ? $wsl_settings_buddypress_xprofile_map[$field->id] : 0;
                $can_map_it = true;
                if (!in_array($field->type, array('textarea', 'textbox', 'url', 'datebox', 'number'))) {
                    $can_map_it = false;
                }
                ?>
												<select name="wsl_settings_buddypress_xprofile_map[<?php 
                echo $field->id;
                ?>
]" style="width:255px" id="bb_profile_mapping_selector_<?php 
                echo $field->id;
                ?>
" onChange="showMappingConfirm( <?php 
                echo $field->id;
                ?>
 );" <?php 
                if (!$can_map_it) {
                    echo "disabled";
                }
                ?>
>
													<option value=""></option>
													<?php 
                if ($can_map_it) {
                    foreach ($ha_profile_fields as $item) {
                        ?>
																<option value="<?php 
                        echo $item['field'];
                        ?>
" <?php 
                        if ($item['field'] == $map) {
                            echo "selected";
                        }
                        ?>
 ><?php 
                        echo $item['label'];
                        ?>
</option>
															<?php 
                    }
                }
                ?>
												</select>
											</td>
											<td valign="top" align="center" width="50">
												<img src="<?php 
                echo $assets_base_url;
                ?>
arr_right.png" />
											</td>
											<td valign="top">
												<strong><?php 
                echo $field->name;
                ?>
</strong>
												<?php 
                if (!$can_map_it) {
                    ?>
														<p class="description">
															<?php 
                    _wsl_e("<b>WSL</b> can not map this field. Supported field types are: <em>Multi-line Text Areax, Text Box, URL, Date Selector and Number</em>", 'wordpress-social-login');
                    ?>
.
														</p>
													<?php 
                } else {
                    ?>
														<?php 
                    foreach ($ha_profile_fields as $item) {
                        ?>
															<p class="description bb_profile_mapping_confirm_<?php 
                        echo $field->id;
                        ?>
" style="margin-left:0;<?php 
                        if ($item['field'] != $map) {
                            echo "display:none;";
                        }
                        ?>
" id="bb_profile_mapping_confirm_<?php 
                        echo $field->id;
                        ?>
_<?php 
                        echo $item['field'];
                        ?>
">
																<?php 
                        echo sprintf(_wsl__("WSL <b>%s</b> is mapped to Buddypress <b>%s</b> field", 'wordpress-social-login'), $item['label'], $field->name);
                        ?>
.
																<br />
																<em><b><?php 
                        echo $item['label'];
                        ?>
:</b> <?php 
                        echo $item['description'];
                        ?>
.</em>
															</p>
														<?php 
                    }
                    ?>
													<?php 
                }
                ?>
											</td>
										</tr>
									<?php 
            }
            ?>
						</table>
					<?php 
        }
    }
    ?>
	</div>
</div>
<script>
	function toggleMapDiv(){
		if(typeof jQuery=="undefined"){
			alert( "Error: WordPress Social Login require jQuery to be installed on your wordpress in order to work!" );

			return false;
		}

		var em = jQuery( "#wsl_settings_buddypress_enable_mapping" ).val();

		if( em == 2 ) jQuery( "#xprofilemapdiv" ).hide();
		else jQuery( "#xprofilemapdiv" ).show();
	}

	function showMappingConfirm( field ){
		if(typeof jQuery=="undefined"){
			alert( "Error: WordPress Social Login require jQuery to be installed on your wordpress in order to work!" );

			return false;
		}

		var el = jQuery( "#bb_profile_mapping_selector_" + field ).val();

		jQuery( ".bb_profile_mapping_confirm_" + field ).hide();

		jQuery( "#bb_profile_mapping_confirm_" + field + "_" + el ).show();
	}
</script>
<?php 
}
function bps_get_fields()
{
    global $group, $field;
    static $groups = array();
    static $fields = array();
    if (count($groups)) {
        return array($groups, $fields);
    }
    if (!function_exists('bp_has_profile')) {
        printf('<p class="bps_error">' . __('%s: The BuddyPress Extended Profiles component is not active.', 'bp-profile-search') . '</p>', '<strong>BP Profile Search ' . BPS_VERSION . '</strong>');
        return array($groups, $fields);
    }
    $args = array('hide_empty_fields' => false, 'member_type' => bp_get_member_types());
    if (bp_has_profile($args)) {
        while (bp_profile_groups()) {
            bp_the_profile_group();
            $group->name = str_replace('&amp;', '&', stripslashes($group->name));
            $groups[$group->name] = array();
            while (bp_profile_fields()) {
                bp_the_profile_field();
                $field->name = str_replace('&amp;', '&', stripslashes($field->name));
                $field->description = str_replace('&amp;', '&', stripslashes($field->description));
                $groups[$group->name][] = array('id' => $field->id, 'name' => $field->name);
                $fields[$field->id] = $field;
            }
        }
    }
    list($groups, $fields) = apply_filters('bps_get_fields', array($groups, $fields));
    return array($groups, $fields);
}
Exemplo n.º 17
0
        ?>
</h4>

						<?php 
        /* Use the profile field loop to render input fields for the 'base' profile field group */
        ?>
						<?php 
        if (bp_is_active('xprofile')) {
            if (bp_has_profile('profile_group_id=1')) {
                while (bp_profile_groups()) {
                    bp_the_profile_group();
                    ?>

						<?php 
                    while (bp_profile_fields()) {
                        bp_the_profile_field();
                        ?>

							<div class="editfield">

								<?php 
                        if ('textbox' == bp_get_the_profile_field_type()) {
                            ?>

									<label for="<?php 
                            bp_the_profile_field_input_name();
                            ?>
"><?php 
                            bp_the_profile_field_name();
                            ?>
 <?php 
function buddyboss_customizer_xprofile_field_choices()
{
    $options = array();
    if (function_exists('bp_is_active')) {
        if (bp_is_active('xprofile') && bp_has_profile(array('user_id' => bp_loggedin_user_id()))) {
            while (bp_profile_groups()) {
                bp_the_profile_group();
                if (bp_profile_group_has_fields()) {
                    while (bp_profile_fields()) {
                        bp_the_profile_field();
                        $options[bp_get_the_profile_field_id()] = bp_get_the_profile_field_name();
                    }
                }
            }
        }
    }
    return $options;
}