Support » Plugin: Telefication » How to get the URL of a valid page in notifications

  • Resolved Father

    (@bliksss)


    Hello, I liked the plugin.
    How can I get a link to an entry in the notifications where the comment is left?

    And also get a link to a new post?

    Now in the code in notifications comes a link to the main site

    /**
    	 * New Comment Action
    	 *
    	 * @since 1.4.0
    	 *
    	 * @param $comment_ID
    	 */
    	public function telefication_action_wp_insert_comment( $comment_ID ) {
    		$comment_text = get_comment_text( $comment_ID );
    
    		//notification body
    		$message = get_bloginfo( 'name' ) . ":\n\n";
    		$message .= __( 'New Comment: ', 'telefication' ) . "\n-----\n\n";
    		$message .= $comment_text . "\n\n";
    
    		<strong>$message .= site_url();</strong>
    
    		$telefication_service = new Telefication_Service( $this->options );
    
    		if ( $telefication_service->create_url( $message ) ) {
    			$telefication_service->send_notification();
    		}
    	}

    How can I receive notifications via a link to the main page of a site?
    $message .= site_url();

    but on the page where the comment was written?

    How to replace site_url();

    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Foad Tahmasebi

    (@arshen)

    Hi @bliksss,
    Thank you for your interest.

    To adding comments link to notifications replace site_url(); in telefication_action_wp_insert_comment function with __( 'Comment Link: ', 'telefication' ) . get_comment_link( $comment_ID );

    and for the new post URL replace site_url(); in telefication_action_publish_post function with __( 'Post URL: ', 'telefication' ) . get_permalink($post->ID);

    I will be updating this two lines in the next version.

    Thank you. It works!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to get the URL of a valid page in notifications’ is closed to new replies.