PHP

Enhancing Mentor Service Visibility in Landing

The landing project aims to connect mentors with individuals seeking guidance. We've recently added a feature to give mentors more control over the visibility of their listed services.

The Feature: Service Visibility Control

Mentors can now designate their services as either public or private. Public services are visible in the public directory, portfolio themes, and the mentorship board, while private services are hidden from these areas. This provides mentors with greater flexibility in managing their offerings and tailoring their visibility to specific audiences.

Implementation

This feature introduces a simple boolean flag, is_public, associated with each mentor service. The application logic then uses this flag to determine whether a service should be displayed in public-facing areas.

Here's an example of how this might be used in PHP to filter services:

<?php

function get_visible_services(array $services): array {
    $visible_services = array_filter($services, function ($service) {
        return $service['is_public'] === true;
    });
    return $visible_services;
}

// Example usage:
$all_services = [
    ['name' => 'Career Coaching', 'is_public' => true],
    ['name' => 'Resume Review', 'is_public' => false],
    ['name' => 'Interview Prep', 'is_public' => true],
];

$public_services = get_visible_services($all_services);

print_r($public_services);

?>

Benefits

  • Increased Control: Mentors have more control over which services are publicly visible.
  • Privacy: Mentors can offer exclusive or invite-only services without them being listed publicly.
  • Customization: Mentors can tailor their public profiles to highlight specific areas of expertise.

Key Takeaway

By adding the is_public flag, we've empowered mentors to manage their service visibility effectively. Consider how boolean flags can simplify visibility and access control in your own applications.

Enhancing Mentor Service Visibility in Landing
GERARDO RUIZ

GERARDO RUIZ

Author

Share: