WordPress.org

Forums

PHP Code Widget
[resolved] Problems with $user_login (6 posts)

  1. jhrenon
    Member
    Posted 1 year ago #

    Hey man, sorry for the poor english, but i will try to be the most clearly possible.
    I am doing a wordpress site and in the widgets area i want to make a note area where people leave them note and sent it to an email, all the php works perfectly only the function $user = $user_login where i try to get the login from the user isnt doing well. I will post my code down here them you can look at. Thank You!

    <?php
    if(isset($_POST['BtnSubmit']))
    {
    $user = $user_login;
    $email = "$user@blablab.com";
    $headers = "From: $user@blablab.com" . "\r\n" .
    'Reply-To: no-reply@blablab.com' . "\r\n" .
    'Content-type: text/html; charset=ISO-8859-1'."\r\n";
    $subject = '=?UTF-8?B?'.base64_encode("[PET][Recado] Recado de $user").'?=';
    $texto = $_POST['texto'];
    $envio = mail($email, $subject, $texto, $headers);
    if ($envio){?>
    <script type="text/javascript">
    alert("É nós!");
    </script> <?php }
    else
    { ?>
    <script type="text/javascript">
    alert("Não deu!");
    </script> <?
    }
    }

    ?>

    <form name="UserInformationForm" method="POST" action="#">
    <textarea name="texto" rows="10" cols="10"></textarea>

    <input name="BtnSubmit" type="submit" value="Enviar">
    </form>

    https://wordpress.org/plugins/php-code-widget/

  2. Samuel Wood (Otto)
    WordPress.org Tech Guy
    Plugin Author

    Posted 1 year ago #

    You don't have $user_login defined anywhere.

  3. jhrenon
    Member
    Posted 1 year ago #

    How defined???

    I use it on line 4..

  4. jhrenon
    Member
    Posted 1 year ago #

    Can you help me?

  5. jhrenon
    Member
    Posted 1 year ago #

    Hey man, thx for you time, but i make it!
    :D

  6. Samuel Wood (Otto)
    WordPress.org Tech Guy
    Plugin Author

    Posted 1 year ago #

    You use it, but you don't have it set to anything anywhere. What is it supposed to be?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.