tp TouchPointWP Auth - TenthPres/TouchPoint-WP GitHub Wiki

tp\TouchPointWP\Auth

Allows users to log in to WordPress with their TouchPoint credentials, and provides other user management functionality.

Methods

init

mixed tp\TouchPointWP\Auth::init()
  • Visibility: public
  • This method is static.

Returns

  • mixed

load

bool tp\TouchPointWP\Interfaces\module::load()

Loads the module and initializes the other actions.

Returns

  • bool -

logout

mixed tp\TouchPointWP\Auth::logout()

Clear variables and potentially create a flag for the logout of TouchPoint.

  • Visibility: public
  • This method is static.

Returns

  • mixed

footer

mixed tp\TouchPointWP\Auth::footer()

Placeholder for automatic login.

TODO: this

  • Visibility: public
  • This method is static.

Returns

  • mixed

printLoginLink

mixed tp\TouchPointWP\Auth::printLoginLink()

Renders the link used to log in through TouchPoint.

  • Visibility: public
  • This method is static.

Returns

  • mixed

getLoginUrl

string tp\TouchPointWP\Auth::getLoginUrl()

Generates the URL used to initiate a sign-in with TouchPoint.

  • Visibility: public
  • This method is static.

Returns

  • string - The authorization URL used for a TouchPoint login.

redirectLoginFormMaybe

mixed tp\TouchPointWP\Auth::redirectLoginFormMaybe()

Determines whether to redirect to the TouchPoint login automatically, and does so if appropriate.

  • Visibility: public
  • This method is static.

Returns

  • mixed

redirectLoginCompleteMaybe

mixed tp\TouchPointWP\Auth::redirectLoginCompleteMaybe(string redirect_to, ?string requested_redirect_to, \WP_User|\WP_Error|null user)

Determines whether to redirect to allow the user to continue to the destination page after logging in.

  • Visibility: public
  • This method is static.

Arguments

  • redirect_to string* requested_redirect_to ?string* user WP_User|WP_Error|null

Returns

  • mixed

removeAdminBarMaybe

mixed tp\TouchPointWP\Auth::removeAdminBarMaybe()

Prevents the admin bar from being displayed for users who can't edit or change anything.

  • Visibility: public
  • This method is static.

Returns

  • mixed

preventAdminAccessMaybe

void tp\TouchPointWP\Auth::preventAdminAccessMaybe()

Prevents access to the WordPress admin area for users who can't edit or change anything.

  • Visibility: public
  • This method is static.

overwriteProfileUrl

string tp\TouchPointWP\Auth::overwriteProfileUrl(string url)

Replace the default WordPress profile link with a link to the user's TouchPoint profile.

  • Visibility: public
  • This method is static.

Arguments

  • url string

Returns

  • string -

getProfileUrl

string|null tp\TouchPointWP\Auth::getProfileUrl(int|null peopleId)

Assembles the URL to the TouchPoint profile for a given People ID. Assumes current user if no peopleId is given.

  • Visibility: public
  • This method is static.

Arguments

  • peopleId int|null

Returns

  • string|null -

api

bool tp\TouchPointWP\Interfaces\api::api(array uri)

Handle API requests

Arguments

  • uri array - The request URI already parsed by parse_url()

Returns

  • bool - False if endpoint is not found. Should print the result.

authenticate

\WP_Error|\WP_User|null tp\TouchPointWP\Auth::authenticate(\WP_Error|\WP_User|null user, mixed username, mixed password)

Authenticates the user with TouchPoint

  • Visibility: public
  • This method is static.

Arguments

  • user WP_Error|WP_User|null - A WP_User, if the user has already authenticated.
  • username mixed - The username provided during form-based sign in. Not used.
  • password mixed - The password provided during form-based sign in. Not used.

Returns

  • \WP_Error|\WP_User|null - The authenticated WP_User, or a WP_Error if there were errors. The WP API expects WP_Error