Support Forum
dont edit the core code function... use the hooks on it to adjust as you want...
if you look at the code, you will see some apply_filters() calls... you can hook into those to change stuff without editing... are you familiar with how wp api works? if not, see: http://codex.wordpress.org/Plugin_API
those are filters... so you can change the data... so for example, to change the subject, do something like:
add_filter('sph_email_subject', 'my_email_subject', 10, 2); function my_email_subject($subject, $newpost) { # do what you want to $subject return $subject; }
same for content, but use the sph_admin_email filter... the $newpost array passed in contains all the new post info that was just created.. ie topic name, forum, etc...
Visit Cruise Talk Central and Mr Papa's World
there are no 'templates' for emails... its a format defined in the code... but we offer filters to customize...
perhaps if you tell us what you want to do, we can offer more concrete suggestions...
Visit Cruise Talk Central and Mr Papa's World
Thanks - I'm hoping for an email notification that would go to the admin (and I'm using autoforward to send to other select people) in the following format:
[Full Name, in bold if possible] has posted the following in [Forum, in bold]:
[maybe a horizontal line if possible]
[Subject, in bold]
[Message]
[maybe a horizontal line if possible]
[Link to post or reply]
Thanks!!!
Well Steve gave you the basic code in post 2 above - only for the email body you would need to swap the subject filter for the content filter (sph_admin_email).
where he has out the 'do what you want...' comment is where you can change the text. In your case you would want to construct your whole email message. And the data you need is available in the $newpost array. if you take a look at the original code you want to replace you should easily see how it can be done.
There is one problem though. You want to use horizontal lines and bold text. Yet by default, WordPress only send emails in plain text which excludes the use of html tags. There is more needed to be done within WordPress to get it to send HTML emails which I believe is covered in the WP codex. I will try and find the references...
Here they are: http://codex.wordpress.org/Fun.....ce/wp_mail - this explains how to switch to using html emails.
YELLOW
SWORDFISH
|
Let me even suggest a simpler request:
I'm okay with the current layout, except as follows:
1) Would like to remove "New forum post on your site: [NAME of SITE]"
2) The "FROM" line is fine, but can I remove Poster IP?
3) Can I move the url link to below the Post?
4) Can we remove the word "Post:"
i.e., it would be cool if it could feel more like a regular email.
If it means modifying core files (and let's say that's easy to do) - I can just make the same modifications when I upgrade in the future.
It would be a total waste to change the core when you can use the filter, achieve the same thing and keep it safe from updates. and you do not need to knpw about the apply_filter() function as Steve already outlined what you need to do above. But here it is again with the proper filter name:
add_filter('sph_admin_email', 'my_admin_email', 10, 2); function my_admin_email($content, $newpost) { # do what you want to $content # change it or even replace it return $content; }
if you paste that into your spFuntions.php file in your SP theme (templates folder) then replace those two commented out lines in the middle with your preferred layout and text. Take the original from core, change it and add it here. Use the $content variable to build up your replacement and then return it as shown at the end.
This is virtually the same as editing the core only safe from updates.
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/)
YELLOW
SWORDFISH
|