Page URL in Message


Home Forums Front End PM PRO Page URL in Message

This topic is: Not Resolved
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #8881
    Ricardo Cosentino
    Participant

    Hello, I’m using Front End PM PRO as a tool to help my users to ask questions, because I have many differents courses with many Modules with many lessons in each module, I got it putting in every page a button that open a lightbox with a form to send the text to our teachers. It’s working perfectly, but I want to facilitate for the teachers, because when an user send a doubt in the messagebox panel only shows in the message title the name of the page that the user sent, I would like to know if is possible to send the url link in the body message or something like that, because when the teachers recieve a message is very hard to find what lesson the user sent only with the page title

    I’m using the shortcode: [fep_shortcode_new_message_form subject="<?php wp_title();?>"]

    https://imgur.com/a/hKE0B

    Thank you!

    #8884
    Shamim Hasan
    Keymaster

    You can use fep_filter_message_before_send filter to add $_SERVER['HTTP_REFERER'] to the message.

    #8898
    Ricardo Cosentino
    Participant

    Sorry, I didn’t understand where I need to put this code: fep_filter_message_before_send

    Is like a filter in functions.php? per example:
    add_filter( 'fep_filter_message_before_send', $_SERVER['HTTP_REFERER']);

    Thanks again!

    #8900
    Ricardo Cosentino
    Participant

    I tried this in function.php:

    add_filter( 'fep_filter_message_before_send', 'send_url' );
    
    function send_url() {
        $url = $_SERVER['HTTP_REFERER'];
        return $url;
    }

    But just recieved error messages!

    #8902
    Ricardo Cosentino
    Participant

    After I tried to send a Message: https://imgur.com/a/LKmBW

    I tested a basic filter just to send an alert like that:

    add_filter( 'fep_filter_message_before_send', 'send_url' );
    
    function send_url() {
        echo "<script>alert('".$_SERVER['HTTP_REFERER']."');</script>";
    }

    And it Works but… The message didn’t send

    #8904
    Shamim Hasan
    Keymaster

    Please add following code in your theme’s (child theme’s if any) functions.php

    
    add_filter( 'fep_filter_message_before_send', 'fep_cus_send_url', 999 );
    
    function fep_cus_send_url( $message ) {
        if( empty( $message['message_content'] ) || $message['post_parent'] )
        return $message;
    
        $message['message_content'] .= '<div>';
        $message['message_content'] .= esc_url( $_SERVER['HTTP_REFERER'] );
        $message['message_content'] .= '</div>';
        
        return $message;
    }
    

    Let me know.

Viewing 6 posts - 1 through 6 (of 6 total)

You need to purchase ‘Front End PM PRO’ to create topic in this support forum.

If you already purchased ‘Front End PM PRO’ please LOGIN.