Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php /* Querystring is set via AJAX in _inc/ajax.php - bp_dtheme_object_filter() */
- if ( is_user_logged_in() == false )
- {
- echo '<h2>Please login to see results</h2>';
- return;
- }
- if ( current_user_can(EZ_XPF_SUBSCRIBER_MEMBER) || current_user_can(EZ_XPF_FREE_MEMBER) )
- {
- echo '<h2>Sorry, you do not have permission to access this page.</h2>';
- return;
- }
- ?>
- <?php if (isset($_REQUEST["only_search_result"])) :?>
- <?php do_action( 'bp_before_members_loop' ) ?>
- <?php if ( bp_has_members( bp_ajax_querystring( 'members' ) ) ) : ?>
- <div id="pag-top" class="pagination">
- <div class="pag-count" id="member-dir-count-top">
- <?php bp_members_pagination_count() ?>
- </div>
- <div class="pagination-links" id="member-dir-pag-top">
- <?php bp_members_pagination_links() ?>
- </div>
- </div>
- <?php do_action( 'bp_before_directory_members_list' ) ?>
- <?php
- $first_letter = "";
- ?>
- <ul id="members-list" class="item-list">
- <input type="button" name="smPrintSearchResult" onClick="return SubmitLongSearchForm('smPrintSearchResult');" value="Print This Search Result" />
- <?php
- $user_role = GetS2memberInfoInLoop("Access Level Name");
- if (current_user_can(EZ_XPF_DIRECTOR_MEMBER) || current_user_can(EZ_XPF_ADMINISTRATOR) || current_user_can(EZ_XPF_MD_MEMBER)){
- echo ' <input type="button" onClick="return SubmitLongSearchForm(\'smDownloadExcel\');" name="smDownloadExcel" value="Download Excel Spreadsheet" />';
- }
- if (current_user_can(EZ_XPF_ADMINISTRATOR)){
- //echo ' <input type="hidden" name="test" value="1" />';
- }
- ?>
- <input type="hidden" name="memberdirectoryAction" id="memberdirectoryAction" value="" />
- <script>
- function SubmitLongSearchForm(action)
- {
- jQuery("#members-directory-form").attr("method","POST");
- jQuery("#memberdirectoryAction").val(action);
- jQuery("#members-directory-form").submit();
- return false;
- }
- </script>
- <?php
- if ($_REQUEST["is_show_member_profile"] == "1")
- {
- echo '<input type="hidden" name="show_profile" value="1"/>';
- }
- else
- {
- echo '<input type="hidden" name="show_profile" value="0"/>';
- }
- if ((current_user_can(EZ_XPF_ADMINISTRATOR) ||
- current_user_can(EZ_XPF_DIRECTOR_MEMBER) ||
- current_user_can(EZ_XPF_MD_MEMBER)) && $_REQUEST["include_member_detail"] == "1")
- {
- echo '<input type="hidden" name="show_s2m" value="1"/>';
- }
- else
- {
- echo '<input type="hidden" name="show_s2m" value="0"/>';
- }
- if ($_REQUEST["is_expired"] == "1")
- {
- echo '<input type="hidden" name="show_unexpired" value="1"/>';
- }
- elseif ($_REQUEST["is_expired"] == "0")
- {
- echo '<input type="hidden" name="show_unexpired" value="0"/>';
- }
- ?>
- <?php while ( bp_members() ) : bp_the_member(); ?>
- <?php
- $user_role = GetS2memberInfoInLoop("Access Level Name");
- if ($user_role == EZ_XPF_ADMINISTRATOR ||
- $user_role == EZ_XPF_MD_MEMBER ||
- $user_role == EZ_XPF_ASST_MEMBER ||
- $user_role == EZ_XPF_SUBSCRIBER_MEMBER ||
- $user_role == EZ_XPF_SWAPSHOP_MEMBER)
- continue;
- ?>
- <li>
- <!--<div class="item-avatar">
- <a href="<?php bp_member_permalink() ?>"><?php bp_member_avatar() ?></a>
- </div>-->
- <div class="item" style="clear: both;">
- <?php
- $ref = get_user_reference_in_profile_loop();
- //print_r($ref);
- if (current_user_can(EZ_XPF_MD_MEMBER) || current_user_can(EZ_XPF_ADMINISTRATOR) || current_user_can(EZ_XPF_DIRECTOR_MEMBER))
- {
- foreach ($ref as $key => $value)
- {
- $ref[$key] = 0;
- }
- }
- $member_id = GetS2memberInfoInLoop( 'Member #' );
- $name = GetS2memberInfoInLoop("EZ Member Name");
- $street1 = get_buddypress_profile_by_user_loop( EZ_XPF_STREET_ADDRESS ) . ", ";
- if ($ref["hide_street1"] == 1)
- $street1 = "";
- $street2 = get_buddypress_profile_by_user_loop( EZ_XPF_STREET_ADDRESS_2 );
- if ($ref["hide_street2"] == 1)
- $street2 = "";
- $city = get_buddypress_profile_by_user_loop( EZ_XPF_CITY ) . ", ";
- if ($ref["hide_city"] == 1)
- $city = "";
- $state = get_buddypress_profile_by_user_loop( EZ_XPF_STATE ) . ", ";
- if ($ref["hide_state"] == 1)
- $state = "";
- $zip = get_buddypress_profile_by_user_loop( EZ_XPF_ZIPCODE ) . ", ";
- if ($ref["hide_zip"] == 1)
- $zip = "";
- if ($ref["hide_all"] == 1)
- {
- if (current_user_can(EZ_XPF_ADMINISTRATOR) || current_user_can(EZ_XPF_MD_MEMBER)){
- ?><h5><a href="<?php echo bp_member_permalink() . "profile/edit/group/1";?>"><?php echo trim($name," &");?></a></h5><br><?php }
- else {
- echo "<h5>".trim($name," &") . "</h5><br>"; }
- }
- else
- {
- if (current_user_can(EZ_XPF_ADMINISTRATOR) || current_user_can(EZ_XPF_MD_MEMBER)){
- ?><h5><a href="<?php echo bp_member_permalink() . "profile/edit/group/1";?>"><?php echo trim($name," &");?></a></h5><br><?php }
- else {
- echo "<h5>".trim($name," &") . "</h5><br>"; }
- $temp = trim($street1 . " " . $street2 . ", " .$city . " " . $state . " " . $zip ." ". get_buddypress_profile_by_user_loop( EZ_XPF_COUNTRY ));
- $temp = trim($temp);
- $temp = preg_replace('/\s*,\s*,\s*/',', ',$temp);
- $temp = trim($temp,', ');
- if ($temp != "")
- {
- echo $temp . "<br>";
- }
- $temp = trim(get_buddypress_profile_by_user_loop( EZ_XPF_CAMPER_YEAR ) . " " . get_buddypress_profile_by_user_loop( EZ_XPF_CAMPER_MAKE ) . " " . get_buddypress_profile_by_user_loop( EZ_XPF_CAMPER_MODEL ));
- //var_dump($temp);exit;
- if ($temp != "")
- {
- echo $temp . "<br>";
- }
- $temp = "";
- if ($ref["hide_phone1"] == 0)
- $temp = get_buddypress_profile_by_user_loop(EZ_XPF_PHONE);
- if ($ref["hide_phone2"] == 0)
- $temp .= " " . get_buddypress_profile_by_user_loop(EZ_XPF_PHONE2);
- $temp = trim($temp);
- if ($temp != "")
- {
- echo $temp . "<br>";
- }
- $temp = "";
- if ($ref["hide_email1"] == 0 && GetS2memberInfoInLoop( 'Has Email' ) != "NO")
- $temp = get_buddypress_profile_by_user_loop( EZ_XPF_EMAIL );
- if ($ref["hide_email2"] == 0 && $temp != "")
- $temp .= " " . get_buddypress_profile_by_user_loop( EZ_XPF_EMAIL2 );
- elseif ($ref["hide_email2"] == 0 && $temp == "")
- $temp .= get_buddypress_profile_by_user_loop( EZ_XPF_EMAIL2 );
- $temp = trim($temp);
- if ($temp != "")
- {
- echo $temp . "<br>";
- }
- $temp = "";
- $profile = get_buddypress_profile_by_user_loop( EZ_XPF_PROFILE_INFO );
- if (isset($_REQUEST["is_show_member_profile"]))
- echo "Profile: ". str_replace("\\\"",'"',str_replace("\\'",''',$profile));
- if ($_REQUEST["include_member_detail"] == 1 && (current_user_can(EZ_XPF_ADMINISTRATOR) ||
- current_user_can(EZ_XPF_DIRECTOR_MEMBER) ||
- current_user_can(EZ_XPF_MD_MEMBER)))
- {
- echo '<table class="search_table">
- <tr>
- <td>Member #: ' . GetS2memberInfoInLoop( 'Member #' ).'</td>
- <td>Member Type: '. GetS2memberInfoInLoop( 'Member Type' ) .'</td>
- </tr>
- <tr>
- <td>Username: ' . GetS2memberInfoInLoop( 'Username' ) .'</td>
- <td>Has Email: ' . GetS2memberInfoInLoop( 'Has Email' ).'</td>
- </tr>
- <tr>
- <td>Exp Date: ' . GetS2memberInfoInLoop( 'Exp Date' ).'</td>
- <td>Join Date: ' . GetS2memberInfoInLoop( 'Join Date' ).'</td>
- </tr>
- <tr>
- <td>Last Expire Update: ' . GetS2memberInfoInLoop( 'Last Expire Update' ).'</td>
- <td>Last Record Update: ' . GetS2memberInfoInLoop( 'Last Record Update' ).'</td>
- </tr>
- <tr>
- <td colspan="2">Member Requests: ' .get_buddypress_profile_by_user_loop( EZ_XPF_SPECIAL_REQUEST ).'</td>
- </tr>
- <tr>
- <td colspan="2">Admin Comments: ' .GetS2memberInfoInLoop( "Comments" ).'</td>
- </tr>
- </table>';
- }
- }
- ?>
- <div class="item-meta"><span class="activity"><?php //bp_member_last_active() ?></span></div>
- <?php do_action( 'bp_directory_members_item' ) ?>
- </div>
- <div class="action">
- <?php //do_action( 'bp_directory_members_actions' ); ?>
- </div>
- <div class="clear"></div>
- </li>
- <?php endwhile; ?>
- </ul>
- <?php do_action( 'bp_after_directory_members_list' ) ?>
- <?php bp_member_hidden_fields() ?>
- <div id="pag-bottom" class="pagination">
- <div class="pag-count" id="member-dir-count-bottom">
- <?php bp_members_pagination_count() ?>
- </div>
- <div class="pagination-links" id="member-dir-pag-bottom">
- <?php bp_members_pagination_links() ?>
- </div>
- </div>
- <?php else: ?>
- <div id="message" class="info">
- <p><?php _e( "Sorry, no members were found.", 'buddypress' ) ?></p>
- </div>
- <?php endif; ?>
- <?php do_action( 'bp_after_members_loop' ) ?>
- <?php endif;?>
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- -----CHANGELOG-----
- <?php
- /********************** COMMENTS ********************
- *
- * FunctionName: bp_is_home()
- * Description:
- * SourceFile: ../bp-core/deprecated/1.5.php.
- * ChangeLog: Replace the 'bp_is_home()' statement and codeblock with the modified code block.
- *
- */
- function bp_is_home() {
- _deprecated_function( __FUNCTION__, '1.5', 'bp_is_my_profile' );
- // return bp_is_my_profile();
- }
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- /********************** COMMENTS ********************
- *
- * FunctionName: bp_core_fetch_avatar()
- * Description: Get an avatar for a BuddyPress object.
- * SourceFile: ../bp-core/bp-core-avatars.php.
- * ChangeLog: Replace the 'bp_core_fetch_avatar()' statement and codeblock with the modified code block.
- *
- */
- function bp_core_fetch_avatar( $args = '' ) {
- global $bp, $current_blog;
- // Set a few default variables
- $def_object = 'user';
- $def_type = 'thumb';
- $def_class = 'avatar';
- $def_alt = __( 'Avatar Image', 'buddypress' );
- // Set the default variables array
- $defaults = array(
- 'item_id' => false,
- 'object' => $def_object, // user/group/blog/custom type (if you use filters)
- 'type' => $def_type, // thumb or full
- 'avatar_dir' => false, // Specify a custom avatar directory for your object
- 'width' => false, // Custom width (int)
- 'height' => false, // Custom height (int)
- 'class' => $def_class, // Custom <img> class (string)
- 'css_id' => false, // Custom <img> ID (string)
- 'alt' => $def_alt, // Custom <img> alt (string)
- 'email' => false, // Pass the user email (for gravatar) to prevent querying the DB for it
- 'no_grav' => false, // If there is no avatar found, return false instead of a grav?
- 'html' => true, // Wrap the return img URL in <img />
- 'title' => '' // Custom <img> title (string)
- );
- // Compare defaults to passed and extract
- $params = wp_parse_args( $args, $defaults );
- extract( $params, EXTR_SKIP );
- // Set item_id if not passed
- if ( !$item_id ) {
- if ( 'user' == $object )
- $item_id = $bp->displayed_user->id;
- else if ( bp_is_active( 'groups' ) && 'group' == $object )
- $item_id = $bp->groups->current_group->id;
- else if ( 'blog' == $object )
- $item_id = $current_blog->id;
- $item_id = apply_filters( 'bp_core_avatar_item_id', $item_id, $object );
- if ( !$item_id )
- return false;
- }
- // Set avatar_dir if not passed (uses $object)
- if ( !$avatar_dir ) {
- if ( 'user' == $object )
- $avatar_dir = 'avatars';
- else if ( bp_is_active( 'groups' ) && 'group' == $object )
- $avatar_dir = 'group-avatars';
- else if ( 'blog' == $object )
- $avatar_dir = 'blog-avatars';
- $avatar_dir = apply_filters( 'bp_core_avatar_dir', $avatar_dir, $object );
- if ( !$avatar_dir )
- return false;
- }
- // Add an identifying class to each item
- $class .= ' ' . $object . '-' . $item_id . '-avatar';
- // Get item name for alt/title tags
- $item_name = '';
- if ( 'user' == $object )
- $item_name = bp_core_get_user_displayname( $item_id );
- elseif ( 'group' == $object )
- $item_name = bp_get_group_name( new BP_Groups_Group( $item_id ) );
- elseif ( 'blog' == $object )
- $item_name = get_blog_option( $item_id, 'blogname' );
- $alt = sprintf( $alt, apply_filters( 'bp_core_avatar_alt', $item_name, $item_id, $object ) );
- // Set title tag
- if ( $title )
- $title = " title='" . esc_attr( apply_filters( 'bp_core_avatar_title', $title, $item_id, $object ) ) . "'";
- elseif ( $item_name )
- $title = " title='" . esc_attr( apply_filters( 'bp_core_avatar_title', $item_name, $item_id, $object ) ) . "'";
- // Set CSS ID if passed
- if ( !empty( $css_id ) )
- $css_id = " id='{$css_id}'";
- // Set avatar width
- if ( $width )
- $html_width = " width='{$width}'";
- else
- $html_width = ( 'thumb' == $type ) ? ' width="' . bp_core_avatar_thumb_width() . '"' : ' width="' . bp_core_avatar_full_width() . '"';
- // Set avatar height
- if ( $height )
- $html_height = " height='{$height}'";
- else
- $html_height = ( 'thumb' == $type ) ? ' height="' . bp_core_avatar_thumb_height() . '"' : ' height="' . bp_core_avatar_full_height() . '"';
- }
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- /********************** COMMENTS ********************
- *
- * FunctionName: public static function core_custom_search()
- * Description: Set up a customized search.
- * SourceFile: ../bp-core/classes/class-bp-core-user.php.
- * ChangeLog: Add the 'public static function core_custom_search()' statement and codeblock.
- *
- */
- /** Static Functions ******************************************************/
- public static function core_custom_search()
- {
- global $wpdb, $bp;
- if (isset($_POST["members_search_submit"]))
- {
- $result = $wpdb->get_results("SELECT * FROM $wpdb->users");
- foreach ($get_results as $user)
- {
- $member_number = $user->ID;
- $member_first_name = "";
- $partner_first_name = "";
- $street_address = "";
- $city = "";
- $email1 = "";
- $email2 = "";
- $member_type = "";
- $member_last_name = "";
- $partner_last_name = "";
- $street_address2 = "";
- $state = "";
- $code = "";
- $country = "";
- $phone1 = "";
- $phone2 = "";
- $camper_year = "";
- $camper_make = "";
- $camper_model = "";
- $in_member_profile = "";
- $is_show_member_profile = "";
- $word_in_request = "";
- $word_in_admin_comment = "";
- $region_ec = "";
- $region_nr = "";
- $region_ma = "";
- $region_sc = "";
- $region_fl = "";
- $region_gl = "";
- $region_scen = "";
- $region_up = "";
- $region_kat = "";
- $region_pn = "";
- $region_s = "";
- $region_hi = "";
- $renew_date_from = "";
- $renew_date_to = "";
- $change_date_from = "";
- $change_date_to = "";
- $join_date_from = "";
- $join_date_to = "";
- $expire_date_from = "";
- $expire_date_to = "";
- $is_expired = "";
- }
- }
- }
- *************************************************************************************************************************************
- /********************** COMMENTS ********************
- *
- * FunctionName: public static function get_users()
- * Description: Get a list of users that match the query parameters.
- * SourceFile: ../bp-core/classes/class-bp-core-user.php.
- * ChangeLog: Replace the 'public static function get_users()' statement and codeblock with the modified code block.
- *
- */
- public static function get_users( $type, $limit = 0, $page = 1, $user_id = 0, $include = false, $search_terms = false, $populate_extras = true, $exclude = false, $meta_key = false, $meta_value = false ) {
- global $wpdb, $bp;
- if (isset($_REQUEST["only_search_result"]) == FALSE)
- return;
- $type = "alphabetical";
- $sql = array();
- $sql['select_main'] = "SELECT DISTINCT u.ID as id, u.user_registered, u.user_nicename, u.user_login, u.display_name, u.user_email";
- if ( 'active' == $type || 'online' == $type || 'newest' == $type )
- $sql['select_active'] = ", um.meta_value as last_activity";
- if ( 'popular' == $type )
- $sql['select_popular'] = ", um.meta_value as total_friend_count";
- if ( 'alphabetical' == $type )
- $sql['select_alpha'] = ", pd.value as fullname";
- if ( $meta_key ) {
- $sql['select_meta'] = ", umm.meta_key";
- if ( $meta_value )
- $sql['select_meta'] .= ", umm.meta_value";
- }
- $sql['from'] = "FROM $wpdb->users u LEFT JOIN $wpdb->usermeta um ON um.user_id = u.ID";
- // We search against xprofile fields, so we must join the table
- if ( $search_terms && bp_is_active( 'xprofile' ) )
- $sql['join_profiledata_search'] = "LEFT JOIN {$bp->profile->table_name_data} spd ON u.ID = spd.user_id";
- // Alphabetical sorting is done by the xprofile Full Name field
- if ( 'alphabetical' == $type )
- $sql['join_profiledata_alpha'] = "LEFT JOIN {$bp->profile->table_name_data} pd ON u.ID = pd.user_id";
- if ( $meta_key )
- $sql['join_meta'] = "LEFT JOIN {$wpdb->usermeta} umm ON umm.user_id = u.ID";
- $sql['where'] = 'WHERE ' . bp_core_get_status_sql( 'u.' );
- if ( 'active' == $type || 'online' == $type || 'newest' == $type )
- $sql['where_active'] = $wpdb->prepare( "AND um.meta_key = %s", bp_get_user_meta_key( 'last_activity' ) );
- if ( 'popular' == $type )
- $sql['where_popular'] = $wpdb->prepare( "AND um.meta_key = %s", bp_get_user_meta_key( 'total_friend_count' ) );
- if ( 'online' == $type )
- $sql['where_online'] = "AND DATE_ADD( um.meta_value, INTERVAL 5 MINUTE ) >= UTC_TIMESTAMP()";
- if ( 'alphabetical' == $type )
- $sql['where_alpha'] = "AND pd.field_id = 179";
- if ( !empty( $exclude ) )
- $sql['where_exclude'] = "AND u.ID NOT IN ({$exclude})";
- if ( $include ) {
- if ( is_array( $include ) )
- $uids = $wpdb->escape( implode( ',', (array)$include ) );
- else
- $uids = $wpdb->escape( $include );
- if ( !empty( $uids ) )
- $sql['where_users'] = "AND u.ID IN ({$uids})";
- }
- else if ( $user_id && bp_is_active( 'friends' ) ) {
- $friend_ids = friends_get_friend_user_ids( $user_id );
- $friend_ids = $wpdb->escape( implode( ',', (array)$friend_ids ) );
- if ( !empty( $friend_ids ) )
- $sql['where_friends'] = "AND u.ID IN ({$friend_ids})";
- // User has no friends, return false since there will be no users to fetch.
- else
- return false;
- }
- //if ($uids != "")
- //print( '<input type="hidden" value="'.str_replace(",","|",$uids).'" name="user_id_list"/>');
- //do_action( 'print_all_searching_users', $uids );
- if ( $search_terms && bp_is_active( 'xprofile' ) ) {
- $search_terms = like_escape( $wpdb->escape( $search_terms ) );
- $sql['where_searchterms'] = "AND spd.value LIKE '%%$search_terms%%'";
- }
- if ( $meta_key ) {
- $sql['where_meta'] = $wpdb->prepare( " AND umm.meta_key = %s", $meta_key );
- // If a meta value is provided, match it
- if ( $meta_value ) {
- $sql['where_meta'] .= $wpdb->prepare( " AND umm.meta_value = %s", $meta_value );
- }
- }
- switch ( $type ) {
- case 'active': case 'online': default:
- $sql[] = "ORDER BY um.meta_value DESC";
- break;
- case 'newest':
- $sql[] = "ORDER BY u.ID DESC";
- break;
- case 'alphabetical':
- $sql[] = "ORDER BY pd.value ASC, display_name ASC";
- break;
- case 'random':
- $sql[] = "ORDER BY rand()";
- break;
- case 'popular':
- $sql[] = "ORDER BY CONVERT(um.meta_value, SIGNED) DESC";
- break;
- }
- $user_list = array();
- $data = $wpdb->get_results(join( ' ', (array)$sql ));
- foreach ($data as $u)
- {
- $user_list[] = $u->id;
- }
- //echo join( ' ', (array)$sql );exit;
- //print_r($user_list);exit;
- if ($user_list != "")
- print( '<input type="hidden" value="'.implode("|",$user_list).'" name="user_id_list"/>');
- //echo join( ' ', (array)$sql );exit;
- //echo "$limit && $page";
- if ( $limit && $page )
- $sql['pagination'] = $wpdb->prepare( "LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
- // Get paginated results
- $paged_users_sql = apply_filters( 'bp_core_get_paged_users_sql', join( ' ', (array)$sql ), $sql );
- $paged_users = $wpdb->get_results( $paged_users_sql );
- //print_r($paged_users_sql);exit;
- // Re-jig the SQL so we can get the total user count
- unset( $sql['select_main'] );
- if ( !empty( $sql['select_active'] ) )
- unset( $sql['select_active'] );
- if ( !empty( $sql['select_popular'] ) )
- unset( $sql['select_popular'] );
- if ( !empty( $sql['select_alpha'] ) )
- unset( $sql['select_alpha'] );
- if ( !empty( $sql['pagination'] ) )
- unset( $sql['pagination'] );
- array_unshift( $sql, "SELECT COUNT(DISTINCT u.ID)" );
- //echo $paged_users_sql;
- // Get total user results
- $total_users_sql = apply_filters( 'bp_core_get_total_users_sql', join( ' ', (array)$sql ), $sql );
- $total_users = $wpdb->get_var( $total_users_sql );
- /***
- * Lets fetch some other useful data in a separate queries, this will be faster than querying the data for every user in a list.
- * We can't add these to the main query above since only users who have this information will be returned (since the much of the data is in usermeta and won't support any type of directional join)
- */
- if ( !empty( $populate_extras ) ) {
- $user_ids = array();
- foreach ( (array)$paged_users as $user )
- $user_ids[] = $user->id;
- $user_ids = $wpdb->escape( join( ',', (array)$user_ids ) );
- // Add additional data to the returned results
- $paged_users = BP_Core_User::get_user_extras( $paged_users, $user_ids, $type );
- }
- return array( 'users' => $paged_users, 'total' => $total_users );
- }
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- /********************** COMMENTS ********************
- *
- * FunctionName: bp_core_get_last_activity()
- * Description: Format last activity string based on time since date given.
- * SourceFile: ../bp-core/bp-core-functions.php.
- * ChangeLog: Replace the 'bp_core_get_last_activity()' statement and codeblock with the modified code block.
- *
- */
- function bp_core_get_last_activity( $last_activity_date, $string ) {
- /* if ( !$last_activity_date || empty( $last_activity_date ) )
- $last_active = __( 'not recently active', 'buddypress' );
- else
- $last_active = sprintf( $string, bp_core_time_since( $last_activity_date ) );
- return apply_filters( 'bp_core_get_last_activity', $last_active, $last_activity_date, $string );*/
- }
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- /********************** COMMENTS ********************
- *
- * FunctionName: bp_get_options_nav()
- * Description: Output the "options nav", the secondary-level single item navigation menu.
- * SourceFile: ../bp-core/bp-core-template.php.
- * ChangeLog: Replace the 'bp_get_options_nav()' statement and codeblock with the modified code block.
- *
- */
- function bp_get_options_nav() {
- global $bp;
- // If we are looking at a member profile, then the we can use the current component as an
- // index. Otherwise we need to use the component's root_slug
- $component_index = !empty( $bp->displayed_user ) ? $bp->current_component : bp_get_root_slug( $bp->current_component );
- if ( !bp_is_single_item() ) {
- if ( !isset( $bp->bp_options_nav[$component_index] ) || count( $bp->bp_options_nav[$component_index] ) < 1 ) {
- return false;
- } else {
- $the_index = $component_index;
- }
- } else {
- if ( !isset( $bp->bp_options_nav[$bp->current_item] ) || count( $bp->bp_options_nav[$bp->current_item] ) < 1 ) {
- return false;
- } else {
- $the_index = $bp->current_item;
- }
- }
- // Loop through each navigation item
- foreach ( (array)$bp->bp_options_nav[$the_index] as $subnav_item ) {
- if ( !$subnav_item['user_has_access'] )
- continue;
- if ($subnav_item['name'] == "Change Avatar")
- continue;
- // If the current action or an action variable matches the nav item id, then add a highlight CSS class.
- if ( $subnav_item['slug'] == $bp->current_action ) {
- $selected = ' class="current selected"';
- } else {
- $selected = '';
- }
- // List type depends on our current component
- $list_type = bp_is_group() ? 'groups' : 'personal';
- // echo out the final list item
- echo apply_filters( 'bp_get_options_nav_' . $subnav_item['css_id'], '<li id="' . $subnav_item['css_id'] . '-' . $list_type . '-li" ' . $selected . '><a id="' . $subnav_item['css_id'] . '" href="' . $subnav_item['link'] . '">' . $subnav_item['name'] . '</a></li>', $subnav_item );
- }
- }
- function bp_get_options_nav_for_current_user() {
- global $bp;
- echo '<div id="subnav" class="item-list-tabs no-ajax">
- <ul>
- <li id="public-personal-li"><a href="'.$bp->displayed_user->domain.'profile/public/" id="public">Public</a></li><li id="edit-personal-li"><a href="'.$bp->displayed_user->domain.'profile/edit/" id="edit">Edit</a></li></ul>
- </div>';
- }
- function bp_get_options_title() {
- global $bp;
- if ( empty( $bp->bp_options_title ) )
- $bp->bp_options_title = __( 'Options', 'buddypress' );
- echo apply_filters( 'bp_get_options_title', esc_attr( $bp->bp_options_title ) );
- }
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- /********************** COMMENTS ********************
- *
- * FunctionName: wp_kses_bad_protocol_once2()
- * Description: Callback for wp_kses_bad_protocol_once() regular expression. This function processes URL protocols, checks to see if they're in the whitelist or not, and returns different data depending on the answer.
- * SourceFile: ../bp-forums/bbpress/bb-includes/backpress/functions.kses.php.
- * ChangeLog: Replace the 'wp_kses_bad_protocol_once2()' statement and codeblock with the modified code block.
- *
- */
- function wp_kses_bad_protocol_once2( $string, $allowed_protocols ) {
- $string2 = wp_kses_decode_entities($string);
- $string2 = preg_replace('/\s/', '', $string2);
- $string2 = wp_kses_no_null($string2);
- $string2 = strtolower($string2);
- $allowed = false;
- foreach ( (array) $allowed_protocols as $one_protocol )
- if ( strtolower($one_protocol) == $string2 ) {
- break;
- }
- if ($allowed)
- return "$string2:";
- else
- return '';
- }
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- /********************** COMMENTS ********************
- *
- * FunctionName: bp_groups_pagination_count()
- * Description: Output the "Viewing x-y of z groups" pagination message.
- * SourceFile: ../bp-core/bp-groups-template.php.
- * ChangeLog: Replace the 'bp_groups_pagination_count()' statement and codeblock with the modified code block.
- *
- */
- function bp_groups_pagination_count() {
- echo bp_get_groups_pagination_count();
- }
- function bp_get_groups_pagination_count() {
- global $bp, $groups_template;
- $start_num = intval( ( $groups_template->pag_page - 1 ) * $groups_template->pag_num ) + 1;
- $from_num = bp_core_number_format( $start_num );
- $to_num = bp_core_number_format( ( $start_num + ( $groups_template->pag_num - 1 ) > $groups_template->total_group_count ) ? $groups_template->total_group_count : $start_num + ( $groups_template->pag_num - 1 ) );
- $total = bp_core_number_format( $groups_template->total_group_count );
- return apply_filters( 'bp_get_groups_pagination_count', sprintf( __( 'Viewing group %1$s to %2$s of %3$s .', 'buddypress' ), $from_num, $to_num, $total ) );
- }
- *************************************************************************************************************************************
- /********************** COMMENTS ********************
- *
- * FunctionName: bp_group_member_pagination_count()
- * Description: Filters the HTML markup to be used for group member listing pagination.
- * SourceFile: ../bp-core/bp-groups-template.php.
- * ChangeLog: Replace the 'bp_group_member_pagination_count()' statement and codeblock with the modified code block.
- *
- */
- function bp_group_member_pagination_count() {
- echo bp_get_group_member_pagination_count();
- }
- function bp_get_group_member_pagination_count() {
- global $members_template;
- $start_num = intval( ( $members_template->pag_page - 1 ) * $members_template->pag_num ) + 1;
- $from_num = bp_core_number_format( $start_num );
- $to_num = bp_core_number_format( ( $start_num + ( $members_template->pag_num - 1 ) > $members_template->total_member_count ) ? $members_template->total_member_count : $start_num + ( $members_template->pag_num - 1 ) );
- $total = bp_core_number_format( $members_template->total_member_count );
- return apply_filters( 'bp_get_group_member_pagination_count', sprintf( __( 'Viewing members %1$s to %2$s of %3$s .', 'buddypress' ), $from_num, $to_num, $total ) );
- }
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- /********************** COMMENTS ********************
- *
- * FunctionName: bp_core_screen_signup()
- * Description: Handle the loading of the signup screen.
- * SourceFile: ../bp-core/bp-members-screens.php.
- * ChangeLog: Replace the 'bp_core_screen_signup()' statement and codeblock with the modified code block.
- *
- */
- function bp_core_screen_signup() {
- global $bp, $wpdb;
- if ( !bp_is_current_component( 'register' ) )
- return;
- // Not a directory
- bp_update_is_directory( false, 'register' );
- // If the user is logged in, redirect away from here
- if (!current_user_can(EZ_XPF_MD_MEMBER) && !current_user_can(EZ_XPF_ADMINISTRATOR))
- {
- if ( is_user_logged_in()) {
- if ( bp_is_component_front_page( 'register' ) )
- bp_core_redirect( bp_get_root_domain() . '/' . bp_get_members_root_slug() );
- else
- bp_core_redirect( bp_get_root_domain() );
- return;
- }
- }
- $bp->signup->step = 'request-details';
- if ( !bp_get_signup_allowed() ) {
- $bp->signup->step = 'registration-disabled';
- }
- // If the signup page is submitted, validate and save
- elseif ( isset( $_POST['signup_submit'] ) ) {
- $username = substr(strtolower($_POST["field_1"]),0,1) . strtolower($_POST["field_179"]);
- $username = preg_replace('/[^a-zA-Z0-9]*/','',$username);
- //var_dump($username);exit;
- $user_count = "";
- do
- {
- $row = $wpdb->get_row("SELECT * FROM wp_users WHERE user_login='".$username . $user_count."'");
- if (!$row)
- {
- break;
- }
- else
- {
- if ($user_count == "")
- $user_count = 1;
- else
- $user_count++;
- }
- }
- while(true);
- //get custom information from registration form
- $username = $username . $user_count;
- $_POST['signup_username'] = $username;
- $_POST['signup_password'] = uniqid();
- $_POST['signup_password_confirm'] = $_POST['signup_password'];
- if ($_POST["field_1771"] != "")
- $_POST['signup_email'] = $_POST["field_1771"];
- else
- $_POST['signup_email'] = $username . "@alinerownersclub.com";
- //print_r($_POST);exit;
- // Check the nonce
- check_admin_referer( 'bp_new_signup' );
- // Check the base account details for problems
- $account_details = bp_core_validate_user_signup( $_POST['signup_username'], $_POST['signup_email'] );
- //print_r($account_details);exit;
- // If there are errors with account details, set them for display
- if ( !empty( $account_details['errors']->errors['user_name'] ) )
- $bp->signup->errors['signup_username'] = $account_details['errors']->errors['user_name'][0];
- if ( !empty( $account_details['errors']->errors['user_email'] ) && !empty( $_POST['field_1771'] ) )
- $bp->signup->errors['signup_email'] = $account_details['errors']->errors['user_email'][0];
- // Check that both password fields are filled in
- if ( empty( $_POST['signup_password'] ) || empty( $_POST['signup_password_confirm'] ) )
- $bp->signup->errors['signup_password'] = __( 'Please make sure you enter your password twice', 'buddypress' );
- // Check that the passwords match
- if ( ( !empty( $_POST['signup_password'] ) && !empty( $_POST['signup_password_confirm'] ) ) && $_POST['signup_password'] != $_POST['signup_password_confirm'] )
- $bp->signup->errors['signup_password'] = __( 'The passwords you entered do not match.', 'buddypress' );
- $bp->signup->username = $_POST['signup_username'];
- $bp->signup->email = $_POST['signup_email'];
- if (empty($_POST["field_1"]) || empty($_POST["field_179"]))
- {
- $bp->signup->errors['signup_username'] = "Please enter First and Last Name.";
- }
- // Now we've checked account details, we can check profile information
- if ( bp_is_active( 'xprofile' ) ) {
- // Make sure hidden field is passed and populated
- if ( isset( $_POST['signup_profile_field_ids'] ) && !empty( $_POST['signup_profile_field_ids'] ) ) {
- // Let's compact any profile field info into an array
- $profile_field_ids = explode( ',', $_POST['signup_profile_field_ids'] );
- // Loop through the posted fields formatting any datebox values then validate the field
- foreach ( (array) $profile_field_ids as $field_id ) {
- if ( !isset( $_POST['field_' . $field_id] ) ) {
- if ( isset( $_POST['field_' . $field_id . '_day'] ) )
- $_POST['field_' . $field_id] = date( 'Y-m-d H:i:s', strtotime( $_POST['field_' . $field_id . '_day'] . $_POST['field_' . $field_id . '_month'] . $_POST['field_' . $field_id . '_year'] ) );
- }
- // Create errors for required fields without values
- if ($field_id == 3 ||
- $field_id == 5 ||
- $field_id == 6 ||
- $field_id == 127 ||
- $field_id == 126 ||
- $field_id == 177)
- continue;
- if ( xprofile_check_is_required_field( $field_id ) && empty( $_POST['field_' . $field_id] ) )
- $bp->signup->errors['field_' . $field_id] = __( 'This is a required field.', 'buddypress' );
- }
- // This situation doesn't naturally occur so bounce to website root
- } else {
- bp_core_redirect( bp_get_root_domain() );
- }
- }
- if(!empty($_POST['field_177']) && !preg_match("/\d\d\d\.\d\d\d\.\d\d\d\d/i", $_POST['field_177']) ) {
- $bp->signup->errors["field_177"] = 'Please enter a valid phone number!';
- }
- if(!empty($_POST['field_178']) && !preg_match("/\d\d\d\.\d\d\d\.\d\d\d\d/i", $_POST['field_178']) ) {
- $bp->signup->errors["field_178"] = 'Please enter a valid phone number!';
- }
- if (!empty($_POST['field_1770']))
- {
- if ( !is_email( $_POST['field_1770'] ) )
- $bp->signup->errors["field_1770"] = 'Please check your email address.';
- if ( function_exists( 'is_email_address_unsafe' ) && is_email_address_unsafe( $_POST['field_1770'] ) )
- $bp->signup->errors["field_1770"] = 'Please enter a valid email!';
- }
- //custom validations====================
- if (!current_user_can(EZ_XPF_MD_MEMBER) && !current_user_can(EZ_XPF_ADMINISTRATOR))
- {
- if (empty($_POST['field_3']) || empty($_POST['field_5']) || empty($_POST['field_6']) || empty($_POST['field_126']) || empty($_POST['field_127']))
- if (empty($_POST['field_177']))
- $bp->signup->errors['field_3'] = "REQUIRED FIELDS:<br>Street, City, State, ZIP/Postal AND Country<br>
- OR Phone Number<br>";
- }
- //end custom validations====================
- // Finally, let's check the blog details, if the user wants a blog and blog creation is enabled
- if ( isset( $_POST['signup_with_blog'] ) ) {
- $active_signup = $bp->site_options['registration'];
- if ( 'blog' == $active_signup || 'all' == $active_signup ) {
- $blog_details = bp_core_validate_blog_signup( $_POST['signup_blog_url'], $_POST['signup_blog_title'] );
- // If there are errors with blog details, set them for display
- if ( !empty( $blog_details['errors']->errors['blogname'] ) )
- $bp->signup->errors['signup_blog_url'] = $blog_details['errors']->errors['blogname'][0];
- if ( !empty( $blog_details['errors']->errors['blog_title'] ) )
- $bp->signup->errors['signup_blog_title'] = $blog_details['errors']->errors['blog_title'][0];
- }
- }
- do_action( 'bp_signup_validate' );
- //print_r($bp->signup->errors);
- // Add any errors to the action for the field in the template for display.
- if ( !empty( $bp->signup->errors ) ) {
- foreach ( (array)$bp->signup->errors as $fieldname => $error_message )
- add_action( 'bp_' . $fieldname . '_errors', create_function( '', 'echo apply_filters(\'bp_members_signup_error_message\', "<div class=\"error\">' . $error_message . '</div>" );' ) );
- add_action( 'bp_signup_general_info_errors', create_function( '', 'echo apply_filters(\'bp_members_signup_error_message\', "<div class=\"error\">Please fill in all required fields, below.</div>" );' ) );
- } else {
- $bp->signup->step = 'save-details';
- // No errors! Let's register those deets.
- $active_signup = !empty( $bp->site_options['registration'] ) ? $bp->site_options['registration'] : '';
- if ( 'none' != $active_signup ) {
- // Let's compact any profile field info into usermeta
- $profile_field_ids = explode( ',', $_POST['signup_profile_field_ids'] );
- // Loop through the posted fields formatting any datebox values then add to usermeta
- foreach ( (array) $profile_field_ids as $field_id ) {
- if ( !isset( $_POST['field_' . $field_id] ) ) {
- if ( isset( $_POST['field_' . $field_id . '_day'] ) )
- $_POST['field_' . $field_id] = date( 'Y-m-d H:i:s', strtotime( $_POST['field_' . $field_id . '_day'] . $_POST['field_' . $field_id . '_month'] . $_POST['field_' . $field_id . '_year'] ) );
- }
- if ( !empty( $_POST['field_' . $field_id] ) )
- $usermeta['field_' . $field_id] = $_POST['field_' . $field_id];
- }
- // Store the profile field ID's in usermeta
- $usermeta['profile_field_ids'] = $_POST['signup_profile_field_ids'];
- // Hash and store the password
- $usermeta['password'] = wp_hash_password( $_POST['signup_password'] );
- // If the user decided to create a blog, save those details to usermeta
- if ( 'blog' == $active_signup || 'all' == $active_signup )
- $usermeta['public'] = ( isset( $_POST['signup_blog_privacy'] ) && 'public' == $_POST['signup_blog_privacy'] ) ? true : false;
- $usermeta = apply_filters( 'bp_signup_usermeta', $usermeta );
- // Finally, sign up the user and/or blog
- if ( isset( $_POST['signup_with_blog'] ) && is_multisite() )
- bp_core_signup_blog( $blog_details['domain'], $blog_details['path'], $blog_details['blog_title'], $_POST['signup_username'], $_POST['signup_email'], $usermeta );
- else
- {
- $user_id = bp_core_signup_user( $_POST['signup_username'], $_POST['signup_password'], $_POST['signup_email'], $usermeta );
- do_action( 'bp_complete_signup_successful',$user_id );
- }
- $bp->signup->step = 'completed-confirmation';
- }
- do_action( 'bp_complete_signup' );
- }
- }
- do_action( 'bp_core_screen_signup' );
- bp_core_load_template( apply_filters( 'bp_core_template_register', 'registration/register' ) );
- }
- add_action( 'bp_screens', 'bp_core_screen_signup' );
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- /********************** COMMENTS ********************
- *
- * FunctionName: bp_core_validate_user_signup()
- * Description: Validate a user name and email address when creating a new user.
- * SourceFile: ../bp-core/bp-members-template.php.
- * ChangeLog: Replace the 'bp_core_validate_user_signup()' statement and codeblock with the modified code block.
- *
- */
- function bp_core_validate_user_signup( $user_name, $user_email ) {
- global $wpdb;
- $errors = new WP_Error();
- $user_email = sanitize_email( $user_email );
- //echo $user_email;exit;
- if ( empty( $user_name ) )
- $errors->add( 'user_name', __( '', 'buddypress' ) );
- $maybe = array();
- preg_match( "/[a-z0-9]+/", $user_name, $maybe );
- // Make sure illegal names include BuddyPress slugs and values
- bp_core_flush_illegal_names();
- $illegal_names = get_site_option( 'illegal_names' );
- if ( !validate_username( $user_name ) || in_array( $user_name, (array)$illegal_names ) || ( !empty( $maybe[0] ) && $user_name != $maybe[0] ) )
- $errors->add( 'user_name', __( 'Only lowercase letters and numbers allowed', 'buddypress' ) );
- //if( strlen( $user_name ) < 4 )
- //$errors->add( 'user_name', __( 'Username must be at least 4 characters', 'buddypress' ) );
- if ( strpos( ' ' . $user_name, '_' ) != false )
- $errors->add( 'user_name', __( 'Sorry, usernames may not contain the character "_"!', 'buddypress' ) );
- // Is the user_name all numeric?
- $match = array();
- preg_match( '/[0-9]*/', $user_name, $match );
- if ( $match[0] == $user_name )
- $errors->add( 'user_name', __( 'Sorry, usernames must have letters too!', 'buddypress' ) );
- if ( !is_email( $user_email ) )
- $errors->add( 'user_email', __( 'Please fill in a valid email address!', 'buddypress' ) );
- if ( function_exists( 'is_email_address_unsafe' ) && is_email_address_unsafe( $user_email ) )
- $errors->add( 'user_email', __( 'Sorry, that email address is not allowed!', 'buddypress' ) );
- $limited_email_domains = get_site_option( 'limited_email_domains', 'buddypress' );
- if ( is_array( $limited_email_domains ) && empty( $limited_email_domains ) == false ) {
- $emaildomain = substr( $user_email, 1 + strpos( $user_email, '@' ) );
- if ( in_array( $emaildomain, (array)$limited_email_domains ) == false )
- $errors->add( 'user_email', __( 'Sorry, that email address is not allowed!', 'buddypress' ) );
- }
- // Check if the username has been used already.
- if ( username_exists( $user_name ) )
- $errors->add( 'user_name', __( 'Sorry, that username already exists!', 'buddypress' ) );
- // Check if the email address has been used already.
- if ( email_exists( $user_email ) )
- $errors->add( 'user_email', __( 'Sorry, that email address is already used!', 'buddypress' ) );
- $result = array( 'user_name' => $user_name, 'user_email' => $user_email, 'errors' => $errors );
- // Apply WPMU legacy filter
- $result = apply_filters( 'wpmu_validate_user_signup', $result );
- return apply_filters( 'bp_core_validate_user_signup', $result );
- }
- *************************************************************************************************************************************
- /********************** COMMENTS ********************
- *
- * FunctionName: bp_core_signup_user()
- * Description: Process data submitted at user registration and convert to a signup object.
- * SourceFile: ../bp-core/bp-members-template.php.
- * ChangeLog: Replace the 'bp_core_signup_user()' statement and codeblock with the modified code block.
- *
- */
- function bp_core_signup_user( $user_login, $user_password, $user_email, $usermeta ) {
- global $bp, $wpdb;
- // Multisite installs have their own install procedure
- if ( is_multisite() ) {
- wpmu_signup_user( $user_login, $user_email, $usermeta );
- // On multisite, the user id is not created until the user activates the account
- // but we need to cast $user_id to pass to the filters
- $user_id = false;
- } else {
- $errors = new WP_Error();
- $user_id = wp_insert_user( array(
- 'user_login' => $user_login,
- 'user_pass' => $user_password,
- 'display_name' => sanitize_title( $user_login ),
- 'user_email' => $user_email
- ) );
- if ( empty( $user_id ) ) {
- $errors->add( 'registerfail', sprintf( __('<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:%s">webmaster</a> !', 'buddypress' ), get_option( 'admin_email' ) ) );
- return $errors;
- }
- $_SESSION["temp_password"] = $user_password;
- $_SESSION["temp_registering_user_id"] = $user_id;
- // Update the user status to '2' which we will use as 'not activated' (0 = active, 1 = spam, 2 = not active)
- //$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->users SET user_status = 2 WHERE ID = %d", $user_id ) );
- $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->users SET user_status = 0 WHERE ID = %d", $user_id ) );//auto activate user
- // Set any profile data
- if ( bp_is_active( 'xprofile' ) ) {
- if ( !empty( $usermeta['profile_field_ids'] ) ) {
- $profile_field_ids = explode( ',', $usermeta['profile_field_ids'] );
- foreach( (array)$profile_field_ids as $field_id ) {
- if ( empty( $usermeta["field_{$field_id}"] ) )
- continue;
- $current_field = $usermeta["field_{$field_id}"];
- xprofile_set_field_data( $field_id, $user_id, $current_field );
- }
- }
- }
- }
- $bp->signup->username = $user_login;
- /***
- * Now generate an activation key and send an email to the user so they can activate their account
- * and validate their email address. Multisite installs send their own email, so this is only for single blog installs.
- *
- * To disable sending activation emails you can user the filter 'bp_core_signup_send_activation_key' and return false.
- if ( apply_filters( 'bp_core_signup_send_activation_key', true ) ) {
- if ( !is_multisite() ) {
- $activation_key = wp_hash( $user_id );
- update_user_meta( $user_id, 'activation_key', $activation_key );
- bp_core_signup_send_validation_email( $user_id, $user_email, $activation_key ,$user_password,$user_login);
- }
- }*/
- do_action( 'bp_core_signup_user', $user_id, $user_login, $user_password, $user_email, $usermeta );
- return $user_id;
- }
- *************************************************************************************************************************************
- /********************** COMMENTS ********************
- *
- * FunctionName: bp_core_signup_send_validation_email()
- * Description: Send activation email to a newly registered user.
- * SourceFile: ../bp-core/bp-members-template.php.
- * ChangeLog: Replace the 'bp_core_signup_send_validation_email()' statement and codeblock with the modified code block.
- *
- */
- function bp_core_signup_send_validation_email( $user_id, $user_email, $key ,$password = "" ,$username = "",$message = "") {
- $activate_url = bp_get_activation_page() ."?key=$key";
- $activate_url = esc_url( $activate_url );
- /*$message = 'Thank you for joining the Aliner Owners Club!<br>
- <br>
- You are now able to log in using your username and temporary password as shown below. <br>
- <br>
- Your username is: '.$username.'<br>
- <br>
- Your password is: '.$password.'<br>
- <br>
- Please click the following link to access the members-only pages of the website: <a href="http://alinerownersclub.org">http://alinerownersclub.org</a><br>
- <br>
- When you log on to the AOC Website, please go to the "Update or Renew Your Membership" option in Member Central and change your temporary password to something you can easily remember. ';*/
- $subject = 'Thank You from the Aliner Owners Club';
- // Send the message
- $to = apply_filters( 'bp_core_signup_send_validation_email_to', $user_email . ',', $user_id );
- $subject = apply_filters( 'bp_core_signup_send_validation_email_subject', $subject, $user_id );
- $message = apply_filters( 'bp_core_signup_send_validation_email_message', $message, $user_id, $activate_url );
- $headers = 'BCC: <new-member@alinerownersclub.org>' . "\r\n";
- add_filter('wp_mail_content_type',create_function('', 'return "text/html";'));
- wp_mail( $to, $subject, $message, $headers );
- do_action( 'bp_core_sent_user_validation_email', $subject, $message, $user_id, $user_email, $key );
- }
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- /********************** COMMENTS ********************
- *
- * FunctionName: n/a
- * Description: Define the BP Default Component.
- * SourceFile: ../bp-core/bp-members-template.php.
- * ChangeLog: Add the statement to the top of the template file.
- *
- */
- define( 'BP_DEFAULT_COMPONENT', 'profile' );
- *************************************************************************************************************************************
- /********************** COMMENTS ********************
- *
- * FunctionName: bp_members_pagination_count()
- * Description: Output the members pagination count.
- * SourceFile: ../bp-core/bp-members-template.php.
- * ChangeLog: Replace the 'bp_members_pagination_count()' statement and codeblock with the modified code block.
- *
- */
- function bp_members_pagination_count() {
- echo bp_get_members_pagination_count();
- }
- function bp_get_members_pagination_count() {
- global $bp, $members_template;
- if ( empty( $members_template->type ) )
- $members_template->type = '';
- $start_num = intval( ( $members_template->pag_page - 1 ) * $members_template->pag_num ) + 1;
- $from_num = bp_core_number_format( $start_num );
- $to_num = bp_core_number_format( ( $start_num + ( $members_template->pag_num - 1 ) > $members_template->total_member_count ) ? $members_template->total_member_count : $start_num + ( $members_template->pag_num - 1 ) );
- $total = bp_core_number_format( $members_template->total_member_count );
- if ( 'active' == $members_template->type )
- $pag = sprintf( __( 'Viewing member %1$s to %2$s of %3$s', 'buddypress'), $from_num, $to_num, $total );
- else if ( 'popular' == $members_template->type )
- $pag = sprintf( __( 'Viewing member %1$s to %2$s of %3$s members with friends', 'buddypress' ), $from_num, $to_num, $total );
- else if ( 'online' == $members_template->type )
- $pag = sprintf( __( 'Viewing member %1$s to %2$s of %3$s members online.', 'buddypress' ), $from_num, $to_num, $total );
- else
- $pag = sprintf( __( 'Viewing member %1$s to %2$s of %3$s', 'buddypress' ), $from_num, $to_num, $total );
- return apply_filters( 'bp_members_pagination_count', $pag );
- }
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- /********************** COMMENTS ********************
- *
- * FunctionName: xprofile_sync_wp_profile()
- * Description: Syncs Xprofile data to the standard built in WordPress profile data.
- * SourceFile: ../bp-core/bp-xprofile-functions.php.
- * ChangeLog: Replace the 'xprofile_sync_wp_profile()' statement and codeblock with the modified code block.
- *
- */
- function xprofile_sync_wp_profile( $user_id = 0 ) {
- global $bp, $wpdb;
- if ( !empty( $bp->site_options['bp-disable-profile-sync'] ) && (int)$bp->site_options['bp-disable-profile-sync'] )
- return true;
- if ( empty( $user_id ) )
- $user_id = $bp->loggedin_user->id;
- if ( empty( $user_id ) )
- return false;
- $fullname = xprofile_get_field_data( bp_xprofile_fullname_field_name(), $user_id );
- $space = strpos( $fullname, ' ' );
- if ( false === $space ) {
- $firstname = $fullname;
- $lastname = '';
- } else {
- $firstname = substr( $fullname, 0, $space );
- $lastname = trim( substr( $fullname, $space, strlen( $fullname ) ) );
- }
- update_user_meta( $user_id, 'nickname', $fullname );
- update_user_meta( $user_id, 'first_name', $firstname );
- update_user_meta( $user_id, 'last_name', $lastname );
- //var_dump($wpdb->prepare( "UPDATE {$wpdb->users} SET display_name = %s WHERE ID = %d", $fullname, $user_id ));exit;
- //$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET display_name = %s WHERE ID = %d", $fullname, $user_id ) );
- }
- add_action( 'xprofile_updated_profile', 'xprofile_sync_wp_profile' );
- add_action( 'bp_core_signup_user', 'xprofile_sync_wp_profile' );
- add_action( 'bp_core_activated_user', 'xprofile_sync_wp_profile' );
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- /********************** COMMENTS ********************
- *
- * FunctionName: function xprofile_screen_display_profile()
- * Description: Handles the display of the profile page by loading the correct template file.
- * SourceFile: ../bp-core/bp-xprofile-screens.php.
- * ChangeLog: Replace the 'function xprofile_screen_display_profile()' statement and codeblock with the modified code block.
- *
- */
- function xprofile_screen_display_profile() {
- global $bp;
- bp_core_redirect( bp_displayed_user_domain() . $bp->profile->slug . '/edit/group/1' );
- $new = isset( $_GET['new'] ) ? $_GET['new'] : '';
- do_action( 'xprofile_screen_display_profile', $new );
- bp_core_load_template( apply_filters( 'xprofile_template_display_profile', 'members/single/home' ) );
- }
- *************************************************************************************************************************************
- /********************** COMMENTS ********************
- *
- * FunctionName: function xprofile_screen_edit_profile()
- * Description: Handles the display of the profile edit page by loading the correct template file.
- * SourceFile: ../bp-core/bp-xprofile-screens.php.
- * ChangeLog: Replace the 'function xprofile_screen_edit_profile()' statement and codeblock with the modified code block.
- *
- */
- function xprofile_screen_edit_profile() {
- global $bp,$wpdb;
- if ( !bp_is_my_profile() && !is_super_admin() )
- return false;
- // Make sure a group is set.
- if ( !bp_action_variable( 1 ) )
- bp_core_redirect( bp_displayed_user_domain() . $bp->profile->slug . '/edit/group/1' );
- // Check the field group exists
- if ( !bp_is_action_variable( 'group' ) || !xprofile_get_field_group( bp_action_variable( 1 ) ) ) {
- bp_do_404();
- return;
- }
- // Check to see if any new information has been submitted
- if ( isset( $_POST['field_ids'] ) ) {
- // Check the nonce
- check_admin_referer( 'bp_xprofile_edit' );
- // Check we have field ID's
- if ( empty( $_POST['field_ids'] ) )
- bp_core_redirect( trailingslashit( $bp->displayed_user->domain . $bp->profile->slug . '/edit/group/' . bp_action_variable( 1 ) ) );
- // Explode the posted field IDs into an array so we know which
- // fields have been submitted
- $posted_field_ids = explode( ',', $_POST['field_ids'] );
- $is_required = array();
- // Loop through the posted fields formatting any datebox values
- // then validate the field
- foreach ( (array)$posted_field_ids as $field_id ) {
- if ( !isset( $_POST['field_' . $field_id] ) ) {
- if ( !empty( $_POST['field_' . $field_id . '_day'] ) && is_numeric( $_POST['field_' . $field_id . '_day'] ) ) {
- // Concatenate the values
- $date_value = $_POST['field_' . $field_id . '_day'] . ' ' . $_POST['field_' . $field_id . '_month'] . ' ' . $_POST['field_' . $field_id . '_year'];
- // Turn the concatenated value into a timestamp
- $_POST['field_' . $field_id] = date( 'Y-m-d H:i:s', strtotime( $date_value ) );
- }
- }
- // Create errors for required fields without values
- if ($field_id == 3 ||
- $field_id == 5 ||
- $field_id == 6 ||
- $field_id == 126 ||
- $field_id == 127 ||
- $field_id == 177)
- continue;
- $is_required[$field_id] = xprofile_check_is_required_field( $field_id );
- if ( $is_required[$field_id] && empty( $_POST['field_' . $field_id] ) )
- {
- add_action( 'bp_field_' . $field_id . '_errors', create_function( '', 'echo apply_filters(\'bp_members_signup_error_message\', "<div class=\"error\">This is a required field.</div>" );' ) );
- $errors = true;
- }
- }
- $errorlist = array();
- if(!empty($_POST['field_177']) && !preg_match("/\d\d\d\.\d\d\d\.\d\d\d\d/i", $_POST['field_177']) ) {
- $errorlist["field_177"] = 'Please enter a valid phone number!';
- }
- if(!empty($_POST['field_178']) && !preg_match("/\d\d\d\.\d\d\d\.\d\d\d\d/i", $_POST['field_178']) ) {
- $errorlist["field_178"] = 'Please enter a valid phone number!';
- }
- if (!empty($_POST['field_1771']))
- {
- if ( !is_email( $_POST['field_1771'] ) )
- $errorlist["field_1771"] = 'Please check your email address.';
- if ( function_exists( 'is_email_address_unsafe' ) && is_email_address_unsafe( $_POST['field_1771'] ) )
- $errorlist["field_1771"] = 'Please enter a valid email!';
- }
- if (!empty($_POST['field_1770']))
- {
- if ( !is_email( $_POST['field_1770'] ) )
- $errorlist["field_1770"] = 'Please check your email address.';
- if ( function_exists( 'is_email_address_unsafe' ) && is_email_address_unsafe( $_POST['field_1770'] ) )
- $errorlist["field_1770"] = 'Please enter a valid email!';
- }
- //custom validations====================
- if (!current_user_can(EZ_XPF_MD_MEMBER) && !current_user_can(EZ_XPF_ADMINISTRATOR))
- {
- if (empty($_POST['field_3']) || empty($_POST['field_5']) || empty($_POST['field_6']) || empty($_POST['field_126']) || empty($_POST['field_127']))
- if (empty($_POST['field_177']))
- $errorlist['field_3'] = "REQUIRED FIELDS:<br>Street, City, State, ZIP/Postal AND Country<br>
- OR Phone Number<br>";
- }
- //end custom validations====================
- if ( !empty( $errorlist ) ) {
- foreach ( (array)$errorlist as $fieldname => $error_message )
- add_action( 'bp_' . $fieldname . '_errors', create_function( '', 'echo apply_filters(\'bp_members_signup_error_message\', "<div class=\"error\">' . $error_message . '</div>" );' ) );
- $errors = true;
- }
- // There are errors
- if ( !empty( $errors ) ) {
- bp_core_add_message( __( 'Please fill in all the required fields, below.', 'buddypress' ), 'error' );
- // No errors
- } else {
- // Reset the errors var
- $errors = false;
- // Now we've checked for required fields, lets save the values.
- foreach ( (array)$posted_field_ids as $field_id ) {
- // Certain types of fields (checkboxes, multiselects) may come through empty. Save them as an empty array so that they don't get overwritten by the default on the next edit.
- if ( empty( $_POST['field_' . $field_id] ) )
- $value = array();
- else
- $value = $_POST['field_' . $field_id];
- if ($field_id == 1)
- continue;
- if ($field_id == EZ_XPF_EMAIL)
- {
- if ($_POST['field_' . $field_id] != "")
- {
- $user_count = $wpdb->get_var("SELECT COUNT(*) FROM wp_users WHERE user_email='".$_POST['field_' . $field_id]."' AND `ID` <> '".$bp->displayed_user->id."'");
- //var_dump($user_count);exit;
- if ($user_count > 0)
- {
- $errors = 4;
- break;
- }
- }
- }
- $update_result = xprofile_set_field_data( $field_id, $bp->displayed_user->id, $value, $is_required[$field_id] );
- if ( !$update_result )
- {
- $errors = true;
- }
- else
- do_action( 'xprofile_profile_field_data_updated', $field_id, $value );
- }
- do_action( 'xprofile_updated_profile', $bp->displayed_user->id, $posted_field_ids, $errors );
- // Set the feedback messages
- if ( $errors == true)
- bp_core_add_message( __( 'There was a problem updating some of your profile information, please try again.', 'buddypress' ), 'error' );
- elseif ( $errors == 4)
- bp_core_add_message( "First and Second email address are duplicates. Please re-enter", 'error' );
- else
- bp_core_add_message( __( 'Changes saved.', 'buddypress' ) );
- // Redirect back to the edit screen to display the updates and message
- bp_core_redirect( trailingslashit( bp_displayed_user_domain() . $bp->profile->slug . '/edit/group/' . bp_action_variable( 1 ) ) );
- }
- }
- do_action( 'xprofile_screen_edit_profile' );
- bp_core_load_template( apply_filters( 'xprofile_template_edit_profile', 'members/single/home' ) );
- }
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- /********************** COMMENTS ********************
- *
- * FunctionName: function bp_the_profile_field_is_required()
- * Description: In some cases, the $field global is not an instantiation of the BP_XProfile_Field class. However, we have to make sure that all data originally in $field gets merged back in, after reinstantiation.
- * SourceFile: ../bp-core/bp-xprofile-template.php.
- * ChangeLog: Replace the 'function bp_the_profile_field_is_required()' statement and codeblock with the modified code block.
- *
- */
- function bp_the_profile_field_is_required() {
- echo bp_get_the_profile_field_is_required();
- }
- function bp_get_the_profile_field_is_required() {
- global $field;
- // Define locale variable(s)
- $retval = false;
- // Super admins can skip required check
- //if ( is_super_admin() && !is_admin() )
- if ((current_user_can(EZ_XPF_MD_MEMBER) || current_user_can(EZ_XPF_ADMINISTRATOR)) && $field->id != EZ_XPF_FIRSTNAME && $field->id != EZ_XPF_LASTNAME)
- $retval = false;
- // All other users will use the field's setting
- else
- if ( isset( $field->is_required ) )
- $retval = $field->is_required;
- return apply_filters( 'bp_get_the_profile_field_is_required', (bool) $retval );
- }
- function bp_get_the_profile_field_is_required2() {
- global $field;
- // Define locale variable(s)
- $retval = false;
- // Super admins can skip required check
- //if ( is_super_admin() && !is_admin() )
- if ( isset( $field->is_required ) )
- $retval = $field->is_required;
- return apply_filters( 'bp_get_the_profile_field_is_required', (bool) $retval );
- }
- *************************************************************************************************************************************
- /********************** COMMENTS ********************
- *
- * FunctionName: function get_showing_search_result(), function get_showing_search_result_current_user(), function get_showing_search_result_current_user_from_tpl()
- * Description: Adds custom search result functions.
- * SourceFile: ../bp-core/bp-xprofile-template.php.
- * ChangeLog: Add the following functions to the bp-xprofile-template..
- *
- */
- function get_showing_search_result($user_id)
- {
- $user_references = bp_get_option("showing_references");
- $user_ref = $user_references[$user_id];
- if ($user_ref["hide_street1"] === NULL)
- {
- $user_ref["hide_street1"] = 0;
- $user_ref["hide_street2"] = 0;
- $user_ref["hide_city"] = 0;
- $user_ref["hide_state"] = 0;
- $user_ref["hide_zip"] = 0;
- $user_ref["hide_country"] = 0;
- $user_ref["hide_email1"] = 0;
- $user_ref["hide_email2"] = 0;
- $user_ref["hide_phone1"] = 0;
- $user_ref["hide_phone2"] = 0;
- $user_ref["hide_profile"] = 0;
- $user_ref["hide_all"] = 0;
- }
- return $user_ref;
- }
- function get_showing_search_result_current_user()
- {
- global $bp;
- return get_showing_search_result($bp->displayed_user->id);
- }
- function get_showing_search_result_current_user_from_tpl()
- {
- global $members_template;
- return get_showing_search_result($members_template->member->id);
- }
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- END OF CORE MODS
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- *************************************************************************************************************************************
- /********************** COMMENTS ********************
- *
- * FunctionName: N/A
- * Description: Adds the filter to register the bp-dafault theme directory.
- * SourceFile: ../../wp-content/plugins/bp-custom.php
- * ChangeLog: Add the following filter to bp-custom.php.
- *
- */
- add_filter( 'bp_do_register_theme_directory', '__return_true' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement