• Resolved fabrizio.u

    (@fabriziou)


    Hi,
    is there a placeholder for $text similar to %FIRST_NAME%? I’d like to perform a php search on a string entered by user ( /search string).

    I already tried with a custom function and it works fine:

    if ( substr( $text, 0, 8 ) === "/suggest" ) {
    		$textkw = explode(" ", $text);
        }

    but I’d like to test the same using insertphp in custom post.

    Thank you

    F

    https://www.ads-software.com/plugins/telegram-bot/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Marco Milesi

    (@milmor)

    Hi,
    atm there’s no placeholder to get it, but with insertphp you could use direct code. If you look in parse.php you can find all variables of the json Telegram request that you could use

    However, for performance and security, i suggest to keep the php-way without insertphp.
    www.ads-software.com/support/topic/how-to-setup-dynamic-answer-to-mybot-message

    Thread Starter fabrizio.u

    (@fabriziou)

    Thank you, I guess I’ll keep the php way.

    Just a quick final question since I’m not a developer: I’m having problems in retrieving first name variables using php. I tried $telegram_first_name but it returns empty.

    function telegramcustom_parse( $telegram_user_id, $text ) {
        $plugin_post_id = telegram_getid( $telegram_user_id );
    
        if ( !$plugin_post_id ) {
            return;
        }
    
        if ( substr( $text, 0, 8 ) === "/suggest" ) {
    		$textkw = explode(" ", $text);
            telegram_sendmessage( $telegram_user_id, 'Hi ' . $telegram_first_name . ', you entered  *' . $textkw[1] . '*');
        }
    
        return;
    }

    What am I doing wrong?

    Thx

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Placeholders’ is closed to new replies.