/**
  * @param $display_extra
  * @param $user
  *
  * @return string
  */
 public static function get_profile_outputs($display_extra, $user)
 {
     $out = '';
     foreach ($display_extra as $name) {
         $args = array('field' => str_replace('_', ' ', str_replace('bp_', '', $name)), 'user_id' => $user->user_id);
         //   $out .=   bp_get_profile_field_data( $args  );
         $profile_field_data = bp_get_profile_field_data($args);
         $css = false == $profile_field_data ? $name . ' aa_missing' : $name;
         $out .= sprintf(apply_filters('aa_user_display_extra_template', '<div class="extra %s">%s</div>', $args, $profile_field_data), $css, $profile_field_data);
         //$out .=  '<div class="extra '. $name . '">' . $profile_field_data . '</div>';
     }
     return $out;
 }
function bppp_get_user_progression_for_field()
{
    //get current item
    $point_item = BuddyPress_Profile_Progression()->query->point;
    $field_id = $point_item['args']['field-id'];
    if (!$field_id) {
        return false;
    }
    //get field value
    $user_id = bppp_get_user_id($user_id);
    $value = bp_get_profile_field_data(array('field' => $field_id, 'user_id' => $user_id));
    return (bool) $value;
    //return TRUE
}
Exemple #3
0
function post_love_display($content)
{
    $love_text = '';
    if (bp_loggedin_user_id()) {
        $love = bp_get_profile_field_data('field=handshake&user_id=' . bp_loggedin_user_id());
        $lovemaking = explode(',', $love);
        $love = empty($love) ? 0 : $love;
        if (in_array(bp_displayed_user_id(), $lovemaking)) {
            $past_wink_class = ' ok';
            $past_wink = 'ed';
        } else {
            $past_wink_class = '';
            $past_wink = '';
        }
        echo '<div class="generic-button' . $past_wink_class . '" id="love-count-' . bp_displayed_user_id() . '" >';
        echo '<a class="wink-button" href="' . admin_url('admin-ajax.php?action=post_love_add_love&user_id=' . bp_loggedin_user_id() . '&matchid=' . bp_displayed_user_id()) . '" data-id="' . bp_loggedin_user_id() . '" data-matchid="' . bp_displayed_user_id() . '">Court<span>' . $past_wink . '</span></a>';
        echo '</div>';
    }
}
 function wplms_coauthor_plus_instructor($instructor, $id)
 {
     if (function_exists('get_coauthors')) {
         $coauthors = get_coauthors($id);
         $instructor = '';
         foreach ($coauthors as $k => $inst) {
             $instructor_id = $inst->ID;
             $displayname = bp_core_get_user_displayname($instructor_id);
             if (function_exists('vibe_get_option')) {
                 $field = vibe_get_option('instructor_field');
             }
             $special = '';
             if (bp_is_active('xprofile')) {
                 $special = bp_get_profile_field_data('field=' . $field . '&user_id=' . $instructor_id);
             }
             $r = array('item_id' => $instructor_id, 'object' => 'user');
             $instructor .= '<div class="instructor_course"><div class="item-avatar">' . bp_core_fetch_avatar($r) . '</div>';
             $instructor .= '<h5 class="course_instructor"><a href="' . bp_core_get_user_domain($instructor_id) . '">' . $displayname . '<span>' . $special . '</span></a></h5>';
             $instructor .= apply_filters('wplms_instructor_meta', '', $instructor_id);
             $instructor .= '</div>';
         }
     }
     return $instructor;
 }
 /**
  * Maps users ID to actual address by querying
  * the address xprofile field.
  */
 private function _get_user_address($user_id)
 {
     if (!function_exists('bp_get_profile_field_data')) {
         return false;
     }
     $address_field = $this->_get_options('address_field');
     if (!$address_field) {
         return false;
     }
     $address = bp_get_profile_field_data(array('field' => $address_field, 'user_id' => $user_id));
     // Allows using multiple Xprofile fields for address construction.
     $address = apply_filters('agm_google_maps-bp_profile_map-user_address', $address, $user_id);
     return $address ? $address : false;
 }
Exemple #6
0
</span>

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

	<div id="item-meta">

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

			<div id="latest-update">
				<?php 
    if (bp_is_active('xprofile')) {
        $bio = bp_get_profile_field_data(array('user_id' => bp_displayed_user_id(), 'field' => 5));
        echo $bio;
    }
    ?>
			</div>

		<?php 
}
?>

		<div id="item-buttons">

			<?php 
do_action('bp_member_header_actions');
?>
 /** @see WP_Widget::widget */
 public function widget($args, $instance)
 {
     extract($args);
     if (!isset($instance['title'])) {
         $instance = array('title' => '', 'tw_show_follow' => FALSE, 'tw_show_type' => 0, 'tw_screen_name' => '', 'tw_include_rts' => FALSE, 'tw_exclude_replies' => FALSE, 'tw_tweet_count' => 5, 'tw_rotation_type' => 'scrollUp', 'tw_official_format' => FALSE, 'tw_hide_meta_timestamp' => FALSE, 'tw_hide_meta_screen_name' => FALSE, 'tw_hide_meta_via' => FALSE, 'tw_show_meta_reply_retweet_favorite' => FALSE);
     }
     $title = apply_filters('widget_title', $instance['title']);
     $positive_variables = array('screen_name', 'shorten_links', 'include_rts', 'exclude_replies', 'links_in_new_window', 'tweet_count', 'show_follow', 'timeout', 'rotation_type', 'show_meta_reply_retweet_favorite', 'official_format', 'show_type', 'list_tag', 'search');
     $newargs['displaytype'] = 'widget';
     $newargs['w3tc_render_to'] = $args['widget_id'];
     foreach ($positive_variables as $var) {
         if (isset($instance['tw_' . $var])) {
             $newargs[$var] = $instance['tw_' . $var];
         }
     }
     $negative_variables = array('meta_timestamp', 'meta_screen_name', 'meta_via');
     foreach ($negative_variables as $var) {
         if (isset($instance['tw_hide_' . $var])) {
             $newargs['show_' . $var] = !$instance['tw_hide_' . $var];
         }
     }
     switch ($newargs['show_follow']) {
         case 2:
             $newargs['no_show_count'] = TRUE;
             $newargs['no_show_screen_name'] = FALSE;
             break;
         case 3:
             $newargs['no_show_count'] = FALSE;
             $newargs['no_show_screen_name'] = TRUE;
             break;
         case 4:
             $newargs['no_show_count'] = TRUE;
             $newargs['no_show_screen_name'] = TRUE;
             break;
         default:
             $newargs['no_show_count'] = FALSE;
             $newargs['no_show_screen_name'] = FALSE;
             break;
     }
     if (empty($newargs['timeout'])) {
         $newargs['timeout'] = 4000;
     }
     $newargs['text_cache_id'] = "rt-wg-" . md5(serialize($newargs));
     $rt_tweet_string = rotatingtweets_get_transient($newargs['text_cache_id']);
     echo $before_widget;
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     if (empty($rt_tweet_string)) {
         switch ($newargs['show_type']) {
             // Favourites
             case 1:
                 $tweets = rotatingtweets_get_tweets($newargs['screen_name'], $newargs['include_rts'], $newargs['exclude_replies'], true);
                 break;
                 // Search
             // Search
             case 2:
                 $tweets = rotatingtweets_get_tweets($newargs['screen_name'], $newargs['include_rts'], $newargs['exclude_replies'], false, $newargs['search']);
                 //				$newargs['screen_name'] = '';   // Originally put in to avoid confusion when people have a 'follow' button and a search tweet
                 break;
                 // List
             // List
             case 3:
                 $tweets = rotatingtweets_get_tweets($newargs['screen_name'], $newargs['include_rts'], $newargs['exclude_replies'], false, false, $newargs['list_tag']);
                 break;
                 // Buddypress
             // Buddypress
             case 4:
                 if (function_exists('bp_displayed_user_id')) {
                     global $bp;
                     $rt_buddyid = bp_displayed_user_id();
                     $rt_buddyargs = array('field' => 'Twitter', 'user_id' => $rt_buddyid);
                     print_r($rt_buddyargs);
                     $rt_buddytwitter = bp_get_profile_field_data($rt_buddyargs);
                     $tweets = rotatingtweets_get_tweets($rt_buddytwitter, $newargs['include_rts'], $newargs['exclude_replies']);
                     break;
                 }
                 // User name
             // User name
             case 0:
             default:
                 $tweets = rotatingtweets_get_tweets($newargs['screen_name'], $newargs['include_rts'], $newargs['exclude_replies']);
                 break;
         }
         if ($tweets) {
             $rt_tweet_string = rotating_tweets_display($tweets, $newargs, false);
         }
     } elseif (WP_DEBUG) {
         $rt_tweet_string .= "<!-- Transient " . $newargs['text_cache_id'] . " loaded -->";
     }
     echo $rt_tweet_string . $after_widget;
 }
                    <div class="basic">
                        <h1><?php 
