<?php
namespace Softech_Addons_for_Elementor\Includes\Dynamic_Tags\Tags\Site_Tags;

use Elementor\Core\DynamicTags\Tag;
use Elementor\Modules\DynamicTags\Module;
use Softech_Addons_for_Elementor\Includes\Dynamic_Tags\Groups\Softech_Site_Group;

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

class Softech_User_Info extends Tag {

    public function get_name() {
        return 'softech-user-info';
    }

    public function get_title() {
        return esc_html__( 'User Info', 'softech-addons-for-elementor' );
    }

    public function get_group() {
        return Softech_Site_Group::get_name();
    }

    public function get_categories() {
        return [ Module::TEXT_CATEGORY ];
    }

    public function render() {
        $current_user = wp_get_current_user();

        if ( $current_user && $current_user->ID ) {

            echo esc_html__( 'Username: ', 'softech-addons-for-elementor' )
                . esc_html( $current_user->user_login ) . '<br>';

            echo esc_html__( 'User email: ', 'softech-addons-for-elementor' )
                . esc_html( $current_user->user_email ) . '<br>';

            echo esc_html__( 'First name: ', 'softech-addons-for-elementor' )
                . esc_html( $current_user->user_firstname ) . '<br>';

            echo esc_html__( 'Last name: ', 'softech-addons-for-elementor' )
                . esc_html( $current_user->user_lastname ) . '<br>';

            echo esc_html__( 'Display name: ', 'softech-addons-for-elementor' )
                . esc_html( $current_user->display_name ) . '<br>';

            echo esc_html__( 'User ID: ', 'softech-addons-for-elementor' )
                . esc_html( $current_user->ID ) . '<br>';

        } else {
            echo esc_html__( 'You are not logged in.', 'softech-addons-for-elementor' );
        }
    }
}
