I have a big network with subdomains (many of which use domains).
I thought about solving this problem with cookies but after some research I don’t think that crossdomain cookies is a best Idea.
So I imagine this happing by saving in users meta some array of blogs and then displaying them on main page.
I came across update_user_meta() which is very handy in my case.
global $blog_id;
$current_blog_details = get_blog_details( array( 'blog_id' => $blog_id ) );
if (is_user_logged_in()) {
$user = wp_get_current_user();
update_user_meta($user->ID, 'last_visited_blogs', $current_blog_details->blogname);
}
I save this function inside admin-bar.php so every blog shares this code.
Now I want to remake this code to use save 5 last visited blogs as an array and then get those values and display on some place.
First question would be how to save 5 sites.
I guess update is not my case no?
Thank you for your attantion, I made it working with update_user_meta
Here is my little function I wrote
I use it in my admin-bar, if you need you can use it anywhere, needs a little modifications though