For example, you need to save list of users, who entered each page or post:
<?php global $post, $current_user; $data = unserialize(get_post_meta($post->ID, '_list', true)); if( count($data) != 0 ) { if ( !in_array( $current_user->ID, $data ) ) { $data[] = $current_user->ID; } $data = array_unique($data); // remove duplicates sort( $data ); // sort array $data = serialize($data); update_post_meta($post->ID, '_list', $data); } else { $data = array(); $data[0] = $current_user->ID; $data = serialize($data); update_post_meta($post->ID, '_list', $data); } ?>
