Replies
Thank you for your help Brajesh. With this information, Francesco was able to offer a solution. We appreciate your help.
Hi Brajesh,
Francesco shared the following when asked about a filter:
“If the custom profile tabs you’re using comply with—and don’t interfere with—wp_enqueue_script and wp_enqueue_style (the WordPress functions for adding scripts and styles to a page), I believe I can provide a plugin version that bypasses the singular post limitation by tomorrow (it’s late evening here in Italy). With this version, you’ll be able to use the ebook viewer on custom pages by applying a filter, though the limitation of one viewer instance per page will still remain.”
He will deliver this as a custom build, which means there will be a fee, so we want to be confident it will resolve the issue.
Do you think this approach will solve the problem?
Thank you, Brajesh.
Francesco responded the following:
“Hi, probably the issue is that the plugin can handle only one viewer per page, so there is a guard in the function that sets up the resources for the plugin to work:
if (!is_singular()) {
return;
}If the page is not of a single post (https://developer.wordpress.org/reference/functions/is_singular/), the resources are not loaded.
I’m not familiar with the BuddyPress’s custom tabs, so I’m not sure if you can configure them to meet the is_singular() requirement. If you can, that would be the optimal solution.
Otherwise, if you are sure that there will always be only one viewer in that page, an ugly hack would be to remove the guard directly from the source code of the function (the function is conditionally_enqueue_assets in the file includes/simebv-viewer.php). Obviously, any subsequent update of the plugin will overwrite this change.
I’m working in these days at a new version of the plugin, if you confirm that my guess is correct and this is the issue, I’ll try to look at it for a fix, but I can’t make any promises about precise timings.”
Do you have a response that I can send to him?