verifyadmin (function)

Last updated: Fri, May 26, 2023 10:46 am
Return to Knowledgebase

Purpose

The verifyadmin function in UserSpice is used to check if the user is an administrator and verify their admin status

Location

users/helpers/us_helpers.php

Parameters

# Parameter Data Type Required Description
1 $page string Yes The page to redirect to after verification.

Further Documentation:

// Call the verifyadmin function to check the user's admin status
$page = "admin_dashboard";
verifyadmin($page);


In the example above, the verifyadmin function is called to check if the user is an administrator and verify their admin status. The $page variable is passed as an argument to the function to specify the page to redirect to after verification. If the user is not an administrator or their admin status needs to be verified, the function redirects them to the appropriate admin verification page (admin_pin.php or admin_verify.php). If the user is an administrator and their admin status is verified, the function updates the last_confirm session variable to the current time.

Note: The example usage assumes that the necessary global variables ($user and $us_url_root) are already defined in the scope where the verifyadmin function is called.