coelmay
Forum Replies Created
-
Forum: Plugins
In reply to: [Contact Form 7] From email addressOriginally, the
add_filter
was:add_filter( 'wp_mail_from', 'my_mail_from' ); function my_mail_from( $email ) { return "[email protected]"; }
I have modified this to:
add_filter( 'wp_mail_from', 'my_mail_from' ); function my_mail_from( $email ) { if ( preg_match('#^wordpress\@#',$email)) { return "[email protected]"; } else { return $email; } }
and it works—when I do a ‘forgot password’ the email comes from
[email protected]
and when I fill in the contact form, the email comes from the email used to fill in the contact form.
Not sure if this is the ‘perfect’ workaround, or not.Now I just need something like above to change the from name.
Forum: Plugins
In reply to: [Contact Form 7] From email addressI have the plugin installed on two sites—one a working business site, the other a test site.
On the production site, the theme is a customised ‘Avada’, and the following plugins are activated:
? Akismet
? All in One Webmaster
? Captcha
? Contact Form 7
? Custom Meta Widget
? Enhanced Media Library
? Facebook
? Fusion Core
? Google XML Sitemaps
? Jetpack by WordPress.com
? LayerSlider WP
? Revolution Slider
? Shortn.It
? Twitter
? User Role Editor
? WP Google Authenticator* ‘WP Change Default Email’ had been running, but has since been uninstalled. However, an
add_filter
has been added tofunctions.php
to change the default email address.
** The site runs atwww1.example.com
rather thanwww.example.com
. I have noted in both WordPress and Contact Form 7, allowance is made to stripwww.
from domain for email.On the test site, a default theme, with plugins:
? Ban Hammer
? Contact Form 7
? Custom Bulk Actions
? Google XML Sitemaps
? Media Library Assistant
? Shortn.It
? Twitter
? WPFront Notification BarWAIT!!! STOP PRESS!!!
I had noted ‘WP Change Default Email’ was doing things I didn’t want, hence why I changed to the add_filter. However, the add_filter is what is now stopping the sender email coming through.
The is an issue as I need this filter (due in part because of the runningwww1.
NOTwww.
)Any thoughts on a workaround? (Maybe simply modifying the source to look for
www1.
as well/instead of? Could this be done as a filter maybe?)Any help appreciated.
Forum: Plugins
In reply to: [Shortn.It] Site browsable using short URLAnd I’ve now removed the
else
as is breaks pretty much everything.Forum: Plugins
In reply to: [Shortn.It] Site browsable using short URLModified that to
if ( $page_slug != '' && ($wpdb->get_var( 'SELECT ID FROM
‘ . $wpdb->posts .’WHERE
post_name= "'.$page_slug.'"')) !== FALSE )
Forum: Plugins
In reply to: [Shortn.It] Site browsable using short URLYeah, makes sense.
In
shortn_it_get_matching_post_id
I’ve added:`if ( preg_match(‘/^(index\.php)?\?p\=(.*)$/’, $the_short) ) {
return substr($the_short, strpos($the_short, ‘?p=’)+3,strlen($the_short));
}`after
if( $the_short == '' )
.In
shortn_it_headers
after theif
I’ve added:`else {
global $wpdb;
$page_slug = trim($_SERVER[‘REQUEST_URI’], ‘/’);
if ( ($wpdb->get_var( ‘SELECT ID FROM' . $wpdb->posts .'
WHEREpost_name
= “‘.$page_slug.'”‘)) !== FALSE ) {
$permalink = home_url(‘/’) . $page_slug . ‘/’;
if ( $permalink != $current_url ) {
wp_redirect( $permalink );
exit();
}
}
}`May not be the prettiest code in the world, but it works for me.
And into .htacces I’ve added
`RewriteCond %{HTTP_HOST} ^exm\.pl$
RewriteCond %{REQUEST_URI} ^/?$
RewriteRule ^(.*)$ https://example.com/$1 [R,L]`to capture people browsing directly to
exm.pl
.