fep_shortcode_message_to with field “to” hidden.


Home Forums Front End PM PRO fep_shortcode_message_to with field “to” hidden.

This topic is: Not Resolved
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #26406
    c-alle
    Participant

    hello, I use this php code to send a message to the profile user
    echo do_shortcode (‘[fep_shortcode_message_to class = “um-pro-btn um-button” to=”{um-current-author}” text=”send message” subject=”Sending a message”]’);
    but I have a problem.
    I would like that if you click on the button the submit form will be loaded to send a message to the user of the profile but with the “to” field hidden or make it read-only. It’s possible?

    Source: https://wordpress.org/support/topic/fep_shortcode_message_to-with-field-to-hidden/

    Thanks.

    #26409
    c-alle
    Participant
    #26412
    Shamim Hasan
    Keymaster

    Please let me know the value of front End PM PRO > Settings > Recipient > Max recipients
    Also will you use the value as 1 or more? (Code will be different if you use 1)

    #26427
    c-alle
    Participant

    Hi, thanks for the reply.
    My Front End number in PM PRO> Settings> Recipient> Max recipients is: 5.

    #26433
    Shamim Hasan
    Keymaster

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

    add_filter( 'fep_pro_filter_pre_populate', function( $pre_populate ){
    	if ( $pre_populate && is_array( $pre_populate ) ) {
    		foreach ( $pre_populate as &$value ) {
    			$value['readonly'] = true;
    		}
    	}
    	return $pre_populate;
    });
    
    #26438
    c-alle
    Participant

    The form is loaded with the value (to) displayed correctly, but is not read-only.

    #26447
    Shamim Hasan
    Keymaster

    That value is readonly not the full field.
    A new hook is added in https://github.com/shamim2883/front-end-pm/commit/dc41347194c1767d83526ee16d3b1fc8c09dba8a#diff-78cd5aa3783a74555c9938a2a81d01c6R328 but not yet merged with latest version. Next version you will get it merged and we can use that hook to make full field readonly.

    #26449
    c-alle
    Participant

    Thanks you are very kind. I’ll wait for the new version.

    #26806
    c-alle
    Participant

    I updated the plugin to version 11.1.1. did you add the possibility to put the field (to) in readonly for the shortcode? If yes, how can I make it read-only? Thanks, you are always very kind.

    #26812
    Shamim Hasan
    Keymaster

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

    add_filter( 'fep_filter_tokeninput_localize', function( $args ){
    	if ( isset( $_GET['fepaction'] ) && 'newmessage' == $_GET['fepaction'] && ! empty( $args['prePopulate'] ) && is_array( $args['prePopulate'] ) ) {
    		$args['tokenLimit'] = count( $args['prePopulate'] );
    		foreach ( $args['prePopulate'] as &$value ) {
    			$value['readonly'] = true;
    		}
    	}
    	return $args;
    });
    
Viewing 10 posts - 1 through 10 (of 10 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.