WordPress.org

Ready to get started?Download WordPress

Forums

PHP Code Widget
Problems with $user_login (6 posts)

  1. jhrenon
    Member
    Posted 4 months 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)
    Tech Ninja
    Plugin Author

    Posted 4 months ago #

    You don't have $user_login defined anywhere.

  3. jhrenon
    Member
    Posted 4 months ago #

    How defined???

    I use it on line 4..

  4. jhrenon
    Member
    Posted 4 months ago #

    Can you help me?

  5. jhrenon
    Member
    Posted 4 months ago #

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

  6. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 4 months ago #

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

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.