From 63d7647c13a9a70c6d56d3367ea53ef85ab6b259 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 7 Aug 2012 18:47:45 +0000 Subject: [PATCH] =?UTF-8?q?Tarea=20#976=20->=20Visualizaci=C3=B3n=20de=20l?= =?UTF-8?q?as=20dedicatorias=20enviadas=20por=20email=20a=20pantalla=20com?= =?UTF-8?q?pleta=20(terminado)=20-=20Cuando=20la=20dedicatoria=20se=20dedi?= =?UTF-8?q?ca=20a=20un=20usuario=20no=20registrado,=20tiene=20que=20pedir?= =?UTF-8?q?=20el=20pa=C3=ADs=20del=20usuario=20y=20mostrarlo=20todo=20en?= =?UTF-8?q?=20la=20dedicatoria.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://192.168.0.254/svn/Proyectos.ASong2U_Web/trunk@74 cd1a4ea2-8c7f-e448-aada-19d1fee9e1d6 --- .../bp-dedication-create-dedication.php | 5 ++++ .../includes/js/dedication-script.js | 5 ++++ .../dedications/single/new-dedication.php | 6 ++++ wp-content/themes/score/functions.php | 28 +++++++++++++++++++ .../themes/score/loop-dedication-data.php | 6 ++-- 5 files changed, 48 insertions(+), 2 deletions(-) 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 '' . $country_code . ''; } +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 '' . $country_code . ''; +} + + 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