pfefferle / wordpress-semantic-linkbacks

More meaningfull linkbacks
https://wordpress.org/plugins/semantic-linkbacks
MIT License
31 stars 18 forks source link

Adopt MF2 prefixed properties #95

Closed dshanske closed 2 years ago

dshanske commented 7 years ago

As has become a 'standard' in the Indieweb community, microformats2 properties use the name of the property prefixed by mf2.

That means 'semantic_linkbacks_avatar' should be changed to mf2_photo or a nested property of mf2_author->photo.

Type, as discussed, probably should be moved to the comment_type box. But otherwise, the relevant property... like-of, in-reply-to, etc. Which the new version of Semantic Linkbacks already stores.

'semantic_linkbacks_canonical' should move to mf2_url.

Backcompat can be achieved by adding a filter to get_comment_meta to retrieve the new property if someone asks for the old one and it isn't there.

dshanske commented 7 years ago
function get_semantic_linkbacks_comment_meta( $value, $comment_ID, $meta_key, $single ) {
 if ( 'semantic_linkbacks_canonical' == $meta_key ) {
                  return get_comment_meta( $comment_ID, 'mf2_url', $single );
           }

          return null;
 }

 add_filter( 'get_comment_metadata', 'get_semantic_linkbacks_comment_meta', 10, 4 );

This should be the easiest solution for backcompat. Start storing in the new location, and if anyone asks for the old info, give them the new one.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.