https://redmine.gc.cuny.edu/https://redmine.gc.cuny.edu/favicon.ico2021-10-26T19:36:28ZCUNY Graduate Center - Project Tracking SystemCUNY Academic Commons - Feature #14256: "Latest News" feedhttps://redmine.gc.cuny.edu/issues/14256?journal_id=649262021-10-26T19:36:28ZBoone Gorgesboone@gorg.es
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Testing Required</i></li></ul><p>Here's background on how this is built:</p>
<p>- The list of sites that are the source for Latest News is defined here <a class="external" href="https://github.com/cuny-academic-commons/cac/blob/f3158f150819ff9c7ae901c07dc4ba4b215ac0e6/wp-content/mu-plugins/cac-functions.php#L341">https://github.com/cuny-academic-commons/cac/blob/f3158f150819ff9c7ae901c07dc4ba4b215ac0e6/wp-content/mu-plugins/cac-functions.php#L341</a><br />- On the home page, the latest items from these source sites is pulled using the WP REST API. See <a class="external" href="https://github.com/cuny-academic-commons/cac/blob/f3158f150819ff9c7ae901c07dc4ba4b215ac0e6/wp-content/themes/bp-nelo/parts/home/latest-news.php#L3">https://github.com/cuny-academic-commons/cac/blob/f3158f150819ff9c7ae901c07dc4ba4b215ac0e6/wp-content/themes/bp-nelo/parts/home/latest-news.php#L3</a>. I tried doing this with <code>switch_to_blog()</code>, but that function isn't sufficient - things like fetching post thumbnails failed because of limitations in blog-switching and persistent caching. I made a modification to the /posts/ endpoint on the source sites so that the post thumbnail is included in the payload <a class="external" href="https://github.com/cuny-academic-commons/cac/blob/f3158f150819ff9c7ae901c07dc4ba4b215ac0e6/wp-content/mu-plugins/cac-functions.php#L366">https://github.com/cuny-academic-commons/cac/blob/f3158f150819ff9c7ae901c07dc4ba4b215ac0e6/wp-content/mu-plugins/cac-functions.php#L366</a> <br />- Because we are using Featured Images, it's critical that items on in.commons and news.commons always have Featured Images. Scott, I've added you as a watcher so that this can become part of the team workflow.<br />- The API calls are cached, and the cache is invalidated when a new post appears on one of the source sites. <a class="external" href="https://github.com/cuny-academic-commons/cac/blob/f3158f150819ff9c7ae901c07dc4ba4b215ac0e6/wp-content/mu-plugins/cac-functions.php#L353">https://github.com/cuny-academic-commons/cac/blob/f3158f150819ff9c7ae901c07dc4ba4b215ac0e6/wp-content/mu-plugins/cac-functions.php#L353</a></p> CUNY Academic Commons - Feature #14256: "Latest News" feedhttps://redmine.gc.cuny.edu/issues/14256?journal_id=649272021-10-26T19:37:07ZBoone Gorgesboone@gorg.es
<ul></ul><p>Quick follow-up: The REST API mods were necessary for development testing, so I had to deploy them prematurely to the production site. So they can be found in the 1.18.x branch.</p> CUNY Academic Commons - Feature #14256: "Latest News" feedhttps://redmine.gc.cuny.edu/issues/14256?journal_id=664382022-01-04T15:48:23ZBoone Gorgesboone@gorg.es
<ul><li><strong>Status</strong> changed from <i>Testing Required</i> to <i>Staged for Production Release</i></li></ul> CUNY Academic Commons - Feature #14256: "Latest News" feedhttps://redmine.gc.cuny.edu/issues/14256?journal_id=664592022-01-04T16:24:25ZBoone Gorgesboone@gorg.es
<ul><li><strong>Status</strong> changed from <i>Staged for Production Release</i> to <i>Resolved</i></li></ul>