PHP warning

Undefined variable $currentUserId

/home3/jilan/public_html/protected/views/site/userpf.php(336)

324                                             }
325                                             ?>
326                                         </div>
327                 </div>
328             </div>
329 
330         </div>
331         <?php } } ?>
332     </div>
333 <script>
334    // Function to check the follow status when the page loads
335 document.addEventListener('DOMContentLoaded', function() {
336     const currentUserId = <?= json_encode($currentUserId) ?>;
337     const profileUserId = <?= json_encode($profileUserId) ?>;
338     const followBtn = document.getElementById('follow-btn');
339     
340     // Check if the current user is following the profile user
341     if (currentUserId && profileUserId && currentUserId !== profileUserId) {
342         fetchFollowStatus(currentUserId, profileUserId, followBtn);
343     }
344 
345     // Event listener for follow/unfollow button click
346     followBtn?.addEventListener('click', function() {
347         toggleFollow(currentUserId, profileUserId, followBtn);
348     });

Stack Trace

#4
+
 /home3/jilan/public_html/protected/controllers/SiteController.php(140): CController->render("userpf")
135     }
136     public function actionVideo() {
137         $this->render('video');
138     }
139     public function actionUserpf() {
140         $this->render('userpf');
141     }
142  
143  public function actionibc() {
144         $this->render('ibc');
145     }
#12
+
 /home3/jilan/public_html/index.php(22): CApplication->run()
17     defined('YII_DEBUG') or define('YII_DEBUG', true);
18 // specify how many levels of call stack should be shown in each log message
19     defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 3);
20 
21     require_once($yii);
22     Yii::createWebApplication($config)->run();
23 }  
2026-03-10 20:52:11 Apache Yii Framework/1.1.10