Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
plugins-topic
Hiding Poster Email and IP Address from Email that is Sent to Admins
Avatar
Jonathan Blyer
Member
sp_UserOfflineSmall Offline
May 1, 2012 - 3:41 pm

HI, I need to hide the email address and the IP address from the email that is sent to admins who have enabled the "receive email notifications on all topics/posts" option here: wp-admin/admin.php?page=simple-press/admin/panel-admins/spa-admins.php

The email that is sent has "From" and "Poster IP" fields. Can you direct me to the file I need to edit in order to remove the email address from the "From" field and remove the "Poster IP" field completely? Any tips on how to edit the file would also be most helpful

Thanks! 

Avatar
Jonathan Blyer
Member
sp_UserOfflineSmall Offline
May 1, 2012 - 6:27 pm

I located the file that formats the output. For anybody curious in the future, it's here: 

simple-press/forum/library/sp-post-support.php

Line 56 is where the message body construction begins. It's an easy edit there.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
May 1, 2012 - 8:43 pm

that is not the best way to do that... editing core that is... you will have to make the same change on every update...

you would be better off using the filter 'sph_admin_email' on the email and stripping out the stuff you dont want... save upgrades later...

still, good work...

Avatar
Jonathan Blyer
Member
sp_UserOfflineSmall Offline
May 2, 2012 - 8:12 am

Thanks. Yes, I was concerned about having make the change on every update. What specifically do I need to do to use the filter 'sph_admin_email'? (I actually thought that's what I was doing...)

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
May 2, 2012 - 9:11 am

The filter passes three data items - the final message text, the $newpost array and the admins email address. From this you can freely restructure the email message as all the data necessary is available. And the $newpost array is already familiar to you from editing the current code.

To use this you would define the use of the filter in the sp theme spFunctions.php (templates folder). As always we recommend that you create your own SP theme so that any customisation is not lost during a future update. (http://codex.simple-press.com/.....g-a-theme/)

You might be able to put it in the WP theme functions file as well as I believe that should be loaded in time. Might be worth a try.

You use this like any WP filter:

add_filter('sph_admin_email', 'your_function_name', 1, 3);
function your_function_name($message, $newpost, $admin_email) {
    # do whatever you want to the $message;
    return $message;
}

Your alterations to the $message text - or replacement $message will be what is used in the email.

andy-signature.png
YELLOW
SWORDFISH
Avatar
Jonathan Blyer
Member
sp_UserOfflineSmall Offline
May 2, 2012 - 2:24 pm

Ah, this is great. Much cleaner. Thanks!

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
May 2, 2012 - 2:42 pm

Sounds like you got what you needed. That's good news and thanks for letting us know.

andy-signature.png
YELLOW
SWORDFISH
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17362
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625