echo bp_get_displayed_user_fullname();
?>
</h1><span class="sep"><?php 
_e(', ', 'social-learner');
?>
</span>
                        <h2 class="user-nicename">@<?php 
bp_displayed_user_username();
?>
</h2>
						<?php 
$address_field = boss_get_option('boss_misc_profile_field_address');
if ($address_field) {
    $address = bp_get_profile_field_data(array('field' => $address_field));
    if ($address) {
        if (is_array($address)) {
            ?>
                                <span class="location"><?php 
            echo join(', ', $address);
            ?>
</span>
                                <?php 
        } else {
            ?>
								<span class="location"><?php 
            echo stripslashes($address);
            ?>
</span>
								<?php 
                                                                  setTimeout(function(){
                                                                	  hypercommentsAPI.initById(<?php 
                echo $hypercomments_id;
                ?>
);
                                                                  }, 10);                                                        
                                                              } else{
                                                            	  hypercommentsAPI.initById(<?php 
                echo $hypercomments_id;
                ?>
);
                                                              }
                                                        	</script>
                                                <?php 
            } else {
                $cityName = bp_get_profile_field_data(array('field' => 'Город', 'user_id' => $current_user->ID));
                $defaultChatParam = '&label=rt.kbb1.com.' . $course_space . '&name_text=' . $current_user->display_name . '&from_text=' . $cityName;
                echo '<iframe src="https://chat1.kbb1.com/?lang=ru' . $defaultChatParam . '"></iframe>';
            }
            ?>
                                                </div>
                                                <div id="tabiid2" class="tab-content" style="display: none;">
                                                    <div class="bx-controls-direction"><a id="bx-prev" href=""></a><a
                                                            id="bx-next" href=""></a></div>
                                                    <ul id="tabiid2slide">
                                                        <?php 
            echo do_shortcode(get_post_meta($course_id, 'materials', true));
            ?>
                                                    </ul>
                                                    <script>
                                                        (function ($) {
Exemple #10
0
 function fetch_assignment_submissions()
 {
     if (!isset($_POST['security']) || !wp_verify_nonce($_POST['security'], 'assignment_submissions')) {
         _e('Security check Failed. Contact Administrator.', 'vibe');
         die;
     }
     $assignments_id = $_POST['assignment_id'];
     print_r($assignment_id);
     global $wpdb;
     foreach ($assignments_id as $assignment_id) {
         if ($_POST['status'] == 1) {
             $assignment_submissions[] = $wpdb->get_results($wpdb->prepare("SELECT meta_key,post_id FROM {$wpdb->postmeta} WHERE meta_value > '0' && post_id = %d", $assignment_id), ARRAY_A);
             // Internal Query
         } else {
             $assignment_submissions[] = $wpdb->get_results($wpdb->prepare("SELECT meta_key,post_id FROM {$wpdb->postmeta} WHERE meta_value = '0' && post_id = %d", $assignment_id), ARRAY_A);
             // Internal Query
         }
     }
     if ($assignment_submissions) {
         echo '<ul class="assignment_students">';
         foreach ($assignment_submissions as $assignmentar_submission) {
             foreach ($assignmentar_submission as $assignment_submission) {
                 if (is_numeric($assignment_submission['meta_key'])) {
                     $member_id = $assignment_submission['meta_key'];
                     $assignment_id = $assignment_submission['post_id'];
                     $bp_name = bp_core_get_userlink($member_id);
                     if (!isset($student_field)) {
                         $student_field = 'Location';
                     }
                     $profile_data = 'field=' . $student_field . '&user_id=' . $member_id;
                     $bp_location = '';
                     if (bp_is_active('xprofile')) {
                         $bp_location = bp_get_profile_field_data($profile_data);
                     }
                     echo '<li id="as' . $member_id . '">';
                     echo get_avatar($member_id);
                     echo '<h6>' . $bp_name . '</h6>';
                     echo '<h7>' . get_the_title($assignment_id) . '</h7>';
                     echo '<span>';
                     if ($bp_location) {
                         echo $bp_location;
                     }
                     do_action('wplms_assignment_submission_meta', $member_id, $assignment_id);
                     echo '</span>';
                     // PENDING AJAX SUBMISSIONS
                     echo '<ul> 
                     <li><a class="tip reset_assignment_user" data-assignment="' . $assignment_id . '" data-user="******" title="' . __('Reset Assignment for User', 'vibe') . '"><i class="icon-reload"></i></a></li>
                     <li><a class="tip evaluate_assignment_user" data-assignment="' . $assignment_id . '" data-user="******" title="' . __('Evaluate Assignment : ', 'vibe') . get_the_title($assignment_id) . '"><i class="icon-check-clipboard-1"></i></a></li>
                   </ul>';
                     echo '</li>';
                 }
             }
         }
         echo '</ul>';
     }
     wp_nonce_field('vibe_assignment', 'asecurity');
     die;
 }
Exemple #11
0
function amt_bp_get_profile_field_data($internal_profile_property, $user_id, $xprofile_field_map, $xprofile_public_fields)
{
    foreach ($xprofile_field_map[$internal_profile_property] as $field_name) {
        $field_value = bp_get_profile_field_data(array('field' => $field_name, 'user_id' => $user_id));
        // profile_group_id
        if (!empty($field_value) && in_array(xprofile_get_field_id_from_name($field_name), $xprofile_public_fields)) {
            return $field_value;
        }
    }
    return '';
}
</h3>
<?php 
$students_undertaking = bp_course_get_students_undertaking();
//vibe_sanitize(get_post_meta(get_the_ID(),'vibe_students_undertaking',false));
if (count($students_undertaking) > 0) {
    echo '<ul class="course_students">';
    foreach ($students_undertaking as $student) {
        if (function_exists('bp_get_profile_field_data')) {
            $bp_name = bp_core_get_userlink($student);
            $sfield = vibe_get_option('student_field');
            if (!isset($sfield) || $sfield == '') {
                $sfield = 'Location';
            }
            $bp_location = '';
            if (bp_is_active('xprofile')) {
                $bp_location = bp_get_profile_field_data('field=' . $sfield . '&user_id=' . $student);
            }
            if ($bp_name) {
                echo '<li>';
                echo get_avatar($student);
                echo '<h6>' . $bp_name . '</h6>';
                if ($bp_location) {
                    echo '<span>' . $bp_location . '</span>';
                }
                echo '</li>';
            }
        }
    }
    echo '</ul>';
    echo bp_course_paginate_students_undertaking();
}
Exemple #13
0
						<a href="<?php 
            echo bp_core_get_user_domain($instructor_id);
            ?>
"><?php 
            echo $displayname;
            ?>
<span><?php 
            echo $special;
            ?>
</span></a>
						</h5>
						<?php 
            echo apply_filters('wplms_instructor_meta', '', $instructor_id);
            $instructor_about = vibe_get_option('instructor_about');
            if (bp_is_active('xprofile')) {
                $data = apply_filters('the_content', bp_get_profile_field_data('field=' . $instructor_about . '&user_id=' . $instructor_id));
                echo '<div class="instructor_more">' . $data . '<a class="more_description link" data-default="' . __('Show Less', 'wplms_modern') . '">' . __('Show More', 'wplms_modern') . '</a></div>';
            }
            ?>
					</div>
						<?php 
        }
        the_course_details();
        ?>
				</div>
				<div class="students_undertaking">
					<?php 
        $students_undertaking = $vibe->get_students_undertaking(array('number' => 9));
        $students = get_post_meta(get_the_ID(), 'vibe_students', true);
        echo '<strong>' . $students . __(' STUDENTS ENROLLED', 'wplms_modern') . '</strong>';
        echo '<ul>';
 function vibe_certificate_student_field($atts, $content = null)
 {
     extract(shortcode_atts(array('field' => ''), $atts));
     $uid = $_GET['u'];
     if (isset($uid) && is_numeric($uid) && isset($field) && strlen($field) > 3) {
         return bp_get_profile_field_data('field=' . $field . '&user_id=' . $uid);
     } else {
         return '[certificate_student_field]';
     }
 }
Exemple #15
0
        if ($role == 'student') {
            $field = vibe_get_option('student_field');
            if (!isset($field) || $field == '') {
                $field = 'Location';
            }
            if (bp_is_active('xprofile')) {
                echo '<span>' . bp_get_profile_field_data(array('user_id' => $user_id, 'field' => $field)) . '</span>';
            }
        } else {
            if ($role == 'instructor') {
                $field = vibe_get_option('instructor_field');
                if (!isset($field) || $field == '') {
                    $field = 'Expertise';
                }
                if (bp_is_active('xprofile')) {
                    echo '<span>' . bp_get_profile_field_data(array('user_id' => $user_id, 'field' => $field)) . '</span>';
                }
            }
        }
        $members_activity = vibe_get_option('members_activity');
        if (isset($members_activity) && $members_activity) {
            ?>
					<?php 
            if (bp_get_member_latest_update()) {
                ?>

						<span class="update"> <?php 
                bp_member_latest_update();
                ?>
</span>
$members_submit_course = $wpdb->get_results("select meta_key from {$wpdb->postmeta} where meta_value = '2' && post_id = {$course_id}", ARRAY_A);
// Internal Query
if (count($members_submit_course)) {
    echo '<ul class="course_students">';
    foreach ($members_submit_course as $submit_course) {
        if (is_numeric($submit_course['meta_key'])) {
            $member_id = $submit_course['meta_key'];
            $bp_name = bp_core_get_userlink($member_id);
            if (isset($student_field)) {
                $profile_data = 'field=' . $student_field . '&user_id=' . $member_id;
            } else {
                $profile_data = 'user_id=' . $member_id;
            }
            $bp_location = '';
            if (bp_is_active('xprofile')) {
                $bp_location = bp_get_profile_field_data($profile_data);
            }
            echo '<li id="s' . $member_id . '">';
            echo get_avatar($member_id);
            echo '<h6>' . $bp_name . '</h6>';
            if ($bp_location) {
                echo '<span>' . $bp_location . '</span>';
            }
            // PENDING AJAX SUBMISSIONS
            echo '<ul> 
	    		<li><a class="tip evaluate_course_user" data-course="' . $course_id . '" data-user="******" title="' . __('Evaluate Course for User', 'vibe') . '"><i class="icon-check-clipboard-1"></i></a></li>
	    	  </ul>';
            echo '</li>';
        }
    }
    echo '</ul>';
Exemple #17
0
                			<?php 
echo bp_core_fetch_avatar(array('item_id' => $curauth->data->ID, 'type' => 'full', 'html' => true));
?>
                		</div>
                	</div>
                    <div class="col-md-6">
                    	<div class="about_instructor">
	                    	<?php 
echo '<h1>' . $curauth->display_name . '</h1>';
if (bp_is_active('xprofile')) {
    echo '<h3>' . bp_get_profile_field_data('field=' . $ifield . '&user_id=' . $curauth->data->ID) . '</h3>';
}
?>
		                    <?php 
if (bp_is_active('xprofile')) {
    echo '<div class="instructor_bio">' . bp_get_profile_field_data('field=' . $bio . '&user_id=' . $curauth->data->ID) . '</div>';
}
?>
	                    </div>
                    </div>
                    <div class="col-md-3">
                    	<ul class="instructor_stats">
                    		<li><span class="dashicons dashicons-groups"></span><strong><?php 
echo $vibe->get_instructor_student_count($curauth->data->ID);
?>
</strong>
                    		<label><?php 
_e('# Students in Courses', 'wplms_modern');
?>
</label></li>
                    		<li><?php 
function bp_profile_field_data($args = '')
{
    echo bp_get_profile_field_data($args);
}
function bp_course_get_instructor_description($args = NULL)
{
    $defaults = array('instructor_id' => get_the_author_meta('ID'), 'field' => 'About');
    $r = wp_parse_args($args, $defaults);
    extract($r, EXTR_SKIP);
    if (function_exists('vibe_get_option')) {
        $field = vibe_get_option('instructor_about');
    }
    $desc = '';
    if (bp_is_active('xprofile')) {
        $desc = bp_get_profile_field_data('field=' . $field . '&user_id=' . $instructor_id);
    }
    return apply_filters('the_content', $desc);
}
 function fetch_course_submissions()
 {
     if (!isset($_POST['security']) || !wp_verify_nonce($_POST['security'], 'pending_course_submissions') || !is_numeric($_POST['course_id'])) {
         _e('Security check Failed. Contact Administrator.', 'vibe');
         die;
     }
     $course_id = $_POST['course_id'];
     global $wpdb;
     $student_field = vibe_get_option('student_field');
     if ($_POST['status'] == 4) {
         $members_submit_course = $wpdb->get_results($wpdb->prepare("SELECT user_id as meta_key FROM {$wpdb->usermeta} where meta_key = %s AND meta_value = %d", 'course_status' . $course_id, 4), ARRAY_A);
         // Internal Query
     } else {
         $members_submit_course = $wpdb->get_results($wpdb->prepare("SELECT user_id as meta_key FROM {$wpdb->usermeta} where meta_key = %s AND meta_value = %d", 'course_status' . $course_id, 3), ARRAY_A);
         // Internal Query
     }
     if (!empty($members_submit_course)) {
         echo '<ul class="course_students">';
         foreach ($members_submit_course as $submit_course) {
             if (is_numeric($submit_course['meta_key'])) {
                 $member_id = $submit_course['meta_key'];
                 $bp_name = bp_core_get_userlink($member_id);
                 if (isset($student_field)) {
                     $profile_data = 'field=' . $student_field . '&user_id=' . $member_id;
                 } else {
                     $profile_data = 'user_id=' . $member_id;
                 }
                 $bp_location = '';
                 if (bp_is_active('xprofile')) {
                     $bp_location = bp_get_profile_field_data($profile_data);
                 }
                 echo '<li id="s' . $member_id . '">';
                 echo get_avatar($member_id);
                 echo '<h6>' . $bp_name . '</h6>';
                 echo '<span>';
                 if ($bp_location) {
                     echo $bp_location;
                 }
                 do_action('wplms_course_submission_meta', $member_id, $course_id);
                 echo '</span>';
                 echo '<ul> 
               <li><a class="tip evaluate_course_user" data-course="' . $course_id . '" data-user="******" title="' . __('Evaluate Course for User', 'vibe') . '"><i class="icon-check-clipboard-1"></i></a></li>
               </ul>';
                 echo '</li>';
             }
         }
         echo '</ul>';
         wp_nonce_field($course_id, 'security');
         ?>
       <script>
         jQuery(document).ready(function($){
           $('#course').trigger('loaded');
         });
       </script>
       <?php 
     } else {
         echo '<div class="message">' . _x('No course submissions !', 'No course submissions found in Course - Admin - submissions seciton', 'vibe') . '</div>';
     }
     die;
 }
        public function edit_field_html(array $raw_properties = array())
        {
            if (isset($raw_properties['user_id'])) {
                unset($raw_properties['user_id']);
            }
            $html = $this->get_edit_field_html_elements(array_merge(array('type' => 'file', 'accept' => 'image/*'), $raw_properties));
            $uploads = wp_upload_dir();
            // Label.
            $label = sprintf('<label for="%s">%s%s</label>', bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required() ? esc_html('(required)', 'buddypress') : '');
            // Input file.
            $input = sprintf('<input type="hidden" name="%1$s" id="%1$s" value="%2$s" /><input %3$s />', bp_get_the_profile_field_input_name(), bp_get_the_profile_field_edit_value() != '' && bp_get_the_profile_field_edit_value() != '-' ? bp_get_the_profile_field_edit_value() : '-', $html);
            // Actual image.
            if (bp_get_the_profile_field_edit_value() != '' && bp_get_the_profile_field_edit_value() != '-') {
                $actual_image = sprintf('<img src="%1$s" alt="%2$s" /><label for="%2$s_deleteimg"><input type="checkbox" name="%2$s_deleteimg" id="%2$s_deleteimg" value="1" /> %3$s</label><input type="hidden" name="%2$s_hiddenimg" id="%2$s_hiddenimg" value="%4$s" />', $uploads['baseurl'] . bp_get_the_profile_field_edit_value(), bp_get_the_profile_field_input_name(), __('Check this to delete this image', 'bxcft'), bp_get_the_profile_field_edit_value());
            } elseif (bp_get_profile_field_data(array('field' => bp_get_the_profile_field_id())) != '' && bp_get_profile_field_data(array('field' => bp_get_the_profile_field_id())) != '-') {
                $actual_image = sprintf('%1$s<label for="%2$s_deleteimg"><input type="checkbox" name="%2$s_deleteimg" id="%2$s_deleteimg" value="1" /> %3$s</label><input type="hidden" name="%2$s_hiddenimg" id="%2$s_hiddenimg" value="%4$s" />', strip_tags(bp_get_profile_field_data(array('field' => bp_get_the_profile_field_id()))), bp_get_the_profile_field_input_name(), __('Check this to delete this image', 'bxcft'), isset($_POST['field_' . bp_get_the_profile_field_id() . '_hiddenimg']) ? $_POST['field_' . bp_get_the_profile_field_id() . '_hiddenimg'] : '');
            } else {
                $actual_image = '';
            }
            echo apply_filters('bxcft_field_label', $label, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_name(), bp_get_the_profile_field_is_required());
            do_action(bp_get_the_profile_field_errors_action());
            echo apply_filters('bxcft_field_input', $input, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_is_required());
            echo apply_filters('bxcft_field_actual_image', $actual_image, bp_get_the_profile_field_id(), bp_get_the_profile_field_type(), bp_get_the_profile_field_input_name(), bp_get_the_profile_field_edit_value());
            ?>
            <script type="text/javascript">
                if (jQuery('#profile-edit-form').length > 0) {
                    jQuery('#profile-edit-form').attr('enctype', 'multipart/form-data');
                }
                if (jQuery('#your-profile').length > 0) {
                    jQuery('#your-profile').attr('enctype', 'multipart/form-data');
                }
            <?php 
            if (bp_get_the_profile_field_edit_value() != '' && bp_get_the_profile_field_edit_value() != '-') {
                ?>
                jQuery('#field_<?php 
                echo bp_get_the_profile_field_id();
                ?>
_deleteimg').change(function() {
                    if (jQuery(this).is(':checked') && jQuery('input#field_<?php 
                echo bp_get_the_profile_field_id();
                ?>
[type=file]').val() === '') {
                        jQuery('input#field_<?php 
                echo bp_get_the_profile_field_id();
                ?>
[type=hidden]').val('');
                    } else {
                        jQuery('input#field_<?php 
                echo bp_get_the_profile_field_id();
                ?>
[type=hidden]').val('<?php 
                echo bp_get_the_profile_field_edit_value();
                ?>
');
                    }
                });
            <?php 
            }
            ?>
                jQuery('input#field_<?php 
            echo bp_get_the_profile_field_id();
            ?>
[type=file]').change(function() {
                    if (jQuery(this).val() !== '') {
                        jQuery('input#field_<?php 
            echo bp_get_the_profile_field_id();
            ?>
[type=hidden]').val('-');
                    } else {
                        jQuery('input#field_<?php 
            echo bp_get_the_profile_field_id();
            ?>
[type=hidden]').val('');
                    }
                });
            </script>
        <?php 
        }
bp_displayed_user_link();
?>
"><?php 
bp_displayed_user_fullname();
?>
</a>
	</h3>
	<div class="location">
	<?php 
$user_id = bp_displayed_user_id();
$field = vibe_get_option('student_field');
if (!isset($field) || $field == '') {
    $field = 'Location';
}
if (bp_is_active('xprofile')) {
    echo bp_get_profile_field_data(array('user_id' => $user_id, 'field' => $field));
}
?>
	</div>
	<?php 
$members_activity = vibe_get_option('members_activity');
if (isset($members_activity) && $members_activity) {
    //Hiding Activity
    if (bp_is_active('activity') && bp_activity_do_mentions()) {
        ?>
		<span class="user-nicename">@<?php 
        bp_displayed_user_mentionname();
        ?>
</span>
	<?php 
    }
Exemple #23
0
function getthongtingiangvien()
{
    $author_id = get_post_field('post_author', get_the_ID());
    $user_info = get_userdata($author_id);
    $arg = array('field' => 'Học vị', 'user_id' => $author_id);
    $arglylich = array('field' => 'LÝ LỊCH CÁ NHÂN', 'user_id' => $author_id);
    $argthanhtich = array('field' => 'MỘT SỐ THÀNH TÍCH NỔI BẬT', 'user_id' => $author_id);
    $argcongtac = array('field' => 'TIỂU SỬ CÔNG TÁC', 'user_id' => $author_id);
    $argbaocao = array('field' => 'BÁO CÁO KHOA HỌC', 'user_id' => $author_id);
    echo '<div class="row">';
    echo '<div class="col-md-2 col-sm-2">';
    echo '<a href="' . bp_core_get_user_domain($author_id) . '">';
    echo get_avatar($author_id, 100);
    echo '</a>';
    echo '</div>';
    echo '<div class="col-md-10 col-sm-10">';
    echo '<a href="' . bp_core_get_user_domain($author_id) . '">';
    echo $user_info->nickname;
    echo wpautop(bp_get_profile_field_data($arg));
    echo '</a>';
    //    echo '<div class="bio row">';
    echo '<table class="profile-fields">';
    echo '<tbody>';
    echo '<tr class="field_7 field_ly-lich-ca-nhan optional-field visibility-public field_type_textarea">';
    echo '<td class="label">LÝ LỊCH CÁ NHÂN</td>';
    echo '<td class="data">';
    echo wpautop(bp_get_profile_field_data($arglylich));
    echo '</td>';
    echo '</tr>';
    echo '<tr class="field_6 field_mot-so-thanh-tich-noi-bat optional-field visibility-public alt field_type_textarea">';
    echo '<td class="label">MỘT SỐ THÀNH TÍCH NỔI BẬT</td>';
    echo '<td class="data">';
    echo wpautop(bp_get_profile_field_data($argthanhtich));
    echo '</td>';
    echo '</tr>';
    echo '<tr class="field_3 field_tieu-su-cong-tac optional-field visibility-public field_type_textarea">';
    echo '<td class="label">TIỂU SỬ CÔNG TÁC</td>';
    echo '<td class="data">';
    echo wpautop(bp_get_profile_field_data($argcongtac));
    echo '</td>';
    echo '</tr>';
    echo '<tr class="field_8 field_bao-cao-khoa-hoc optional-field visibility-public alt field_type_textarea">';
    echo '<td class="label">BÁO CÁO KHOA HỌC</td>';
    echo '<td class="data">';
    echo wpautop(bp_get_profile_field_data($argbaocao));
    echo '</td>';
    echo '</tr>';
    echo '</tbody>';
    echo '</table>';
    echo '</div>';
    echo '</div>';
}
 function json_bp_rebuild_profile_map()
 {
     if (!class_exists('Agm_Bp_Pm_UserPages')) {
         die(-1);
     }
     global $wpdb;
     header('Content-type: application/json');
     $sql = "SELECT DISTINCT ID FROM {$wpdb->users} WHERE ID NOT IN (SELECT DISTINCT ID FROM {$wpdb->users} as user, {$wpdb->usermeta} as meta WHERE user.ID=meta.user_id AND meta_key='agm-bp-profile_maps-location') LIMIT 1";
     $user_id = (int) $wpdb->get_var($sql);
     $model = new AgmMapModel();
     $opts = apply_filters('agm_google_maps-options-bp_profile_maps', get_option('agm_google_maps'));
     $address = bp_get_profile_field_data(array('field' => @$opts['bp_profile_maps-address_field'], 'user_id' => $user_id));
     // Skip this guy
     if (!$address) {
         die(json_encode(array('user_id' => $user_id)));
     }
     $location = $model->_address_to_marker($address);
     if ($location) {
         $location['body'] = Agm_Bp_Pm_UserPages::get_location_body($user_id, $address);
     }
     update_user_meta($user_id, 'agm-bp-profile_maps-location', $location);
     die(json_encode(array('user_id' => $user_id)));
 }
 /**
  * @ticket BP7351
  */
 public function test_empty_datebox_fields_should_not_return_unix_epoch()
 {
     $user = $this->factory->user->create(array('role' => 'subscriber'));
     $group = $this->factory->xprofile_group->create();
     $field = $this->factory->xprofile_field->create(array('field_group_id' => $group, 'type' => 'datebox'));
     $old_user = get_current_user_id();
     $this->set_current_user($user);
     $value = bp_get_profile_field_data(array('user_id' => $user, 'field' => $field));
     $this->assertEmpty($value);
     $this->set_current_user($old_user);
 }
Exemple #26
0
 /** @see WP_Widget::widget -- do not rename this */
 function widget($args, $instance)
 {
     extract($args);
     //Our variables from the widget settings.
     $title = apply_filters('widget_title', $instance['title']);
     $num = $instance['number'];
     $width = $instance['width'];
     echo '<div class="' . $width . '"><div class="dash-widget ' . ($title ? '' : 'notitle') . '">' . $before_widget;
     echo '<div class="news_block">';
     global $wpdb;
     $user_id = get_current_user_id();
     $user_courses = $wpdb->get_results($wpdb->prepare("\n        SELECT posts.ID as ID\n          FROM {$wpdb->posts} AS posts\n          LEFT JOIN {$wpdb->postmeta} AS rel ON posts.ID = rel.post_id\n          WHERE   posts.post_type   = 'course'\n        AND   posts.post_status   = 'publish'\n        AND   rel.meta_key   = %s\n      ", $user_id));
     $course_ids = array();
     if (isset($user_courses) && is_array($user_courses)) {
         foreach ($user_courses as $course) {
             $course_ids[] = $course->ID;
         }
     }
     if (!isset($course_ids) || !is_array($course_ids)) {
         $course_ids = array();
     }
     $query_args = apply_filters('wplms-dashboard-news_filter', array('post_type' => 'news', 'post_per_page' => $num, 'post_status' => 'publish', 'meta_query' => array(array('meta_key' => 'vibe_news_course', 'compare' => 'IN', 'value' => $course_ids, 'type' => 'numeric'))));
     $the_query = new WP_Query($query_args);
     //print_r($the_query);
     switch ($width) {
         case 'col-md-12':
             $size = 'full';
             break;
         case 'col-md-6 col-sm-12':
             $size = 'medium';
             break;
         case 'col-md-8 col-sm-12':
         case 'col-md-9 col-sm-12':
             $size = 'big';
             break;
         default:
             $size = 'small';
             break;
     }
     if (function_exists('vibe_get_option')) {
         $instructor_field = vibe_get_option('instructor_field');
     }
     if ($the_query->have_posts()) {
         echo '
       <ul class="dash-news slides">';
         while ($the_query->have_posts()) {
             $the_query->the_post();
             $format = get_post_format(get_the_ID());
             if (!isset($format) || !$format) {
                 $format = 'standard';
             }
             $post_author = get_the_author_meta('ID');
             $displayname = bp_core_get_user_displayname($post_author);
             $special = '';
             echo $field;
             if (bp_is_active('xprofile')) {
                 $special = bp_get_profile_field_data('field=' . $instructor_field . '&user_id=' . $post_author);
             }
             echo '<li>';
             switch ($format) {
                 case 'aside':
                     echo get_the_post_thumbnail($post->ID, $size);
                     echo '<div class="' . $format . '-block">';
                     the_content();
                     echo '<div class="news_author">' . bp_core_fetch_avatar(array('item_id' => $post_author, 'type' => 'thumb')) . '
         <h5><a href="' . bp_core_get_user_domain($post_author) . '">' . $displayname . '<span>' . $special . '</span></a></h5>
         <ul>' . get_the_term_list($post->ID, 'news-tag', '<li>', '</li><li>', '</li>') . '</ul>
         </div>';
                     echo '</div>';
                     break;
                 case 'image':
                     echo get_the_post_thumbnail($post->ID, $size);
                     echo '<div class="' . $format . '-block"><h4>' . get_the_title() . '</h4>';
                     the_content();
                     echo '<div class="news_author">' . bp_core_fetch_avatar(array('item_id' => $post_author, 'type' => 'thumb')) . '
         <h5><a href="' . bp_core_get_user_domain($post_author) . '">' . $displayname . '<span>' . $special . '</span></a></h5>
         <ul>' . get_the_term_list($post->ID, 'news-tag', '<li>', '</li><li>', '</li>') . '</ul>
         </div>';
                     echo '</div>';
                     break;
                 case 'chat':
                     echo '<div class="' . $format . '-block">';
                     the_content();
                     echo '<a href="' . get_comments_link() . '" class="chat_comments">';
                     comments_number('0', '1', '%');
                     echo '<i class="icon-bubble"></i></a>';
                     echo '<div class="news_author">' . bp_core_fetch_avatar(array('item_id' => $post_author, 'type' => 'thumb')) . '
         <h5><a href="' . bp_core_get_user_domain($post_author) . '">' . $displayname . '<span>' . $special . '</span></a></h5>
         <ul>' . get_the_term_list($post->ID, 'news-tag', '<li>', '</li><li>', '</li>') . '</ul>
         </div>';
                     echo '</div>';
                     break;
                 case 'quote':
                 case 'status':
                 case 'gallery':
                 case 'audio':
                 case 'video':
                     echo '<div class="' . $format . '-block">';
                     the_content();
                     echo '<div class="news_author">' . bp_core_fetch_avatar(array('item_id' => $post_author, 'type' => 'thumb')) . '
         <h5><a href="' . bp_core_get_user_domain($post_author) . '">' . $displayname . '<span>' . $special . '</span></a></h5>
         <ul>' . get_the_term_list($post->ID, 'news-tag', '<li>', '</li><li>', '</li>') . '</ul>
         </div>';
                     echo '</div>';
                     break;
                 default:
                     echo '<div class="' . $format . '-block">
               <h3 class="heading">' . get_the_title() . '</h3>';
                     echo '<div class="news_thumb">' . get_the_post_thumbnail() . '</div>';
                     the_content();
                     echo '<div class="news_author">' . bp_core_fetch_avatar(array('item_id' => $post_author, 'type' => 'thumb')) . '
         <h5><a href="' . bp_core_get_user_domain($post_author) . '">' . $displayname . '<span>' . $special . '</span></a></h5>
         <ul>' . get_the_term_list($post->ID, 'news-tag', '<li>', '</li><li>', '</li>') . '</ul>
         </div>';
                     echo '</div>';
                     break;
             }
             echo '</li>';
         }
         echo '</ul>';
         echo '<a href="' . get_post_type_archive_link('news') . '" target="_blank" class="small button ' . ($title ? 'withtitle' : '') . '"><i class="icon-plus-1"></i></a>';
     } else {
         echo '<ul class="dash-news slides">';
         echo '<li><div class="error-block">' . __('No news for you !', 'wplms-dashboard') . '</div></li>';
         echo '</ul>';
     }
     wp_reset_postdata();
     if (current_user_can('edit_posts')) {
         echo '<a href="' . admin_url('post-new.php?post_type=news') . '" target="_blank" class="small button add_news' . ($title ? 'withtitle' : '') . '"><i class="icon-file-add"></i></a>';
     }
     echo '</div>' . $after_widget . '</div></div>';
 }
<section id="content">
    <div class="container">
        <div class="row">
            <div class="content padding_adjusted">
                <?php 
if (isset($instructors) && is_array($instructors) && count($instructors)) {
    foreach ($instructors as $instructor) {
        ?>
			             	<div class="col-md-4 col-sm-4 clear3">
			             		<div class="instructor">
									<?php 
        echo bp_core_fetch_avatar(array('item_id' => $instructor, 'type' => 'full', 'html' => true));
        ?>
									<span><?php 
        if (bp_is_active('xprofile')) {
            echo bp_get_profile_field_data('field=' . $ifield . '&user_id=' . $instructor);
        }
        ?>
</span>
									<h3><?php 
        echo bp_core_get_userlink($instructor);
        ?>
</h3>
									<strong><a href="<?php 
        echo get_author_posts_url($instructor) . 'instructing-courses/';
        ?>
"><?php 
        _e('Courses by Instructor ', 'wplms_modern');
        echo '<span>' . count_user_posts_by_type($instructor, 'course') . '</span></a>';
        ?>
</strong>
Exemple #28
0
     foreach ($course_curriculum as $item) {
         if (isset($item)) {
             $dem1++;
         }
     }
 }
 //lấy số lượng học viên
 $amount_student = get_post_meta($course_id, "vibe_students", true);
 $instructor_id = get_the_author_meta('ID');
 //lấy tên giảng viên
 $instructor_name = bp_core_get_user_displayname($instructor_id);
 //lấy giá khóa học
 $price_course = get_post_meta($course_id, "vibe_mycred_points", true) . ".000 VNĐ";
 //lấy chức vụ giảng viên
 $field = vibe_get_option('instructor_field');
 $special = bp_get_profile_field_data('field=' . $field . '&user_id=' . $instructor_id);
 //lấy đánh giá
 $reviews = get_post_meta(get_the_ID(), 'average_rating', true);
 $count = get_post_meta(get_the_ID(), 'rating_count', true);
 //lấy hình giảng viên
 $avatar_instructor = get_avatar($instructor_id);
 $regex = '/(^.*src="|" w.*$)/';
 $avatar_instructor = preg_replace($regex, '', $avatar_instructor);
 $avatar_link = bp_core_get_user_domain($instructor_id);
 //lấy link khóa học
 $link_course = get_permalink($course_id);
 //lấy số lượng video khóa học
 $total_time = tongthoigianvideokhoahoc($course_id);
 $content = array("title" => $course_title, "img" => $course_avatar, "amount_students" => $amount_student, "name_instructor" => $instructor_name, "price_course" => $price_course, "special" => $special, "reviews" => $reviews, "reviews_count" => $count, "avatar" => $avatar_instructor, "link_course" => $link_course, "total_time" => "{$total_time}", "total_video" => "{$dem1}", "link_user" => $avatar_link);
 $JSon = json_encode($content);
 if ($wp_query->post_count == $dem) {
Exemple #29
-1
/**
 * Prepare the metadata sent to Fedora and Solr from $_POST input.
 *
 * @param array $nextPids Array of fedora pids.
 * @return array metadata content
 */
function prepare_metadata($nextPids)
{
    global $fedora_api;
    /**
     * Prepare the metadata to be sent to Fedora and Solr.
     */
    $metadata = array();
    $metadata['id'] = $nextPids[0];
    $metadata['pid'] = $nextPids[0];
    $metadata['creator'] = 'HumCORE';
    $metadata['title'] = wp_strip_all_tags(stripslashes($_POST['deposit-title-unchanged']));
    $metadata['title_unchanged'] = wp_kses(stripslashes($_POST['deposit-title-unchanged']), array('b' => array(), 'em' => array(), 'strong' => array()));
    $metadata['abstract'] = wp_strip_all_tags(stripslashes($_POST['deposit-abstract-unchanged']));
    $metadata['abstract_unchanged'] = wp_kses(stripslashes($_POST['deposit-abstract-unchanged']), array('b' => array(), 'em' => array(), 'strong' => array()));
    $metadata['genre'] = sanitize_text_field($_POST['deposit-genre']);
    $metadata['committee_deposit'] = sanitize_text_field($_POST['deposit-on-behalf-flag']);
    $metadata['committee_id'] = sanitize_text_field($_POST['deposit-committee']);
    $metadata['submitter'] = bp_loggedin_user_id();
    /**
     * Get committee or author metadata.
     */
    if ('yes' === $metadata['committee_deposit']) {
        $committee = groups_get_group(array('group_id' => $metadata['committee_id']));
        $metadata['organization'] = 'MLA';
        $metadata['authors'][] = array('fullname' => $committee->name, 'given' => '', 'family' => '', 'uni' => $committee->slug, 'role' => 'creator', 'affiliation' => 'MLA');
    } else {
        $user_id = bp_loggedin_user_id();
        $user_firstname = get_the_author_meta('first_name', $user_id);
        $user_lastname = get_the_author_meta('last_name', $user_id);
        $user_affiliation = bp_get_profile_field_data(array('field' => 2, 'user_id' => $user_id));
        $metadata['organization'] = $user_affiliation;
        $metadata['authors'][] = array('fullname' => bp_get_loggedin_user_fullname(), 'given' => $user_firstname, 'family' => $user_lastname, 'uni' => bp_get_loggedin_user_username(), 'role' => 'author', 'affiliation' => $user_affiliation);
    }
    if ((empty($metadata['committee_deposit']) || 'yes' !== $metadata['committee_deposit']) && (!empty($_POST['deposit-other-authors-first-name']) && !empty($_POST['deposit-other-authors-last-name']))) {
        $other_authors = array_map(function ($first_name, $last_name) {
            return array('first_name' => sanitize_text_field($first_name), 'last_name' => sanitize_text_field($last_name));
        }, $_POST['deposit-other-authors-first-name'], $_POST['deposit-other-authors-last-name']);
        foreach ($other_authors as $author_array) {
            if (!empty($author_array['first_name']) && !empty($author_array['last_name'])) {
                $mla_user = bp_activity_find_mentions($author_array['first_name'] . $author_array['last_name']);
                if (!empty($mla_user)) {
                    foreach ($mla_user as $mla_userid => $mla_username) {
                        break;
                    }
                    // Only one, right?
                    $author_name = bp_core_get_user_displayname($mla_userid);
                    $author_firstname = get_the_author_meta('first_name', $mla_userid);
                    $author_lastname = get_the_author_meta('last_name', $mla_userid);
                    $author_affiliation = bp_get_profile_field_data(array('field' => 2, 'user_id' => $mla_userid));
                    $author_uni = $mla_username;
                } else {
                    $author_firstname = $author_array['first_name'];
                    $author_lastname = $author_array['last_name'];
                    $author_name = trim($author_firstname . ' ' . $author_lastname);
                    $author_uni = '';
                    $author_affiliation = '';
                }
                $metadata['authors'][] = array('fullname' => $author_name, 'given' => $author_firstname, 'family' => $author_lastname, 'uni' => $author_uni, 'role' => 'author', 'affiliation' => $author_affiliation);
            }
        }
    }
    usort($metadata['authors'], function ($a, $b) {
        return strcasecmp($a['family'], $b['family']);
    });
    /**
     * Format author info for solr.
     */
    $metadata['author_info'] = humcore_deposits_format_author_info($metadata['authors']);
    if (!empty($metadata['genre']) && in_array($metadata['genre'], array('Dissertation', 'Technical Report', 'Thesis')) && !empty($_POST['deposit-institution'])) {
        $metadata['institution'] = sanitize_text_field($_POST['deposit-institution']);
    } else {
        if (!empty($metadata['genre']) && in_array($metadata['genre'], array('Dissertation', 'Technical Report', 'Thesis')) && empty($_POST['deposit-institution'])) {
            $metadata['institution'] = $metadata['organization'];
        }
    }
    if (!empty($metadata['genre']) && ('Conference proceeding' == $metadata['genre'] || 'Conference paper' == $metadata['genre']) && !empty($_POST['deposit-conference-title'])) {
        $metadata['conference_title'] = sanitize_text_field($_POST['deposit-conference-title']);
        $metadata['conference_organization'] = sanitize_text_field($_POST['deposit-organization']);
    }
    $metadata['group'] = array();
    if (!empty($_POST['deposit-group'])) {
        foreach ($_POST['deposit-group'] as $group_id) {
            $group = groups_get_group(array('group_id' => sanitize_text_field($group_id)));
            $metadata['group'][] = $group->name;
            $metadata['group_ids'][] = $group_id;
        }
    }
    $metadata['subject'] = array();
    if (!empty($_POST['deposit-subject'])) {
        foreach ($_POST['deposit-subject'] as $subject) {
            $metadata['subject'][] = sanitize_text_field(stripslashes($subject));
            // Subject ids will be set later.
        }
    }
    $metadata['keyword'] = array();
    if (!empty($_POST['deposit-keyword'])) {
        foreach ($_POST['deposit-keyword'] as $keyword) {
            $metadata['keyword'][] = sanitize_text_field(stripslashes($keyword));
            // Keyword ids will be set later.
        }
    }
    $metadata['type_of_resource'] = sanitize_text_field($_POST['deposit-resource-type']);
    $metadata['language'] = 'English';
    $metadata['notes'] = sanitize_text_field(stripslashes($_POST['deposit-notes-unchanged']));
    // Where do they go in MODS?
    $metadata['notes_unchanged'] = wp_kses(stripslashes($_POST['deposit-notes-unchanged']), array('b' => array(), 'em' => array(), 'strong' => array()));
    $metadata['type_of_license'] = sanitize_text_field($_POST['deposit-license-type']);
    $metadata['record_content_source'] = 'HumCORE';
    $metadata['record_creation_date'] = gmdate('Y-m-d\\TH:i:s\\Z');
    $metadata['member_of'] = $fedora_api->collectionPid;
    if (!empty($_POST['deposit-publication-type'])) {
        $metadata['publication-type'] = sanitize_text_field($_POST['deposit-publication-type']);
        // Not stored in solr.
    } else {
        $metadata['publication-type'] = 'none';
    }
    if ('journal-article' == $metadata['publication-type']) {
        $metadata['publisher'] = sanitize_text_field($_POST['deposit-journal-publisher']);
        $metadata['date'] = sanitize_text_field($_POST['deposit-journal-publish-date']);
        if (!empty($metadata['date'])) {
            $temp_date = preg_replace('~^(winter(?:/|)|spring(?:/|)|summer(?:/|)|fall(?:/|)|autumn(?:/|))+\\s(\\d{4})$~i', 'Jan $2', $metadata['date']);
            $metadata['date_issued'] = date('Y', strtotime(preg_replace('/^(\\d{4})$/', 'Jan $1', $temp_date)));
        } else {
            $metadata['date_issued'] = date('Y', strtotime('today'));
        }
        $metadata['book_journal_title'] = sanitize_text_field($_POST['deposit-journal-title']);
        $metadata['volume'] = sanitize_text_field($_POST['deposit-journal-volume']);
        $metadata['issue'] = sanitize_text_field($_POST['deposit-journal-issue']);
        $metadata['start_page'] = sanitize_text_field($_POST['deposit-journal-start-page']);
        $metadata['end_page'] = sanitize_text_field($_POST['deposit-journal-end-page']);
        $metadata['issn'] = sanitize_text_field($_POST['deposit-journal-issn']);
        $metadata['doi'] = sanitize_text_field($_POST['deposit-journal-doi']);
    } elseif ('book' == $metadata['publication-type']) {
        $metadata['publisher'] = sanitize_text_field($_POST['deposit-book-publisher']);
        $metadata['date'] = sanitize_text_field($_POST['deposit-book-publish-date']);
        if (!empty($metadata['date'])) {
            $temp_date = preg_replace('~^(winter(?:/|)|spring(?:/|)|summer(?:/|)|fall(?:/|)|autumn(?:/|))+\\s(\\d{4})$~i', 'Jan $2', $metadata['date']);
            $metadata['date_issued'] = date('Y', strtotime(preg_replace('/^(\\d{4})$/', 'Jan $1', $temp_date)));
        } else {
            $metadata['date_issued'] = date('Y', strtotime('today'));
        }
        $metadata['book_journal_title'] = sanitize_text_field($_POST['deposit-book-title']);
        $metadata['book_author'] = sanitize_text_field($_POST['deposit-book-author']);
        $metadata['chapter'] = sanitize_text_field($_POST['deposit-book-chapter']);
        $metadata['start_page'] = sanitize_text_field($_POST['deposit-book-start-page']);
        $metadata['end_page'] = sanitize_text_field($_POST['deposit-book-end-page']);
        $metadata['isbn'] = sanitize_text_field($_POST['deposit-book-isbn']);
        $metadata['doi'] = sanitize_text_field($_POST['deposit-book-doi']);
    } elseif ('conference-proceeding' == $metadata['publication-type']) {
        $metadata['publisher'] = sanitize_text_field($_POST['deposit-proceeding-publisher']);
        $metadata['date'] = sanitize_text_field($_POST['deposit-proceeding-publish-date']);
        if (!empty($metadata['date'])) {
            $temp_date = preg_replace('~^(winter(?:/|)|spring(?:/|)|summer(?:/|)|fall(?:/|)|autumn(?:/|))+\\s(\\d{4})$~i', 'Jan $2', $metadata['date']);
            $metadata['date_issued'] = date('Y', strtotime(preg_replace('/^(\\d{4})$/', 'Jan $1', $temp_date)));
        } else {
            $metadata['date_issued'] = date('Y', strtotime('today'));
        }
        $metadata['book_journal_title'] = sanitize_text_field($_POST['deposit-proceeding-title']);
        $metadata['start_page'] = sanitize_text_field($_POST['deposit-proceeding-start-page']);
        $metadata['end_page'] = sanitize_text_field($_POST['deposit-proceeding-end-page']);
        $metadata['doi'] = sanitize_text_field($_POST['deposit-proceeding-doi']);
    } elseif ('none' == $metadata['publication-type']) {
        $metadata['date'] = sanitize_text_field($_POST['deposit-non-published-date']);
        if (!empty($metadata['date'])) {
            $temp_date = preg_replace('~^(winter(?:/|)|spring(?:/|)|summer(?:/|)|fall(?:/|)|autumn(?:/|))+\\s(\\d{4})$~i', 'Jan $2', $metadata['date']);
            $metadata['date_issued'] = date('Y', strtotime(preg_replace('/^(\\d{4})$/', 'Jan $1', $temp_date)));
        } else {
            $metadata['date_issued'] = date('Y', strtotime('today'));
        }
    }
    /**
     * Mint and reserve a DOI.
     */
    $creators = array();
    foreach ($metadata['authors'] as $author) {
        if ('author' === $author['role'] && !empty($author['fullname'])) {
            $creators[] = $author['fullname'];
        }
    }
    $creator_list = implode(',', $creators);
    $deposit_doi = humcore_create_handle($metadata['title'], $nextPids[0], $creator_list, $metadata['genre'], $metadata['date_issued'], $metadata['publisher']);
    if (!$deposit_doi) {
        $metadata['handle'] = sprintf(bp_get_root_domain() . '/deposits/item/%s/', $nextPids[0]);
        $metadata['deposit_doi'] = '';
        // Not stored in solr.
    } else {
        $metadata['handle'] = 'http://dx.doi.org/' . str_replace('doi:', '', $deposit_doi);
        $metadata['deposit_doi'] = $deposit_doi;
        // Not stored in solr.
    }
    return $metadata;
}