morollian
Forum Replies Created
-
Forum: Plugins
In reply to: [Simple Share Buttons Adder] Simple Share Count is not workingForum: Plugins
In reply to: [Knews Multilingual Newsletters] Adding Preformated text to a templateFinally I did not use the
“pre” tag. I just used plain “div” tags with no style, and teached the client how to edit styles using Knews built-in capabilities.Great Plugin! Thanks!
Forum: Hacks
In reply to: Notification to the author when certain category is added to his/her postI solved the issue.
I have another function that sends an email when a post is published, and it’s hooked to “publish_custom-post-name”. It looks like the headers where allready send by this function because the “publish_custom-post-type” action takes place before the “added_term_relationship” action.
The solution is simple, I’ve written the wp_mail() function within the conditional that checks the category, so it doesn’t run when the post is “new_published” but It does when the targeted category is added.
Here is the right code:
function action_added_category_relationship( $object_id, $tt_id ) { $post = get_post( $object_id ); $ID = $post->ID; $category = wp_get_post_categories ($ID); if ($post->post_type == 'my_custom_post_type') { $author = $post->post_author; // Post author ID. $name = get_the_author_meta( 'display_name', $author ); $email = get_the_author_meta( 'user_email', $author ); $title = $post->post_title; $permalink = get_permalink( $ID ); $edit = get_edit_post_link( $ID, '' ); $to[] = sprintf( '%s <%s>', $name, $email ); $subject = sprintf( 'Published: %s', $title ); // Check if the category wich is been added is 8 and send the proper notification if (in_array('8', $category)) { $message = sprintf ('Hi %s! The category 8 has been added to your post “%s”.' . "\n\n", $name, $title ); $headers[] = ''; wp_mail( $to, $subject, $message, $headers ); } // Check if the category wich is been added is 11 and send the proper notification if (in_array('11', $category)) { $message = sprintf ('Hi %s! The category 11 has been added to your post .' . "\n\n", $name, $title ); $headers[] = ''; wp_mail( $to, $subject, $message, $headers ); } } } add_action ( 'added_term_relationship', 'action_added_category_relationship', 10, 2 );
Thank’s a lot! Hope it helps someone else
Forum: Hacks
In reply to: Notification to the author when certain category is added to his/her postThank’s @bcworkz, but my code is’nt actually working that great…
It works ok when adding the category, but I get a “Headers allready sent” error when I try to publish new posts… The error comes from the wp_mail line.
It looks like the function is trigered after the publish action sends the header…
I’m quite lost here.
Forum: Hacks
In reply to: Notification to the author when certain category is added to his/her postDone, I used the ‘added_term_relationship’ action and it does the trick! First I get the $post object, then I can get all the data I need (author, author email, category), and send the notifications using wp_mail().
I paste my code in case it can help someone else:
function action_added_category_relationship( $object_id, $tt_id ) { $post = get_post( $object_id ); $ID = $post->ID; $category = wp_get_post_categories ($ID); if ($post->post_type == 'my_custom_post_type') { $author = $post->post_author; // Post author ID. $name = get_the_author_meta( 'display_name', $author ); $email = get_the_author_meta( 'user_email', $author ); $title = $post->post_title; $permalink = get_permalink( $ID ); $edit = get_edit_post_link( $ID, '' ); $to[] = sprintf( '%s <%s>', $name, $email ); $subject = sprintf( 'Published: %s', $title ); // Check if the category wich is been added is 8 and send the proper notification if (in_array('8', $category)) { $message = sprintf ('Hi %s! The category 8 has been added to your post “%s”.' . "\n\n", $name, $title ); //$message .= sprintf( 'View: %s', $permalink ); } // Check if the category wich is been added is 11 and send the proper notification if (in_array('11', $category)) { $message = sprintf ('Hi %s! The category 11 has been added to your post .' . "\n\n", $name, $title ); //$message .= sprintf( 'View: %s', $permalink ); } $headers[] = ''; wp_mail( $to, $subject, $message, $headers ); } } add_action ( 'added_term_relationship', 'action_added_category_relationship', 10, 2 );
Thanks a lot @bcworkz for shedding some light here! You really helped!
happy coding!Forum: Hacks
In reply to: Notification to the author when certain category is added to his/her postThanks @bcworkz! I’ll try that… I’m not sure how I’ll get all the post info i need (author, permalink, category_name …) from the $object_ID object, but I guess I’ll find it somewhere in the codex.
Thanks a lot!
Forum: Plugins
In reply to: [Knews Multilingual Newsletters] Plugin not working anymoreI looks to be solved by the last update.
Forum: Plugins
In reply to: [Knews Multilingual Newsletters] Adding Preformated text to a templateI ment the htm pre tag
Forum: Plugins
In reply to: [Knews Multilingual Newsletters] Plugin not working anymoreI can’t not go back to 5.3, my hosting provider does not allow this change for security reasons. Let’s hope we’ll have an uptdate of this great plugin soon enough!
Forum: Plugins
In reply to: [Knews Multilingual Newsletters] Plugin not working anymoreThanks hsr, I’ll try with 5,3,29 and I’ll get back to you!
Forum: Plugins
In reply to: [Knews Multilingual Newsletters] Plugin not working anymoreHi @hsr!
Which PHP Version is using your Server Now?
Mine is running PHP 5.6.162.0Thanks a lot for the guidance!
Forum: Plugins
In reply to: [Knews Multilingual Newsletters] Plugin not working anymoreI’m having the same problem.
I’ve tried using my old SMTP, with booth available configuratons from my hosting provider (SSL and no security), and also gmails (with SSL), and I keep getting the error:Warning: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL
Forum: Plugins
In reply to: [Contact Form DB] Contact form 7 Multi-step FormsHi @advanceduser!
Did you make this work? I’m struggling whit the same issue here…Tank’s Michael Simpson for a great plugin!
Forum: Plugins
In reply to: [Polylang] Exclude category from loop, the Polylang wayHello Chouby, Tiago ADPS and 916VT.
I’m facing the same trouble now.
I love polylang, but it look like it’s not working when I try to exclude a category.Here is my code:
global $wp_query; $args = array( 'post_type' => 'post_type', 'posts_per_page' => 20, 'order' => 'DESC', 'cat' => '-46' ); $wp_query = new WP_Query($args);
When I try to exclude the category 46, I get all the post of the post type ‘post-type’ in all languages.
Am I doing something wrong?
Thanks a lot!Forum: Hacks
In reply to: Page with the same name as an actual directoryThanks a lot bcworkz
I tried your solution, and it worked. The only problem is that i needed my site to show a page with the same name as the folder, not to go to the home (index.php).
I’ve finally found a solution that seems to do the trick.
I’m using a redirection with the [P] flag, so it’s done “behind the scenes” and does exactly what I needed. I’ve also changed the name of the page (mandatory_name) for an alias. This way my site shows the content I wanted, keeping the url I needed.Here’s the code if anyone needs it:
<IfModule mod_rewrite.c> RewriteEngine on RewriteBase / RewriteRule ^mandatory_name/(.*)$ https://www.myweb.com/alias/$1 [P] </IfModule>
Thanks for the hint bcworks!