Browse Source

API fields added in the backend

Rousnay 1 year ago
parent
commit
2de8d0dec8
1 changed files with 11 additions and 12 deletions
  1. 11 12
      single-faculty.php

+ 11 - 12
single-faculty.php

@@ -10,10 +10,14 @@ get_header(); ?>
 
 <?php while (have_posts()) : the_post();
 
-
 	$auth_token = get_field('auth_token', 'option');
+	$client_id = get_field('client_id', 'option');
+	$employee_info_api = get_field('employee_info_api', 'option');
+	$journal_api = get_field('journal_api', 'option');
+	$conference_api = get_field('conference_api', 'option');
 
 	$login_id_e = "";
+
 	if (function_exists('get_field')) {
 		$pid_content = get_post();
 		if (has_blocks($pid_content)) {
@@ -26,12 +30,11 @@ get_header(); ?>
 		}
 	}
 
-	$url_employeeInfo = 'http://103.109.52.3/webapi/api/EmployeeInfo';
 	$response_employeeInfo = wp_remote_post(
-		$url_employeeInfo,
+		$employee_info_api,
 		array(
 			'body' => array(
-				'user_login_id' => 'api_user',
+				'user_login_id' => $client_id,
 				'login_id' => $login_id_e,
 				'auth_token' => $auth_token
 			)
@@ -39,15 +42,13 @@ get_header(); ?>
 	);
 	$employeeInfo = json_decode(wp_remote_retrieve_body($response_employeeInfo), true);
 
-
-	$url_employeeJournal = 'http://103.109.52.3/webapi/api/EmployeeJournal';
 	$response_employeeJournal = wp_remote_post(
-		$url_employeeJournal,
+		$journal_api,
 		array(
 			'body' => array(
 				'employee_id' => $login_id_e,
 				"year"  => "",
-				'user_login_id' => 'api_user',
+				'user_login_id' => $client_id,
 				'auth_token' => $auth_token
 			)
 
@@ -55,15 +56,13 @@ get_header(); ?>
 	);
 	$employeeJournal = json_decode(wp_remote_retrieve_body($response_employeeJournal), true);
 
-
-	$url_employeeConference = 'http://103.109.52.3/webapi/api/EmployeeConference';
 	$response_employeeConference = wp_remote_post(
-		$url_employeeConference,
+		$conference_api,
 		array(
 			'body' => array(
 				'employee_id' => $login_id_e,
 				"year"  => "",
-				'user_login_id' => 'api_user',
+				'user_login_id' => $client_id,
 				'auth_token' => $auth_token
 			)