• Resolved frynls

    (@frynls)


    Hello,

    I am trying to figure out how to automatically set user email address and name in the submit review form.

    I found the submission-form.php and tried to add a variable value to ‘name’ and ’email’ but as I am quite a noob in php I am struggling. The following code outputs 1 for both field.

    What do I do wrong? ??

    <?php $user_info = get_userdata(get_current_user_id());?>
    
    <?php
    return [
        'rating' => [
            'label' => __('Your overall rating', 'site-reviews'),
            'type' => 'rating',
        ],
        'title' => [
            'label' => __('Title of your review', 'site-reviews'),
            'placeholder' => __('Title of your review', 'site-reviews'),
            'type' => 'text',
        ],
        'content' => [
            'label' => __('Your review', 'site-reviews'),
            'placeholder' => __('Your review', 'site-reviews'),
            'rows' => 5,
            'type' => 'textarea',
        ],
        'name' => [
            'label' => __('Your name', 'site-reviews'),
            'placeholder' => __('Your name', 'site-reviews'),
            'type' => 'text',
            'value' => print "$first_name $last_name",
        ],
        'email' => [
            'label' => __('Your email', 'site-reviews'),
            'placeholder' => __('Your email address', 'site-reviews'),
            'type' => 'email',
            'value' => print_r($user_email),
        ],
        'terms' => [
            'label' => __('This review is based on my own experience.', 'site-reviews'),
            'type' => 'checkbox',
        ],
    ];
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Gemini Labs

    (@geminilabs)

    If you are restricting review submissions to logged in users, simply hide the name and email fields on the submission form using the shortcode option and Site Reviews will automatically fill in the display name and email of the current user when a review is submitted.

    Thread Starter frynls

    (@frynls)

    Awesome! Thank you very much. I knew I was complicating it all.

    Cheers

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘User name & user email in review form’ is closed to new replies.