diff --git a/wp-content/plugins/bp-dedication/includes/bp-dedication-create-dedication.php b/wp-content/plugins/bp-dedication/includes/bp-dedication-create-dedication.php
index d9e1962..94a37cd 100644
--- a/wp-content/plugins/bp-dedication/includes/bp-dedication-create-dedication.php
+++ b/wp-content/plugins/bp-dedication/includes/bp-dedication-create-dedication.php
@@ -29,6 +29,10 @@ function bp_dedication_create_new_dedication() {
if (isset($_POST['friend_email'])) {
$friend_email = $_POST['friend_email'];
+
+ if (isset($_POST['dedicate_to_country'])) {
+ $friend_country = $_POST['dedicate_to_country'];
+ }
}
if (isset($_POST['video_url'])) {
@@ -125,6 +129,7 @@ function bp_dedication_create_new_dedication() {
if (isset($friend_email) && (is_email($friend_email))) {
add_post_meta($post_id, 'ghostpool_destination_user_email', $friend_email);
+ add_post_meta($post_id, 'ghostpool_destination_user_country', $friend_country);
}
$imageurl = $videoData['thumbnail'];
diff --git a/wp-content/plugins/bp-dedication/includes/js/dedication-script.js b/wp-content/plugins/bp-dedication/includes/js/dedication-script.js
index 5b783e4..d6ef91e 100644
--- a/wp-content/plugins/bp-dedication/includes/js/dedication-script.js
+++ b/wp-content/plugins/bp-dedication/includes/js/dedication-script.js
@@ -61,14 +61,19 @@ jQuery(document).ready(function(){
if(j('#dedicate_to_input').val() == '') {
j('#friend_ids').val('');
j('#friend_email').val('');
+ j('#dedicate_to_country').val('');
+ j('#country_select').addClass('hidden');
}
if(j('#dedicate_to_input').val().indexOf('@', 0) != -1 && j('#dedicate_to_input').val().indexOf('.', 0) != -1) {
j('#friend_email').val(j('#dedicate_to_input').val());
j('#friend_ids').val(',-1');
+ j('#country_select').removeClass('hidden');
} else {
j('#friend_email').val('');
j('#friend_ids').val('');
+ j('#dedicate_to_country').val('');
+ j('#country_select').addClass('hidden');
}
});
diff --git a/wp-content/themes/score/dedications/single/new-dedication.php b/wp-content/themes/score/dedications/single/new-dedication.php
index 7409f17..b787457 100644
--- a/wp-content/themes/score/dedications/single/new-dedication.php
+++ b/wp-content/themes/score/dedications/single/new-dedication.php
@@ -52,6 +52,12 @@ global $bp;
+
+
+
+
diff --git a/wp-content/themes/score/functions.php b/wp-content/themes/score/functions.php
index 0631ac7..ac00c77 100644
--- a/wp-content/themes/score/functions.php
+++ b/wp-content/themes/score/functions.php
@@ -97,6 +97,20 @@ function gp_get_flag_img($country_code = '', $flagsize=32) {
return '
';
}
+function gp_get_flag_img_country($country_name = '', $flagsize=32) {
+ global $countries_array;
+
+ $src = get_template_directory_uri() . '/lib/images/flags/'.$flagsize.'/';
+ if ($country_name) {
+ $country_code = array_search($country_name, $countries_array);
+ $src .= strtolower($country_code) . '.png';
+ } else {
+ $src .= 'none.png';
+ }
+ return '
';
+}
+
+
function gp_get_the_flag($userid, $flagsize=32) {
if ($userid) {
if (bp_has_profile('user_id=' . $userid)) {
@@ -694,4 +708,18 @@ function gp_encoded_dedication_redirect_for_users() {
}
add_action('wp', 'gp_encoded_dedication_redirect_for_users', 2);
+
+
+function asociate_dedications_to_new_user($user_id) {
+/* if (!current_user_can('edit_user', $user_id)) {
+ return false;
+ }
+ update_user_meta($user_id, 'address', $_POST['address']);
+ update_user_meta($user_id, 'city', $_POST['city']);
+ update_user_meta($user_id, 'province', $_POST['province']);
+ update_user_meta($user_id, 'postalcode', $_POST['postalcode']);*/
+}
+
+//add_action( 'edit_user_profile_update', 'asociate_dedications_to_new_user' );
+
?>
\ No newline at end of file
diff --git a/wp-content/themes/score/loop-dedication-data.php b/wp-content/themes/score/loop-dedication-data.php
index 12cf904..d6cccc9 100644
--- a/wp-content/themes/score/loop-dedication-data.php
+++ b/wp-content/themes/score/loop-dedication-data.php
@@ -37,15 +37,17 @@ $gp_settings['from_flag'] = gp_get_the_flag($gp_settings['from_user_id']);
// to user
$gp_settings['to_user_id'] = get_post_meta($post->ID, 'ghostpool_destination_user_id', true);
$gp_settings['to_user_email'] = get_post_meta($post->ID, 'ghostpool_destination_user_email', true);
+$gp_settings['to_user_country'] = get_post_meta($post->ID, 'ghostpool_destination_user_country', true);
$gp_settings['to_user'] = get_user_by ('id', $gp_settings['to_user_id']);
+
if ($gp_settings['to_user']) {
$gp_settings['to_flag'] = gp_get_the_flag($gp_settings['to_user']->ID, 24);
$gp_settings['to_user_link'] = ''.bp_core_get_username($gp_settings['to_user']->ID).'';
//bp_core_get_userlink($gp_settings['to_user']->ID);
} else {
- $gp_settings['to_flag'] = gp_get_the_flag('', 24);
- $gp_settings['to_user_link'] = get_post_meta($post->ID, 'ghostpool_destination_user_name', true);
+ $gp_settings['to_flag'] = gp_get_flag_img_country($gp_settings['to_user_country'], 24);
+ $gp_settings['to_user_link'] = $gp_settings['to_user_email'];
}
// Post Text Width