• Resolved snoepys

    (@snoepys)


    Hi! First of all, your plugin is the best review plugin that I have found! Great work!

    I want to send via Slack Webhook URL the info from reviews. I am able to get that but I need to retrieve the data from the email user too and this is the only data that I didn’t get. Is there any way to achieve that?

    Also, I receive the user name alongside IP address, is there any possibility to only get the name without the IP?

    Thank you!

Viewing 2 replies - 16 through 17 (of 17 total)
  • Plugin Author Gemini Labs

    (@geminilabs)

    What about this?

    function site_reviews_modify_slack_notification($notification, $slack) {
        $fields = $notification['attachments']['fields'];
    
        // START: Remove the IP address
        if (isset($fields[3]['value'])) {
            $fields[3]['value'] = str_replace($slack->review->ip_address, '', $fields[3]['value']);
            $fields[3]['value'] = trim($fields[3]['value'], ' -');
        }
        // END: Remove the IP address
    
        // START: Add the assigned post titles
        $posts = $slack->review->assignedPosts();
        $postTitles = array_filter(wp_list_pluck($posts, 'post_title'));
        if (!empty($postTitles)) {
            $titles = \GeminiLabs\SiteReviews\Helpers\Str::naturalJoin($postTitles);
            $fields[] = [
                'value' => 'Review of: '.$titles,
            ];
        }
        // END: Add the assigned post titles
    
        $notification['attachments']['fields'] = $fields;
        return $notification;
    }
    add_filter('site-reviews/slack/compose', 'site_reviews_modify_slack_notification', 10, 2);
    Thread Starter snoepys

    (@snoepys)

    Now It Works!!!!! WOW!!! ??

    Your plugin and your support really are the best that I have found ever!

    Never imagine that only need to replace $this with $slack, but it has all the sense, haha.

    You saved my day, Sir!

    Thank you a lot!

Viewing 2 replies - 16 through 17 (of 17 total)
  • The topic ‘Slack Integration’ is closed to new replies.