Verse Renderer - warwickfoster/qurantools GitHub Wiki

File: app/library/quick_tips.php

User Quick Tips Functions

These functions allow for managing user quick tips, including:

  • Checking if a user wants quick tips.
  • Getting the ID of the current quick tip for a user.
  • Getting a quick tip by ID.
  • Updating the current quick tip for a user.
  • Updating the user's quick tip preference.

Functions

  • user_wants_quick_tips(): Checks if a user wants quick tips based on their preference setting in the USERS table.
  • get_current_quick_tip_id(): Returns the ID of the current quick tip for a user.
  • get_quick_tip(): Retrieves a quick tip by its ID from the QUICK-TIPS table.
  • update_current_quick_tip(): Updates the current quick tip for a user.
  • update_tip_preference(): Updates the user's quick tip preference.

Usage

// Check if user wants quick tips
$user = getUserData(); // Get user data from session or other source
if (user_wants_quick_tips($user)) {
    // Display quick tips
}

// Get current quick tip ID
$currentTipId = get_current_quick_tip_id($user);

// Get quick tip by ID
$quickTip = get_quick_tip($currentTipId);

// Update current quick tip
update_current_quick_tip(10, $user);

// Update user's quick tip preference
update_tip_preference(false, $user);

Notes

  • The functions assume that the USERS table has a column named Preference Show Quick Tips, which indicates whether the user wants to see quick tips.
  • The QUICK-TIPS table should have a column named ID.
  • The update_user_by_id() function is assumed to be available for updating user data by ID.