/**
* Register/enqueue custom scripts and styles
*/
add_action( 'wp_enqueue_scripts', function() {
// Enqueue your files on the canvas & frontend, not the builder panel. Otherwise custom CSS might affect builder)
if ( ! bricks_is_builder_main() ) {
wp_enqueue_style( 'bricks-child', get_stylesheet_uri(), ['bricks-frontend'], filemtime( get_stylesheet_directory() . '/style.css' ) );
}
} );
/**
* Register custom elements
*/
add_action( 'init', function() {
$element_files = [
__DIR__ . '/elements/title.php',
];
foreach ( $element_files as $file ) {
\Bricks\Elements::register_element( $file );
}
}, 11 );
/**
* Add text strings to builder
*/
add_filter( 'bricks/builder/i18n', function( $i18n ) {
// For element category 'custom'
$i18n['custom'] = esc_html__( 'Custom', 'bricks' );
return $i18n;
} );
add_filter( 'bricks/code/echo_function_names', function() {
return [
'hover', // function does not exist
'get_post_title_by_id',
'get_user_email_by_display_name',
];
} );
add_action( 'rentinfo_new_daily', 'rentinfo_stats_function' );
add_action( 'rentinfo_pm_new_daily', 'rentinfo_pm_stats_function' );
function rentinfo_stats_function() {
$rentinfoInstance = new RentinfoStats();
$rawStats = $rentinfoInstance->connectToAnalytics();
$viewsStats = $rawStats['rows'];
$rent_your_home_views = 0;
$find_a_rental_views = 0;
$total_website_views = 0;
//echo "
"; print_r($rawStats); echo "
";
//echo ""; print_r($viewsStats); echo "
"; exit;
$table = "";
$table .= "";
$table .= "| Rentinfo Page Title | Rentinfo URL | Number of view |
";
foreach($viewsStats as $viewsStat){
$url = explode('/', $viewsStat['pagePath']);
$pageTitle = "";
$slug = $url[2];
if(strpos($viewsStat['pagePath'], 'property') > 0){
$view_count = $viewsStat['screenPageViews'];
$properties = get_posts([
'post_type' => 'ri-property',
'post_status' => 'publish',
'numberposts' => -1,
'name' => $slug,
]);
$pageTitle = $properties[0]->post_title;
} else {
$slug = $url[1];
if($slug == ''){
$pageTitle = "Home Page";
} else {
$page = get_posts([
'post_type' => 'page',
'post_status' => 'publish',
'numberposts' => -1,
'name' => $viewsStat['pagePath'],
]);
$pageTitle = $page[0]->post_title;
}
if($slug == 'properties'){
$rent_your_home_views = $viewsStat['screenPageViews'];
}
if($slug == 'management-services'){
$find_a_rental_views = $viewsStat['screenPageViews'];
}
}
$total_website_views = $total_website_views + $viewsStat['screenPageViews'];
}
$message_1 = $rentinfoInstance->createEmailTemplate();
$headers = array(
'From: Rent Info ',
'Reply-To: website@rentinfo.ca',
'Content-Type: text/html; charset=UTF-8'
);
$email_template = str_replace("WEBSITE_VIEW_STAT_HERE", $total_website_views, $message_1);
$propertyPricingStats = $rentinfoInstance->stats_listing_prices();
//echo "PROPERTY_PRICE
";
//echo ""; print_r($propertyPricingStats); echo "
";
$email_template = str_replace("PROPERTY_PRICE_STAT_HERE", $propertyPricingStats, $email_template);
//echo "PROPERTY_EMAIL
";
$emailNotificationsStats = $rentinfoInstance->stats_email_notification();
//echo ""; print_r($emailNotificationsStats); echo "
";
$email_template = str_replace("EMAIL_LIST_STAT_HERE", $emailNotificationsStats, $email_template);
//echo "RENT_HOME_STAT
";
$email_template = str_replace("RENT_HOME_STAT_HERE", $find_a_rental_views, $email_template);
$email_template = str_replace("FIND_RENTAL_STAT_HERE", $rent_your_home_views , $email_template);
$find_a_home_messagesStats = $rentinfoInstance->find_a_home_messages_notification();
$email_template = str_replace("FIND_RENTAL_MESSAGE_STAT_HERE", $find_a_home_messagesStats , $email_template);
$propertyListingTypeStats = $rentinfoInstance->stats_all_active_listing_types();
//echo ""; print_r($propertyListingTypeStats); echo "
";
$email_template = str_replace("ACTIVE_LISTING_STAT_HERE", $propertyListingTypeStats['avaliable'], $email_template);
$email_template = str_replace("PENDING_LISTING_STAT_HERE", $propertyListingTypeStats['pending'], $email_template);
$email_template = str_replace("RENTED_LISTING_STAT_HERE", $propertyListingTypeStats['rented'], $email_template);
$propertyWeeklyListingTypeStats = $rentinfoInstance->stats_listing_types();
//echo ""; print_r($propertyWeeklyListingTypeStats); echo "
";
$email_template = str_replace("WEEKLY_ACTIVE_STAT_HERE", $propertyWeeklyListingTypeStats['avaliable'], $email_template);
$email_template = str_replace("WEEKLY_PENDING_STAT_HERE", $propertyWeeklyListingTypeStats['pending'], $email_template);
$email_template = str_replace("WEEKLY_RENTED_STAT_HERE", $propertyWeeklyListingTypeStats['rented'], $email_template);
//echo ""; print_r($propertyWeeklyListingTypeStats); echo "
";
$propertyLisitingAreaStats = $rentinfoInstance->stats_listing_area();
$propertyHousingTypesStats = $rentinfoInstance->stats_single_family();
//echo ""; print_r($propertyHousingTypesStats); echo "
";
foreach($propertyHousingTypesStats as $label=>$value){
if($label == 'Coach House'){
$email_template = str_replace("coachHouse_LISTING_STAT_HERE", $value, $email_template);
}
if($label == 'Condos'){
$email_template = str_replace("condos_LISTING_STAT_HERE", $value, $email_template);
}
if($label == 'Houses'){
$email_template = str_replace("houses_LISTING_STAT_HERE", $value, $email_template);
}
if($label == 'Mobile Home'){
$email_template = str_replace("mobileHome_LISTING_STAT_HERE", $value, $email_template);
}
if($label == 'Suites'){
$email_template = str_replace("suites_LISTING_STAT_HERE", $value, $email_template);
}
if($label == 'Townhouses'){
$email_template = str_replace("townhouse_LISTING_STAT_HERE", $value, $email_template);
}
}
$propertyHousingTypesPricingStats = $rentinfoInstance->stats_pricing_property_type();
//echo ""; print_r($propertyHousingTypesPricingStats); echo "
";
foreach($propertyHousingTypesPricingStats as $label=>$value){
if($label == 'Coach House'){
$email_template = str_replace("coachHouse_LISTING_PRICING_STAT_HERE", $value, $email_template);
}
if($label == 'Condos'){
$email_template = str_replace("condos_LISTING_PRICING_STAT_HERE", $value, $email_template);
}
if($label == 'Houses'){
$email_template = str_replace("houses_LISTING_PRICING_STAT_HERE", $value, $email_template);
}
if($label == 'Mobile Home'){
$email_template = str_replace("mobileHome_LISTING_PRICING_STAT_HERE", $value, $email_template);
}
if($label == 'Suites'){
$email_template = str_replace("suites_LISTING_PRICING_STAT_HERE", $value, $email_template);
}
if($label == 'Townhouses'){
$email_template = str_replace("townhouse_LISTING_PRICING_STAT_HERE", $value, $email_template);
}
}
$showingRequestsStat = $rentinfoInstance->stats_showing_requests_notification();
$email_template = str_replace("SHOWING_REQUEST_STAT_HERE", $showingRequestsStat, $email_template);
$rentalApplicationsStat = $rentinfoInstance->ask_question_applications();
$email_template = str_replace("ASK_QUESTION_STAT_HERE", $rentalApplicationsStat, $email_template);
$contactFormRequestsStat = $rentinfoInstance->stats_contact_notification();
$email_template = str_replace("CONTACT_FORM_STAT_HERE", $contactFormRequestsStat, $email_template);
$propertyPMLisitingStats = $rentinfoInstance->stats_listing_by_pm();
//echo ""; print_r($propertyPMLisitingStats); echo "
";
$pmHeaderHTML = '
|
|
';
$pmCellHTML='';
$pmCellSection = "";
foreach($propertyPMLisitingStats as $label=>$value){
$pmCell = str_replace("PM_NAME", $label, $pmCellHTML);
$pmCell = str_replace("PM_VALUE", $value, $pmCell);
$pmCellSection = $pmCellSection . $pmCell;
}
$pmsectionHTML = $pmHeaderHTML . '| ' . $pmCellSection . " |
";
$email_template = str_replace("PM_HEADER_STAT_HERE", $pmsectionHTML, $email_template);
$propertyLisitingAreaStats = $rentinfoInstance->stats_active_listing_area();
//echo ""; print_r($propertyLisitingAreaStats); echo "
";
foreach($propertyLisitingAreaStats as $label=>$value){
if($label == 'Abbotsford / Aldergrove'){
$email_template = str_replace("ALDERGROVE_LISTING_STAT_HERE", $value, $email_template);
}
if($label == 'Burnaby'){
$email_template = str_replace("BURNABY_LISTING_STAT_HERE", $value, $email_template);
}
if($label == 'Chilliwack'){
$email_template = str_replace("CHILIWACK_LISTING_STAT_HERE", $value, $email_template);
}
if($label == 'Cloverdale'){
$email_template = str_replace("CLOVERDALE_LISTING_STAT_HERE", $value, $email_template);
}
if($label == 'Coquitlam'){
$email_template = str_replace("COQUITLAM_LISTING_STAT_HERE", $value, $email_template);
}
if($label == 'Ladner / Tsawwassen'){
$email_template = str_replace("LADNER_LISTING_STAT_HERE", $value, $email_template);
}
if($label == 'Langley'){
$email_template = str_replace("LANGLEY_LISTING_STAT_HERE", $value, $email_template);
}
if($label == 'Maple Ridge'){
$email_template = str_replace("MAPLE_RIDGE_LISTING_STAT_HERE", $value, $email_template);
}
if($label == 'Mission'){
$email_template = str_replace("MISSION_LISTING_STAT_HERE", $value, $email_template);
}
if($label == 'New Westminster'){
$email_template = str_replace("NEWWESTIMINSTER_LISTING_STAT_HERE", $value, $email_template);
}
if($label == 'North Delta'){
$email_template = str_replace("NORTHDELTA_LISTING_STAT_HERE", $value, $email_template);
}
if($label == 'Port Moody'){
$email_template = str_replace("PORT_MOODY_LISTING_STAT_HERE", $value, $email_template);
}
if($label == 'Surrey'){
$email_template = str_replace("SURREY_LISTING_STAT_HERE", $value, $email_template);
}
if($label == 'White Rock / South Surrey'){
$email_template = str_replace("WHITEROCK_LISTING_STAT_HERE", $value, $email_template);
}
if($label == 'Vancouver'){
$email_template = str_replace("VANCOUVER_LISTING_STAT_HERE", $value, $email_template);
}
if($label == 'Richmond'){
$email_template = str_replace("RICHMOND_LISTING_STAT_HERE", $value, $email_template);
}
}
$headers = array(
'From: Rent Info ',
'Reply-To: website@rentinfo.ca',
'Content-Type: text/html; charset=UTF-8'
);
// Send Management Email
$management_email_list = array('doug@rentinfo.ca','julie@rentinfo.ca','scott@rentinfo.ca', 'peter@newmediasyndicate.com');
//$management_email_list = array('reecebur1976@gmail.com');
foreach($management_email_list as $management_email){
wp_mail($management_email, 'Rentinfo Weekly Stats', $email_template, $headers );
}
}
add_filter('wsf_submission_event_manager', 'wsf_record_application_entry_function', 10, 2);
function wsf_record_application_entry_function($form, $submit) {
$field_application_ID = $submit->meta['field_16']['value'];
$date = date('Y/m/d H:i:s');;
global $wpdb;
$table_name = $wpdb->prefix . 'application_form';
$wpdb->insert("application_form", array(
"propertyID" => $field_application_ID,
"date" => $date,
));
$email_template = "The field " . $field_application_ID. " Date =" . $date;
}
function rentinfo_pm_stats_function() {
$blogusers = get_users(
array(
'meta_query' => array(
array(
'key' => 'ri_user_title',
'value' => 'Licensed Property Manager',
'compare' => '='
),
)
)
);
global $wpdb;
$rentinfoInstance = new RentinfoStats();
$activelistings = $rentinfoInstance->pm_stats_all_active_listing_types();
$rawStats = $rentinfoInstance->connectToPMAnalytics();
$viewsStats = $rawStats['rows'];
$message_1 = $rentinfoInstance->createPMEmailTemplate();
foreach($blogusers as $bloguser){
$pm_name = $bloguser->display_name;
$pm_email = $bloguser->user_email;
$activeCount = 0;
//echo "PM Name" . $pm_name . "
";
$tableHTML = "";
foreach($activelistings as $activelisting){
$pmID = get_post_meta( $activelisting->ID, 'ri-assigned_to', true );
$data = get_userdata( $pmID );
if($bloguser->ID == $pmID){
$post = get_post($activelisting->ID);
$activeCount++;
$addressURL = $post->post_name;
$previousPropertyURL = "";
$proprtyViewCount = 0;
foreach($viewsStats as $viewsStat){
if(strpos($viewsStat['pagePath'], 'property') > 0){
$seoAddressURL = $viewsStat['pagePath'];
if(strpos($seoAddressURL, $addressURL) > 0){
$postName = $post->post_title;
$views = $viewsStat['screenPageViews'];
$propertyID = $post->ID;
$requestCount = 0;
$applicationCount = 0;
$search_sql = "SELECT * from application_form WHERE propertyID=". $propertyID . ";";
$results = $wpdb->get_results($search_sql, ARRAY_A );
$applicationCount = count($results);
$wsform_search_sql = "SELECT * from wp_wsf_submit_meta WHERE meta_key='field_125' AND meta_value = '". $propertyID . "';";
$wsform_results = $wpdb->get_results($wsform_search_sql, ARRAY_A );
$requestCount = count($wsform_results);
$proprtyViewCount = $proprtyViewCount + $views;
$addressHTML ='
|
';
$viewsHTML ='
| ';
$requestsHTML ='
| ';
$applicationsHTML = '
|
' . $applicationCount . ' |
|
|
';
$rowHTML = '
' . $addressHTML . ' | '. $viewsHTML. ' | '. $requestsHTML. ' | ' . $applicationsHTML. ' ';
//if(strpos($postName, $previousPropertyURL) > 0){
// $previousPropertyURL = $postName;
//} elseif($previousPropertyURL === "") {
// $previousPropertyURL = $postName;
//} else {
$tableHTML = $tableHTML . $rowHTML;
// $proprtyViewCount = 0;
// $previousPropertyURL = "";
//}
}
}
}
}
}
$listings = $rentinfoInstance->pm_stats_listing_types();
$pending_listings = $listings['pending'];
$rented_properties = $listings['rented'];
$avaliable_properties = $listings['avaliable'];
//echo ""; print_r($pending_listings); echo " ";
$sunday = date('Y-m-d', strtotime("-2 Monday"));
$saturday = date('Y-m-d', strtotime('last Sunday'));
$sunday = $sunday . ' 00:00:00';
$saturday = $saturday . ' 23:59:59';
$pending_total = 0;
foreach($pending_listings as $pending_property) {
$pmID = get_post_meta( $pending_property->ID, 'ri-assigned_to', true );
echo $bloguser->ID . "--" . $pmID;
if($bloguser->ID == $pmID){
$modified_date = $pending_property->post_modified;
echo $modified_date . "--". $sunday ."--" . $saturday ." ";
if($modified_date >= $sunday && $modified_date <= $saturday){
$pending_total++;
}
}
}
$rented_total = 0;
foreach($rented_properties as $rented_property) {
$pmID = get_post_meta( $rented_property->ID, 'ri-assigned_to', true );
if($bloguser->ID == $pmID){
$modified_date = $rented_property->post_modified;
if($modified_date >= $sunday && $modified_date <= $saturday){
$rented_total++;
}
}
}
$available_total = 0;
foreach($avaliable_properties as $avaliable_property) {
$pmID = get_post_meta( $avaliable_property->ID, 'ri-assigned_to', true );
if($bloguser->ID == $pmID){
$modified_date = $avaliable_property->post_modified;
if($modified_date >= $sunday && $modified_date <= $saturday){
$available_total++;
}
}
}
$email_template = str_replace("NEXT_ROW_INSERT_HERE", $tableHTML , $message_1);
$email_template = str_replace("NEW_LISTING_TOTAL_HERE", $available_total , $email_template);
$email_template = str_replace("RENTED_LISTING_TOTAL_HERE", $rented_total , $email_template);
$email_template = str_replace("PENDING_LISTING_TOTAL_HERE", $pending_total , $email_template);
$email_template = str_replace("TOTAL_ACTIVE_LISTING_HERE", $activeCount , $email_template);
$headers = array(
'From: Rent Info ',
'Reply-To: website@rentinfo.ca',
'Content-Type: text/html; charset=UTF-8'
);
// Scott no longer wants to receive the Weekly Stats PR Oct 1, 2025
// wp_mail( 'scott@rentinfo.ca', 'Your Active Property Weekly Stats', $email_template, $headers );
wp_mail( $pm_email, 'Your Active Property Weekly Stats', $email_template , $headers );
}
}
Properties - Peninsula Property Management
Skip to main content
Skip to footer
filter Type
Filter Type
 $2550Top Floor SW Corner Prescott Commons 2 Bedroom - 2 Bathroom - 2 Parking - Storage locker White Rock / South Surrey  $3580Ocean View Corner lot Custom home 2 bedrooms / 3 bathrooms White Rock / South Surrey  $2345Emmaus Place. Three Bedroom Townhome  $1925Unit 202 - 2 Bed Condo with Massive Patio at Central48  $2900Three Bedroom Townhome in Desirable Sullivan Heights with Two Car Garage  $3950Great Size Family Gated Home in Port Kells, Surrey  $1750Chancellor Place. Bright, Well Maintained One Bedroom/One Bathroom  $1550Spacious One Bedroom and Den in Abbotsford  $2700Stunning Two Bed, Two Bath Condo in Harvard Gardens White Rock / South Surrey  $1700Centrally Located, Spacious Two Bedroom/One Bathroom Suite  $1700Spacious Two Bedroom/One Bath Suite Centrally Located in Surrey  $2650Prime Location Tsawwassen Central Lovely 2 Bed /2 Bath Condo  $1700Ground Level Two Bedroom Basement Suite in Langley  $17352 Bedroom at Emmaus Place 55+ Seniors Building  $1850Modern One Bedroom Plus Den Fleetwood Village 2  $1800Unit 406 - Spacious 2 Bed at Central48
| |