Support » Plugin: Front End PM » Display sender’s and recipient’s author page link in fep_shortcode_message_to

  • How to display sender’s and recipient’s author page link above message box in shortcode fep_shortcode_message_to

    For example,
    Sender username = john
    Sender nicename = John David
    Recipient username = robert
    Recipient nicename = Robert Mills

    Display the following links above the message box.

    <a href="https://www.example.com/author/john/">John David</a>
    <a href="https://www.example.com/author/robert/">Robert Mills</a>

    Thanks in advance.

    • This topic was modified 1 year, 1 month ago by primyhub.
    • This topic was modified 1 year, 1 month ago by primyhub.
    • This topic was modified 1 year, 1 month ago by primyhub.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Shamim Hasan

    (@shamim51)

    You can add following code in your theme’s (child theme’s if you are using) functions.php

    add_action( 'fep_display_before_content', function(){
        echo '<a href="https://www.example.com/author/john/">John David</a>';
    });
    

    Thanks for the code. I need code that works for every sender and recipient.

    For example,

    add_action( 'fep_display_before_content', function(){
        echo '<a href="$sender_profile_page_url">$sender_nicename</a>';
        echo '<a href="$recipient_profile_page_url">$Recipient_nicename</a>';
    });

    I do not know the variable names for sender’s profile page url, sender’s nicename, recipient’s profile page url, recipient’s nicename

    I put the shortcode fep_shortcode_message_to in the post page. I want to display current post page author’s profile page url and current logged in user’s profile page url above the message box.

    Thanks.

    • This reply was modified 1 year, 1 month ago by primyhub.

    Corrected code in above reply.

    • This reply was modified 1 year, 1 month ago by primyhub.
    • This reply was modified 1 year, 1 month ago by primyhub.
    • This reply was modified 1 year, 1 month ago by primyhub.
    Plugin Author Shamim Hasan

    (@shamim51)

    May be i did you understand you properly.
    Can you give me a screenshot with marking where you want to show?

    Part of the send message page will look like the following lines:

    ****************************
    Send Message
    To: *
    Robert Mills
    Subject: *
    Business Meeting
    Sender Profile :
    John David
    Recipient Profile :
    Robert Mills
    Message: *
    ****************************

    Sender Profile :
    John David

    “John David” is a hyper link – sender’s profile page url
    <a href="https://www.example.com/author/john/">John David</a>

    john is sender’s username

    Recipient Profile :
    Robert Mills

    “Robert Mills” is a hyper link – recipient’s profile page url
    <a href="https://www.example.com/author/robert/">Robert Mills</a>

    robert is recipient’s username

    • This reply was modified 1 year, 1 month ago by primyhub.
    Plugin Author Shamim Hasan

    (@shamim51)

    In my previous reply there was a typo. It will be “May be i did NOT understand you properly.”

    When you are in “New Message” page you do not have receiver yet. You can change receiver in “To” field. So we cannot show receiver profile. But you can show sender profile link there. Use fep_form_fields filter hook.

    Could you please suggest a code to show sender profile link below title field.

    Sample output link
    <a href="https://www.example.com/author/sender_username/">Sender Display Name</a>

    Thanks.

    Plugin Author Shamim Hasan

    (@shamim51)

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

    add_filter( 'fep_form_fields', function( $fields ){
    	$fields['cus_sender_name'] = [
    		'type' => 'function',
    		'where' => 'newmessage',
    		'priority' => 12,
    		'function' => function( $field ){
    			echo '<a href="https://www.example.com/author/sender_username/">Sender Display Name</a>';
    		},
    	];
    	return $fields;
    });
    

    Thanks for the code. The code shows the link as I expected.

    But, the link is static. Showing the same static link for each sender. Could you please suggest a code to display current sender’s profile page link.

    For example,
    if John David is the sender, display John David’s profile page link.
    echo '<a href="https://www.example.com/author/john/">John David</a>';

    if Robert Mills is the sender, display Robert Mills’ profile page link.
    echo '<a href="https://www.example.com/author/robert/">Robert Mills</a>';

    Change following code to generate current sender’s profile page link.
    echo '<a href="https://www.example.com/author/sender_username/">Sender Display Name</a>';

    Also, when the recipient open the message, cannot see the sender’s profile page link. Looks like the link is not stored in the message. In that case, is it possible to put the link in message box? Then the sender type the message below the link. When the recipient open the message, he can see the link in the message.

    Thanks.

    Plugin Author Shamim Hasan

    (@shamim51)

    It needs custom code. You can post in https://jobs.wordpress.net or contact me in my website.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Display sender’s and recipient’s author page link in fep_shortcode_message_to’ is closed to new replies.