- Cuando la dedicatoria se dedica a un usuario no registrado, tiene que pedir el país del usuario y mostrarlo todo en la dedicatoria.
- Cuando el usuario se registra, se asocian las dedicatorias con email al nuevos usuario. git-svn-id: https://192.168.0.254/svn/Proyectos.ASong2U_Web/trunk@75 cd1a4ea2-8c7f-e448-aada-19d1fee9e1d6
This commit is contained in:
parent
63d7647c13
commit
50be2467fd
@ -123,8 +123,7 @@ function bp_dedication_create_new_dedication() {
|
||||
if (count($friend_ids) > 1) {
|
||||
$friend_info = get_userdata($friend_ids[1]);
|
||||
add_post_meta($post_id, 'ghostpool_destination_user_id', $friend_info->ID);
|
||||
add_post_meta($post_id, 'ghostpool_destination_user_name', $friend_info->user_login);
|
||||
add_post_meta($post_id, 'ghostpool_destination_user_email', $friend_info->user_email);
|
||||
add_post_meta($post_id, 'ghostpool_destination_user_name', $friend_info->user_login);
|
||||
}
|
||||
|
||||
if (isset($friend_email) && (is_email($friend_email))) {
|
||||
|
||||
@ -107,7 +107,7 @@ function gp_get_flag_img_country($country_name = '', $flagsize=32) {
|
||||
} else {
|
||||
$src .= 'none.png';
|
||||
}
|
||||
return '<img class="dedicationFlag" src="' . $src . '" alt="' . $country_code . '"/>';
|
||||
return '<img class="dedicationFlag" src="' . $src . '" alt="' . $country_name . '"/>';
|
||||
}
|
||||
|
||||
|
||||
@ -710,16 +710,41 @@ 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']);*/
|
||||
}
|
||||
function asociate_dedications_to_new_user($user_id) {
|
||||
global $post;
|
||||
$user = get_user_by('id', $user_id);
|
||||
|
||||
$category_name = 'dedication';
|
||||
$post_status = array('publish', 'private');
|
||||
|
||||
_log('Email del usuario => ' . $user->user_email);
|
||||
|
||||
$args = array(
|
||||
'post_type' => array('post'),
|
||||
'posts_per_page' => -1,
|
||||
'post_status' => $post_status,
|
||||
'category_name' => $category_name,
|
||||
'meta_key' => 'ghostpool_destination_user_email',
|
||||
'meta_value' => $user->user_email
|
||||
);
|
||||
|
||||
$emailPosts = new WP_Query($args);
|
||||
|
||||
while ($emailPosts->have_posts()) {
|
||||
$emailPosts->the_post();
|
||||
|
||||
if (!update_post_meta(get_the_ID(), 'ghostpool_destination_user_id', $user_id))
|
||||
add_post_meta(get_the_ID(), 'ghostpool_destination_user_id', $user_id, true);
|
||||
if (!update_post_meta(get_the_ID(), 'ghostpool_destination_user_name', $user->user_login))
|
||||
add_post_meta(get_the_ID(), 'ghostpool_destination_user_name', $user->user_login, true);
|
||||
|
||||
delete_post_meta(get_the_ID(), 'ghostpool_destination_user_email');
|
||||
delete_post_meta(get_the_ID(), 'ghostpool_destination_user_country');
|
||||
|
||||
}
|
||||
wp_reset_postdata();
|
||||
}
|
||||
add_action( 'user_register', 'asociate_dedications_to_new_user');
|
||||
|
||||
//add_action( 'edit_user_profile_update', 'asociate_dedications_to_new_user' );
|
||||
|
||||
?>
|
||||
@ -38,8 +38,7 @@ $gp_settings['from_flag'] = gp_get_the_flag($gp_settings['from_user_id']);
|
||||
$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']);
|
||||
|
||||
$gp_settings['to_user'] = get_userdata($gp_settings['to_user_id']);
|
||||
|
||||
if ($gp_settings['to_user']) {
|
||||
$gp_settings['to_flag'] = gp_get_the_flag($gp_settings['to_user']->ID, 24);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user