Support Forum

Hiding Poster Email and IP Address from Email that is Sent to Admins

JB Jonathan Blyer
Jonathan Blyer
Member

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! 

6 Answers

New Answer

JB Jonathan Blyer
Jonathan Blyer
Member

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.

MP Mr Papa
Mr Papa
Member

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…

JB Jonathan Blyer
Jonathan Blyer
Member

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…)

YS Yellow Swordfish
Yellow Swordfish
Member

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/codex/themes/theme-basics/creating-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.

JB Jonathan Blyer
Jonathan Blyer
Member

Ah, this is great. Much cleaner. Thanks!

YS Yellow Swordfish
Yellow Swordfish
Member

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