Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter nattila

    (@nattila)

    I have a solution

    $favorite_post_ids = wpfp_get_users_favorites();
    
    	//merge cookie favs for members
    	if (is_user_logged_in()){
    		$cookie_favorites = wpfp_get_cookie();
    		foreach ($cookie_favorites as $key => $cookie_favorite){
    			//echo $key;
    			if (!in_array($key, $favorite_post_ids)) {
    				//add favorite to db
    				wpfp_add_to_usermeta($key);
    			}
    		}
    		//refresh favorites
    		$favorite_post_ids = wpfp_get_users_favorites();
    	}
    	... display favorites
    williamderman

    (@williamderman)

    Where would this need to go in order to make it work? Please help?

    williamderman

    (@williamderman)

    I’m not sure where this is supposed to go please can you advise?

    Thread Starter nattila

    (@nattila)

    Hi,
    Instead of using official shortcode to display favorites I created a custom template file which contains the code above. The $favorite_post_ids contains the favorited posts IDs.
    Try to put this code into a custom page template and after this code snippet you have two options:
    -Probably the official wpfp_list_favorite_posts(); will also work,
    -or you can create a custom loop to display favorites post from $favorite_post_ids

    I hope it helps but you need some programming knowledge to solve this issue.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Merge cookie favorites with logged in favorites’ is closed to new replies.