Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to remove duplicate posts in Feedzy Block Settings #855

Open
AndreeaCristinaRadacina opened this issue Jan 12, 2024 · 6 comments
Labels
customer report Indicates the request came from a customer. doc-needed This issue requires documentation updates or additions once it has been completed. new feature Request for a new feature or functionality to be added to the project.

Comments

@AndreeaCristinaRadacina

What problem does this address?

A user asked about the possibility of removing duplicate posts from the Feedzy block.

ref: https://secure.helpscout.net/conversation/2476456248/399930?viewId=212385

What is your proposed solution?

Under the Content tab > Feed Source, include a new toggle to remove duplicate posts, similar to what we have in Feed2Post.

Will this feature require documentation? (Optional)

Yes, it requires documentation.

@AndreeaCristinaRadacina AndreeaCristinaRadacina added the new feature Request for a new feature or functionality to be added to the project. label Jan 12, 2024
@pirate-bot pirate-bot added customer report Indicates the request came from a customer. doc-needed This issue requires documentation updates or additions once it has been completed. labels Jan 12, 2024
@vytisbulkevicius
Copy link
Contributor

@AndreeaCristinaRadacina,

Doesn't this code snippet help for the scenario described by the user? https://docs.themeisle.com/article/942-in-feedzy-how-do-i#eliminate-duplicate

@AndreeaCristinaRadacina
Copy link
Author

Hey Vytis,

Thank you for your reply!
Based on the latest replies, it looks like it doesn't.

However, my inquiry referred more to the idea of having it integrated into the plugin for consistent behavior among the feed display methods.

@poonam279
Copy link

The user has shared the following feed URLs https://www.alcatrax.it/feed, https://www.ilrapitaliano.it/feed/, and https://www.hiphopitaly.com/feed. However, the solution mentioned in https://docs.themeisle.com/article/942-in-feedzy-how-do-i#eliminate-duplicate does not work with the Feedzy block.

@vytisbulkevicius
Copy link
Contributor

vytisbulkevicius commented Jan 16, 2024

@AndreeaCristinaRadacina, @poonam279,

The custom code doesn't work for this customer because custom code checks for duplicates by permalink. He's using 3 different feeds and all 3 URLs (domains) are different so permalinks aren't the same, that's why custom code doesn't find them as duplicates.

They have same content and same title, so we need to modify the custom code to find duplicate titles and then it will work for him (tested with his feeds).

Here is the working code for him (which checks for titles and removes duplicates):

function tifd_feedzy_remove_duplicates( $items, $feedURL ) {
	$uniques = array();
	foreach ( $items as $item ) {
		if ( isset( $uniques[ strval( md5( $item->get_title() ) ) ] ) ) {
			continue;
		}
		$uniques[ md5( $item->get_title() ) ] = $item;
	}
	return array_values( $uniques );
}  
add_filter( 'feedzy_feed_items', 'tifd_feedzy_remove_duplicates', 10, 2 );

@poonam279
Copy link

Thanks @vytisbulkevicius, This code works as expected. It removes the duplicates based on the titles on the frontend. However, they are still visible in the backend. Screenshot: https://vertis.d.pr/v/N4mFvn

@vytisbulkevicius
Copy link
Contributor

Yes, it was always like this @poonam279 but we can keep this in mind to have as a feature inside block not with a custom code so it would work in backend as well but we won't prioritize this now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer report Indicates the request came from a customer. doc-needed This issue requires documentation updates or additions once it has been completed. new feature Request for a new feature or functionality to be added to the project.
Projects
None yet
Development

No branches or pull requests

4 participants