• Your cart is empty.

A A A
Avatar
Search
Forum Scope






Start typing a member's name above and it will auto-complete

Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_Print plugins-topic
Subscriptions plugin - email link permissions issue
Avatar
Jonathan Blyer
Forum Posts: 8
Member Since:
Apr 20, 2012
sp_UserOfflineSmall Offline
1
Jul 15, 2019 - 2:31 pm
sp_Permalink sp_Print

I am experiencing an issue with the subscriptions plugin, that seems to apply to both the daily digest notification emails, as well as the individual post notification emails.

When these emails are sent out, all links are replace with the “Hidden links custom message” (found in the forum options -> Content Settings -> Post Links Filtering.

I have checked that the user’s permissions are correct, and we allow users to view links in messages.

I am also unable to find within the source code exactly where this filtering is applied.

This issue is appearing on our production site, and so far I have been unable to reproduce the problem when running a copy of the site locally (I’m testing the digest emails by manually triggering the cron job under Forum -> toolbox- > cron inspector).

Any ideas on what might be going on here, or how to better troubleshoot the issue?

Since it seems to only happen in one environment, is it possible the cron job that sends out emails needs some permissions configured as well?

Thanks!

Avatar
SP Community Support
Forum Posts: 94
Member Since:
Feb 12, 2019
sp_UserOfflineSmall Offline
2
Jul 15, 2019 - 3:18 pm
sp_Permalink sp_Print

Hi:

hmmm…I don’t have any ideas as to what might be happening there.  The local copy of the site was made from the live site with no changes? 

As far as the code, it looks like the filtering itself is in the simpleplress/sp-api\sp-ai-class-spcdisplayfilters.php file. Around line #65.  There’s a function call to the hidelinks() function there.

Thanks.

Did you know? Simple:Press is now available directly from the WordPress.org plugin repository. 

If you like what we're doing, please consider rating us in their review section: WordPress.org reviews. This helps to get the word out about Simple:Press!

Click here to rate and review Simple:Press.

Avatar
Jonathan Blyer
Forum Posts: 8
Member Since:
Apr 20, 2012
sp_UserOfflineSmall Offline
3
Jul 16, 2019 - 8:47 am
sp_Permalink sp_Print

I took a look at the hidelinks() function and I can see that there is a filter sph_display_hidelinks_filter.

However, if I add a filter for this, it seems like it never gets called when creating email content.

I can see that hidelinks is called from spcDisplayFilters->content($content), but I cannot see where content is called when creating an email notification.

Here is the filter I’ve added, maybe I am doing something wrong here?

add_filter('sph_display_hidelinks_filter', function($content, $original) {
    error_log("running sph_display_hidelinks_filter");
    return $content;
});

When Simple Press generates a notification is it getting permissions for the individual user?

Avatar
Jonathan Blyer
Forum Posts: 8
Member Since:
Apr 20, 2012
sp_UserOfflineSmall Offline
4
Aug 18, 2019 - 4:42 pm
sp_Permalink sp_Print

Okay I took another look at this and can see a few more details about how this is working, but I still don’t have a definitive answer. It certainly seems like there is some kind of bug here, or conflict between different forum plugins.

I believe this issue is from a combination of the html emails plugin and the subscriptions plugin.

I can also confirm that this problem only occurs for the digest emails. Regular subscription emails are fine.

The function “sp_html_email_do_digests_entry” on line 353 of sp-html-email-components.php is called using the filter “sp_html_email_do_digests_entry” which gets run at the very end of composing a digest email as part of the subscription plugins “sph_subscriptions_digest_entry” filter.

On line 366 of sp-html-email-components.php the displayFilters->content() function is run on the digest email body content.

On line 64 and 65 of ‘sp-ali-class-spcdisplayfilters.php’ this content() function will attempt to hide any links included in the content if this particular forum does not have permission to view the links.

# 14: hide links
$forum_id = (!empty(SP()->rewrites->pageData['forumid'])) ? SP()->rewrites->pageData['forumid'] : '';
if (!SP()->auths->get('view_links', $forum_id)) $content = $this->hidelinks($content);

It is difficult to tell exactly what this code is doing, but it would seem the problem is somewhere in these two lines.

I’m not entirely sure what sp()->rewrites is, but is it possible that we are trying to get the forumid from part of the current navigation through the site, or the current page?

I suspect this won’t work since this function is called as part of a cron job through the subscription digest plugin. I suspect the forumid is returning blank, and the call to sp()->auths then always returns false, thereby always calling the hidelinks function.

This might also help explain why I’m seeing different behavior in different environments (depending on how “sp()->rewrites->pageData” is working…).

Any insight is much appreciated!

Forum Timezone: America/New_York
Most Users Ever Online: 444
Currently Online:
20
Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Ike: 2086
Brandon: 864
kvr28: 804
jim: 614
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 357
Stefano Prete: 325
Carlos: 291
Newest Members:
asd asd
quantfloor
sébastien etchar
Ryan Vaughan
marie davis
Tony Occhionero
Crazy Sucht
Felicia Arrington
Troy Locke
Forum Stats:
Groups: 7
Forums: 17
Topics: 9857
Posts: 78546

 

Member Stats:
Guest Posters: 600
Members: 16588
Moderators: 0
Admins: 5
Administrators: Yellow Swordfish, Mr Papa, elindydotcom, Simple Press, SP Community Support