Forum Replies Created

Viewing 9 replies - 16 through 24 (of 24 total)
  • Thread Starter agentkiller007

    (@agentkiller007)

    No! presently i am using “Submit a review” block to display submission form
    and it is only showing post_id in assign to field in “Assign to” settings in WordPress visual editor.
    though now it also shows category field but with the dropdown of all the users,
    it is not auto assigning reviews to any user category while form submission.

    I think u figured it, auto-assigning them at form submission is the solution,

    Is there any way to auto-assign reviews to user who submits it?

    Thread Starter agentkiller007

    (@agentkiller007)

    Its quite silly on my side but i am working on local env… by Flywheel still if it works for u i am sending the live link
    http://2726ff4c.ngrok.io/author/keto

    http://2726ff4c.ngrok.io/2019/12/02/oh-boy/”

    Thread Starter agentkiller007

    (@agentkiller007)

    Yes i have copied it exactly and after expanding all those filter into my functions .php but it is still returning total reviews by user 0,even if he has reviews
    in functions.php

    /**
     * Create a category for the user if one does not already exist
     * @param array $defaults
     * @return array
     */
    function glsr_filter_shortcode_defaults($defaults) {
        $term = $defaults['category'];
        if (!empty($term) && !term_exists($term, glsr()->taxonomy)) {
            $userId = filter_var(str_replace('user_', '', $term), FILTER_VALIDATE_INT);
            if ($user = get_user_by('id', $userId)) {
                require_once ABSPATH.'wp-admin/includes/taxonomy.php';
                wp_create_term($term, glsr()->taxonomy);
            }
        }
        return $defaults;
    }
    add_filter('site-reviews/defaults/site-reviews', 'glsr_filter_shortcode_defaults');
    add_filter('site-reviews/defaults/site-reviews-form', 'glsr_filter_shortcode_defaults');
    add_filter('site-reviews/defaults/site-reviews-summary', 'glsr_filter_shortcode_defaults');

    In author.php

    
    <?php
    $userTerm = 'user_'.get_queried_object_id();?>
    <div>Total no. of reviews by author<?php 
                    
                    if (is_author() && shortcode_exists('site_reviews_summary')) {
                    
                        echo do_shortcode('[site_reviews_summary text="Reviews {num}" schema=true hide=rating,bars,stars category='.$userTerm.']');
                    } ?></div>
    Thread Starter agentkiller007

    (@agentkiller007)

    Thanks alot for staying along….
    I copied this into my template,

    if (is_author() && shortcode_exists('site_reviews_summary')) {
        $userTerm = 'user_'.get_queried_object_id();
        echo do_shortcode('[site_reviews_summary text="Reviews {num}" schema=true hide=rating,bars,stars category='.$userTerm.']');
    }
    

    i also debugged the value of glsr_debug($userTerm) it output wasuser_3

    but reviews are not auto-assigning to user.I am required to go to my wordpress dashboard again and again to assign that user category…..

    Thread Starter agentkiller007

    (@agentkiller007)

    Still stuck….
    I am doing this to extract user from url…..

    
    global $wp; 
    $url = home_url($wp->request);
    $parts = explode("/", $url);
    $author_id =  $parts[count($parts) - 1] ;
    global $wpdb;
    $user ='';
    $users = $wpdb->get_results( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = 'first_name' AND meta_value = '".$author_id."'" );
    
    if( $users ) {
         foreach ( $users as $user ) {                                
                    }
                  } else {
                    echo 'There are no users with the specified first name.';
                  } ?>
    <?php
    $userTerm = 'user_{'.$user->user_id.'}' ;
    <div> echo $userTerm;
    echo do_shortcode('[site_reviews_summary text="Reviews {num}" schema=true hide=rating,bars,stars category='.$userTerm.']'); ?></div>
    ?>
    

    Here $author_ID is string with value ‘keto’ name of user.
    also when i echo $userTerm it results user_{3} and of type string.

    PLs Help…

    Thread Starter agentkiller007

    (@agentkiller007)

    It worked but it is not auto-assigning those categories to respective user on submission.Admin is required to do it manually.

    I thought it in some other way –
    Is there any way we can make use of(or extract) user value present in detail table i.e glsr-metabox-table on edit review screen.
    As i can see newly created review automatically gets info about author under details tab on edit review screen.

    Thread Starter agentkiller007

    (@agentkiller007)

    It worked, thank u very much for your great plugin and support.Admire your kindness,thanks!!

    Thread Starter agentkiller007

    (@agentkiller007)

    It worked! Thanks for your quick and valuable support.

    Thread Starter agentkiller007

    (@agentkiller007)

    wp_head() and wp_footer()….. That worked thanks alot!

Viewing 9 replies - 16 through 24 (of 24 total)