• Resolved alexzaragoza21

    (@alexzaragoza21)


    Is there a way to have a different review form for logged in users? I just want to remove the name field and email address field since I only require a logged in user to submit a review. They already submitted there names and email upon registration so its weird to ask it again. Thank you so much for the help. I wish for the continues success of the plugin and your team.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Gemini Labs

    (@geminilabs)

    You can easily do this by adding a couple of custom shortcodes to your website.

    For registered users:

    /**
     * Registers the [is_member][/is_member] shortcode
     * This shortcode displays content only to logged in users
     * Paste this in your active theme's functions.php file
     * @param array $atts
     * @param string $content
     * @return string
     */
    add_shortcode( 'is_member', function( $atts, $content = '' ) {
        return ( is_user_logged_in() && !empty( $content ) && !is_feed() )
            ? do_shortcode( $content )
            : '';
    }, 10, 2);

    For guest users:

    /**
     * Registers the [is_visitor][/is_visitor] shortcode
     * This shortcode displays content only to users who are not logged in
     * Paste this in your active theme's functions.php file
     * @param array $atts
     * @param string $content
     * @return string
     */
    add_shortcode( 'is_visitor', function( $atts, $content = '' ) {
        return (( !is_user_logged_in() && !empty( $content )) || is_feed() )
            ? do_shortcode( $content )
            : '';
    }, 10, 2);

    Once you have added those two code snippets to your theme’s functions.php file, you can do this:

    
    [is_visitor][site_reviews_form][/is_visitor]
    
    [is_member][site_reviews_form hide=name,email][/is_member]
    
    Thread Starter alexzaragoza21

    (@alexzaragoza21)

    Hello, site review team! Thank you very much for the code that you gave. It’s really helpful. However, there is only problem that I am trying to fix. I actually use ultimate member plugin. In the site front end, I think the code can’t recognize the guest and the registered users? so the common guest forms appears even to the registered users. In my other website that doesn’t use Ultimate member plugin, your code really works great! Perhaps, you know reason behind this? Thank you so much!God bless you all.

    Plugin Author Gemini Labs

    (@geminilabs)

    Thread Starter alexzaragoza21

    (@alexzaragoza21)

    Got it. My fault. Everything seems fine now. Thank you so much!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Different review form for logged in users’ is closed to new replies.