WordPress.org

Ready to get started?Download WordPress

Forums

WP Customer Reviews
Set name field as currently logged on username (6 posts)

  1. DA2206
    Member
    Posted 1 year ago #

    Hi,

    Currently i set the name field as being visible and required, but this means the person submitting the review can provide any name. Is there any way of hiding this field and hard coding it so the name submitted is the currently logged on username?

    Many thanks,

    Dan

    http://wordpress.org/extend/plugins/wp-customer-reviews/

  2. hoppular
    Member
    Posted 1 year ago #

    I'm also looking for the same functionality on this.

    Please advise if there is a solution or a work around.

    Thanks!!!

    Rick

  3. richardahlin
    Member
    Posted 1 year ago #

    Anyone?

  4. essaysnark
    Member
    Posted 1 year ago #

    Here's a change that you can make to the plugin code to get you partway there: It will prevent anyone from submitting a review unless they're logged in.

    Note that this change will be overwritten the next time you upgrade the plugin, so make sure you keep a backup copy on hand after you implement, so that you can restore this again as needed later. Also this hasn't been extensively tested; I can't promise it won't break something else or cause unwanted behavior elsewhere (though I seriously doubt it will). Finally, if you're unfamiliar with editing WordPress files, then proceed carefully - take a backup of everything before you begin, and be sure you have access to your server via FTP so that you can restore the backup if needed.

    All those warnings aside, this is an easy change.

    1. Open up the plugin file wp-customer-reviews.php (it's located in /wp-content/plugins/ - you can get there through the WordPress backend via Appearance -> Editor then switch to the WP Customer Reviews plugin in the dropdown menu on top right).

    2. Go to line 1142 - easiest if you're using a code editor. If you're in the WP backend then use your browser Find command and look for the string "only do regex matching if not blank" which is in a comment (indicated by '/* */'). You want to place this code snippet right above that line.

    3. Insert:

    /* Prevents people from submitting unless logged into the site */
    		if ( !is_user_logged_in() ) {
                $errors .= 'You must be logged into this site in order to leave a review.<br />';
    		}

    This is very rudimentary; it processes the submit but then throws an error on the refreshed screen. Hopefully it's useful to someone.

  5. richardahlin
    Member
    Posted 1 year ago #

    @Essaysnark Thanks for your time :) but thats not what I'm looking for. I've already hidden the review form unless you are logged into the site, my next task is try to import the currently logged on username into name field...

    Link to my review-page: http://www.brabet.se/lasartips/

  6. Víctor
    Member
    Posted 9 months ago #

    Something else? I need this too.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic