### File Structure for Installation Source: https://risedocs.fairsketch.com/doc/view/55 This snippet illustrates the expected file and directory structure after uploading the RISE Ultimate Project Manager files to the server, typically in the public_html folder. ```text /app /assets /files /install /system /updates /writable /index.php ``` -------------------------------- ### Execute Docker Compose for SSL Setup Source: https://risedocs.fairsketch.com/doc/view/159-install-rise-to-aws-ec2 Runs the Docker Compose configuration to set up Nginx and Certbot for SSL certificate generation and application. This command builds the services defined in the docker-compose.yml file and starts them. ```bash cd /home/ubuntu/ssl && sudo docker-compose up --build ``` -------------------------------- ### Manual RISE Update using Git Source: https://risedocs.fairsketch.com/doc/view/56-rise-update-installation-guide Steps for manually updating RISE using Git, involving branching, merging, conflict resolution, and applying database/execute.php updates. Assumes familiarity with Git. ```bash git checkout master ``` ```bash git checkout new_updates_of_version_x ``` ```bash git checkout master ``` ```bash git merge new_updates_of_version_x ``` -------------------------------- ### RISE Ultimate Project Manager File Structure Source: https://risedocs.fairsketch.com/doc/view/55-quick-installation-guide This snippet illustrates the expected file structure of the RISE Ultimate Project Manager after uploading to the server, typically within the public_html directory. ```text /app /assets /files /install /system /writable /index.php ``` -------------------------------- ### Example Cron Job Command for RiseDocs Source: https://risedocs.fairsketch.com/knowledge_base/view/61-setup-cron-job-in-your-cpanel This is an example of a command that would be used to set up a cron job in cPanel for the RiseDocs application. The exact command will be provided within the RiseDocs settings. ```bash # Example command, replace with actual command from RiseDocs settings * * * * * /usr/local/bin/php /home/youruser/public_html/risedocs/artisan schedule:run >> /dev/null 2>&1 ``` -------------------------------- ### Show General Setting Example Source: https://risedocs.fairsketch.com/doc/view/52-available-hooks-for-plugins Provides an example of how to display custom settings within the general settings view using a view file. It hooks into 'app_hook_general_settings_extension'. ```php app_hooks()->add_action('app_hook_general_settings_extension', function() { //show settings //show a setting block (
) //check .../app/Views/settings/general.php for better ideas echo view("My_Plugin\Views\setting"); }); ``` -------------------------------- ### Applying SQL Updates Manually Source: https://risedocs.fairsketch.com/doc/view/56-rise-update-installation-guide Instructions for applying database updates via SQL files. This involves prefixing tables and executing commands using a tool like phpMyAdmin. It also mentions handling execute.php files for additional scripts. ```sql -- Add table prefix as used in /app/Config/Database.php -- Example: CREATE TABLE `your_prefix_tablename` ( -- ... -- ); ``` ```php // If execute.php contains database update scripts, remove them. // If it contains other necessary code, keep it. // Example: include 'execute.php'; // In Updates controller, create a method run_new_updates: // public function run_new_updates() { // // include file and execute necessary functions // } ``` -------------------------------- ### Install Required Software on EC2 Source: https://risedocs.fairsketch.com/doc/view/159-install-rise-to-aws-ec2 Installs Docker and Docker Compose on an Ubuntu EC2 instance, enabling the use of containerized applications. It updates the package list, installs Docker, adds the current user to the docker group, and installs Docker Compose and buildx. ```bash sudo apt update sudo apt upgrade  sudo apt install docker.io -y  sudo systemctl start docker  sudo systemctl enable docker sudo usermod -aG docker $USER  sudo apt install docker-compose -y  sudo apt install docker-buildx  ``` -------------------------------- ### Docker Compose Execution Source: https://risedocs.fairsketch.com/doc/view/159-install-rise-to-aws-ec2 Builds and starts Docker containers defined in a docker-compose.yml file in detached mode. ```shell cd /home/ubuntu/rise_public_site/docker && sudo docker-compose up --build -d ``` -------------------------------- ### Configure Routes for CodeIgniter Plugin Source: https://risedocs.fairsketch.com/knowledge_base/view/50-common-working-processes-in-plugins Defines routes for a CodeIgniter plugin, specifying the controller and namespace. Includes examples for GET and POST requests. Requires CodeIgniter framework. ```php $routes = Services::routes(); $routes->get('my_plugin', 'My_Plugin::index', ['namespace' => 'My_Plugin\Controllers']); $routes->get('my_plugin/(:any)', 'My_Plugin::$1', ['namespace' => 'My_Plugin\Controllers']); $routes->post('my_plugin/(:any)', 'My_Plugin::$1', ['namespace' => 'My_Plugin\Controllers']); //will be required if any data need to be posted ``` -------------------------------- ### Dockerfile for PHP-FPM with Extensions Source: https://risedocs.fairsketch.com/knowledge_base/view/159-install-rise-to-aws-ec2 Defines the Docker image for the PHP-FPM service. It starts from a PHP 8.2-fpm base image and installs essential PHP extensions like mysqli, pdo, pdo_mysql, GD, Intl, ZipArchive, and IMAP. ```dockerfile # Add PHP-FPM base image FROM php:8.2-fpm # Install required extensions RUN docker-php-ext-install mysqli pdo pdo_mysql  # Install GD extension RUN apt-get update && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev && docker-php-ext-configure gd --with-freetype --with-jpeg && docker-php-ext-install -j$(nproc) gd # Install Intl extension RUN apt-get install -y libicu-dev && docker-php-ext-install intl # Install ZipArchive extension RUN apt-get install -y libzip-dev && docker-php-ext-install zip # Install IMAP extension RUN apt-get install -y libc-client-dev libkrb5-dev && docker-php-ext-configure imap --with-kerberos --with-imap-ssl && docker-php-ext-install imap ``` -------------------------------- ### PHP-FPM Dockerfile (Dockerfile) Source: https://risedocs.fairsketch.com/doc/view/159-install-rise-to-aws-ec2 This Dockerfile sets up a PHP-FPM environment. It installs necessary PHP extensions like mysqli, pdo, pdo_mysql, gd, intl, zip, and imap, along with their build dependencies. ```dockerfile # Add PHP-FPM base image FROM php:8.2-fpm # Install required extensions RUN docker-php-ext-install mysqli pdo pdo_mysql # Install GD extension RUN apt-get update && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev && docker-php-ext-configure gd --with-freetype --with-jpeg && docker-php-ext-install -j$(nproc) gd # Install Intl extension RUN apt-get install -y libicu-dev && docker-php-ext-install intl # Install ZipArchive extension RUN apt-get install -y libzip-dev && docker-php-ext-install zip # Install IMAP extension RUN apt-get install -y libc-client-dev libkrb5-dev && docker-php-ext-configure imap --with-kerberos --with-imap-ssl && docker-php-ext-install imap ``` -------------------------------- ### Create Directories on EC2 Source: https://risedocs.fairsketch.com/doc/view/159-install-rise-to-aws-ec2 Creates the necessary directory structure for the RISE CRM database, public site files, and letsencrypt certificates on the EC2 instance. ```bash mkdir -p /home/ubuntu/rise_db /home/ubuntu/rise_public_site /home/ubuntu/letsencrypt ``` -------------------------------- ### Nginx Entrypoint Script Source: https://risedocs.fairsketch.com/doc/view/159-install-rise-to-aws-ec2 A bash script executed as the entrypoint for the Nginx container. It waits for dependencies, sets permissions, and then executes the default Docker command. ```bash #!/bin/bash set -e sleep 5 echo "Running nginx post-startup script." chown -R www-data:www-data /var/www/html chmod -R 755 /var/www/html # Execute CMD from Dockerfile exec "$@" ``` -------------------------------- ### Navigate to Directory (Shell) Source: https://risedocs.fairsketch.com/doc/view/159-install-rise-to-aws-ec2 This command changes the current directory to the RISE CRM directory. It's a prerequisite for subsequent Docker setup steps. ```shell cd /home/ubuntu/rise_public_site ``` -------------------------------- ### Save General Setting Example Source: https://risedocs.fairsketch.com/doc/view/52-available-hooks-for-plugins Provides an example of how to save custom settings from the general settings form. It hooks into 'app_hook_general_settings_save_data'. ```php app_hooks()->add_action('app_hook_general_settings_save_data', function () { $request = \Config\Services::request(); $your_setting_value = $request->getPost("your_setting"); $Settings_model = model("App\Models\Settings_model"); $Settings_model->save_setting("your_setting", $your_setting_value); }); ``` -------------------------------- ### Register Installation Hook for Plugins (PHP) Source: https://risedocs.fairsketch.com/knowledge_base/view/51-available-functions-for-plugins Registers a hook that triggers when a plugin is about to install. This is used for executing SQL queries or validating purchase codes. ```php register_installation_hook("My_Plugin", function ($item_purchase_code) { //validate purchase code if you wish if (!validate_purchase_code($item_purchase_code)) { echo json_encode(array("success" => false, 'message' => "Invalid purchase code")); exit(); } //run necessary sql queries $db = db_connect('default'); $db_prefix = get_db_prefix(); $db->query("SET sql_mode = ''"); $db->query("CREATE TABLE IF NOT EXISTS `" . $db_prefix . "plugin_table` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL , `deleted` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;"); }); ``` -------------------------------- ### Create Docker Directory (Shell) Source: https://risedocs.fairsketch.com/doc/view/159-install-rise-to-aws-ec2 This command creates a new directory named 'docker' and then changes the current directory into it. This is where Docker-related files will be placed. ```shell mkdir docker && cd docker ``` -------------------------------- ### PHP Configuration Settings Source: https://risedocs.fairsketch.com/doc/view/159-install-rise-to-aws-ec2 Defines upload and post sizes for PHP, allowing larger file uploads and POST data. ```ini upload_max_filesize = 200M post_max_size = 200M ``` -------------------------------- ### Connect to EC2 Instance via SSH Source: https://risedocs.fairsketch.com/doc/view/159-install-rise-to-aws-ec2 Establishes an SSH connection to an AWS EC2 instance. Requires the path to the private key file and the public IP address of the EC2 instance. ```bash ssh -i your-key.pem ubuntu@your-ec2-ip ``` -------------------------------- ### Environment Variables for MySQL Source: https://risedocs.fairsketch.com/doc/view/159-install-rise-to-aws-ec2 Sets environment variables for connecting to a MySQL database, including credentials and database name. ```env MYSQL_ROOT_PASSWORD=set_root_password MYSql_DATABASE=set_db_name MYSql_USER=set_db_user MYSql_PASSWORD=set_db_password ``` -------------------------------- ### Render Views in CodeIgniter Plugin Source: https://risedocs.fairsketch.com/doc/view/50-common-working-processes-in-plugins Provides examples of how to render views within a CodeIgniter plugin. It demonstrates using the template library's `rander()` and `view()` functions, as well as the default CodeIgniter `view()` function. ```php $view_data['foo'] = "bar"; //$this->template->rander() function will show the view with left menu and topbar by default. return $this->template->rander('My_Plugin\Views\folder\index', $view_data); //$this->template->view() function will show only the view, but here you'll get the login user's info as $login_user variable if any login user exists return $this->template->view('My_Plugin\Views\folder\index', $view_data); //default view() function of CI return view('My_Plugin\Views\folder\index', $view_data); ``` -------------------------------- ### Create a Controller for CodeIgniter Plugin Source: https://risedocs.fairsketch.com/doc/view/50-common-working-processes-in-plugins Demonstrates the basic structure of a controller for a CodeIgniter plugin. It shows how to define a namespace and extend the application's security controller to leverage existing functionalities. ```php add_action('app_hook_general_settings_extension', function() { //show settings //show a setting block (
//check .../app/Views/settings/general.php for better ideas echo view("My_Plugin\Views\setting"); }); ``` -------------------------------- ### Update Database Credentials (PHP) Source: https://risedocs.fairsketch.com/doc/view/57-move-from-one-hosting-server-to-another-migration-guide Modify the database connection details in the `Database.php` configuration file. This is crucial after migrating your database to a new server. ```php Update the database credentials in /app/Config/Database .php. ``` -------------------------------- ### Docker Compose Configuration for Rise CRM Source: https://risedocs.fairsketch.com/knowledge_base/view/159-install-rise-to-aws-ec2 Defines the services for the Rise CRM application using Docker Compose. It includes configurations for PHP (rise_php), Nginx (rise_nginx), and MySQL (rise_mysql) services, along with network setup. This file orchestrates the multi-container application. ```yaml version: '3.9' services: rise_php: build: context: . dockerfile: ./dockerfile-php container_name: rise_php restart: always volumes: - ../app:/var/www/html/app - ../assets:/var/www/html/assets - ../files:/var/www/html/files - ../install:/var/www/html/install - ../plugins:/var/www/html/plugins - ../system:/var/www/html/system - ../updates:/var/www/html/updates - ../writable:/var/www/html/writable - ../index.php:/var/www/html/index.php logging: driver: "json-file" options: max-size: "10m" max-file: "3" networks: - rise_proxy_network rise_nginx: image: nginx:latest container_name: rise_nginx restart: always volumes: - ../app:/var/www/html/app - ../assets:/var/www/html/assets - ../files:/var/www/html/files - ../updates:/var/www/html/updates - ../writable:/var/www/html/writable - ../install:/var/www/html/install - ../plugins:/var/www/html/plugins - ../index.php:/var/www/html/index.php - ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf - ./nginx/entrypoint:/docker-entrypoint.d - ../certbot/www:/var/www/certbot - /home/ubuntu/ssl/certbot/conf:/etc/letsencrypt logging: driver: "json-file" options: max-size: "10m" max-file: "3" depends_on: - rise_php ports: - "80:80" - "443:443"   networks: - rise_proxy_network rise_mysql: image: mysql:8.0 restart: always container_name: rise_mysql volumes: - /home/ubuntu/rise_db:/var/lib/mysql environment: MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} MYSQL_DATABASE: ${MYSQL_DATABASE} MYSQL_USER: ${MYSQL_USER} MYSQL_PASSWORD: ${MYSQL_PASSWORD} logging: driver: "json-file" options: max-size: "10m" max-file: "3" ports: - "3306:3306" networks: - rise_proxy_network networks: rise_proxy_network: name: rise_proxy_network driver: bridge external: true ``` -------------------------------- ### Define Routes in CodeIgniter Plugin Source: https://risedocs.fairsketch.com/doc/view/50-common-working-processes-in-plugins Specifies how to define routes for a plugin in CodeIgniter. This allows the main application to detect and route requests to the plugin's controllers. It covers GET and POST requests and namespace configuration. ```php get('my_plugin', 'My_Plugin::index', ['namespace' => 'My_Plugin\Controllers']); $routes->get('my_plugin/(:any)', 'My_Plugin::$1', ['namespace' => 'My_Plugin\Controllers']); $routes->post('my_plugin/(:any)', 'My_Plugin::$1', ['namespace' => 'My_Plugin\Controllers']); //will be required if any data need to be posted ``` -------------------------------- ### Get File Preview Source URL Source: https://risedocs.fairsketch.com/doc/view/52-available-hooks-for-plugins Filters to obtain the source URL of a file, typically used for displaying file previews. It extracts a file ID from file information and passes it to the storage integration library to get the URL. ```php app_hooks()->add_filter('app_filter_get_source_url_of_file', function ($data) { //check get_source_url_of_file() function on .../app/Helpers/app_files_helper.php for better ideas $file_info = get_array_value($data, "file_info"); $file_id = get_array_value($file_info, "file_id"); return \Your_Storage_Integration\Libraries\Your_Storage_Integration::get_source_url_of_file($file_id); }); ``` -------------------------------- ### Register Plugin Installation Hook Source: https://risedocs.fairsketch.com/doc/view/51-available-functions-for-plugins Registers a hook that is triggered when a plugin is about to install. This is the place to execute required SQL queries or perform purchase code validation. ```php register_installation_hook("My_Plugin", function ($item_purchase_code) { //validate purchase code if you wish if (!validate_purchase_code($item_purchase_code)) { echo json_encode(array("success" => false, 'message' => "Invalid purchase code")); exit(); } //run necessary sql queries $db = db_connect('default'); $db_prefix = get_db_prefix(); $db->query("SET sql_mode = ''"); $db->query("CREATE TABLE IF NOT EXISTS `" . $db_prefix . "plugin_table` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` TEXT CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL , `deleted` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;"); }); ``` -------------------------------- ### Change Base URL (PHP) Source: https://risedocs.fairsketch.com/doc/view/57-move-from-one-hosting-server-to-another-migration-guide Update the base URL in the `App.php` configuration file if you are also changing the domain name during the server migration. This ensures correct URL generation within the application. ```php Change the $baseURL in /app/Config/App .php (Only required if you change the domain name). ``` -------------------------------- ### Update Base URL (PHP) Source: https://risedocs.fairsketch.com/knowledge_base/view/57-move-from-one-hosting-server-to-another-migration-guide Adjust the base URL of your application by modifying the `$baseURL` setting in the `App.php` configuration file. This step is necessary if you are changing the domain name during the migration. ```php // /app/Config/App.php $baseURL = 'https://newdomain.com/'; // Or if the domain remains the same: // $baseURL = 'https://yourdomain.com/'; ``` -------------------------------- ### Add Email Template to Database (SQL) Source: https://risedocs.fairsketch.com/doc/view/52-available-hooks-for-plugins Provides the SQL INSERT statement required to add a new email template to the `email_templates` table. This is typically done during plugin installation. ```sql INSERT INTO `email_templates` (`template_name`, `email_subject`, `default_message`, `custom_message`, `deleted`) VALUES ('your_email_template', 'Email subject', 'CONTENT OF YOUR EMAIL TEMPLATE', '', '0'); ``` -------------------------------- ### Nginx Server Configuration (HTTP and HTTPS) Source: https://risedocs.fairsketch.com/doc/view/159-install-rise-to-aws-ec2 Configures Nginx to listen on ports 80 and 443, handle SSL certificates, redirect HTTP to HTTPS, and process PHP requests via FastCGI. ```nginx server { listen 80; server_name yourdomain.com; client_max_body_size 200M; location ~ /.well-known/acme-challenge/ { root /var/www/certbot; } root /var/www/html; # Redirect HTTP to HTTPS return 301 https://$host$request_uri; } server { listen 443 ssl; server_name yourdomain.com; client_max_body_size 200M; root /var/www/html; # Block access to sensitive directories location /app { deny all; } location /system { deny all; } location /writable { deny all; } # SSL certificates ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem; location / { index index.php index.html index.htm; try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { fastcgi_pass rise_php:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } ``` -------------------------------- ### Stop Docker Compose Containers Source: https://risedocs.fairsketch.com/doc/view/159-install-rise-to-aws-ec2 Stops and removes the running Docker containers defined in the docker-compose.yml file. This is typically used after the SSL certificate has been successfully obtained. ```bash cd /home/ubuntu/ssl && sudo docker-compose down ``` -------------------------------- ### Configure Nginx and Certbot with Docker Compose Source: https://risedocs.fairsketch.com/knowledge_base/view/159-install-rise-to-aws-ec2 Sets up a Docker Compose file to run Nginx as a web server and Certbot for SSL certificate generation. This configuration includes Nginx serving challenges for certificate validation and Certbot obtaining certificates for a specified domain. ```yaml version: '3.8' services: nginx: image: nginx:latest container_name: rise_nginx restart: always ports: - "80:80" - "443:443" volumes: - ./certbot/www:/var/www/certbot - ./certbot/conf:/etc/letsencrypt networks: - rise_network command: > /bin/sh -c "echo ' server { listen 80; server_name yourdomain.com; location /.well-known/acme-challenge/ { root /var/www/certbot; } location / { return 404; } } ' > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'" certbot: image: certbot/certbot container_name: certbot volumes: - ./certbot/www:/var/www/certbot - ./certbot/conf:/etc/letsencrypt entrypoint: "/bin/sh -c 'certbot certonly --webroot -w /var/www/certbot --email your-email@example.com -d yourdomain.com --agree-tos --no-eff-email && exit 0'" depends_on: - nginx networks: - rise_network networks: rise_network: ``` -------------------------------- ### Configure Nginx and Certbot with Docker Compose Source: https://risedocs.fairsketch.com/doc/view/159-install-rise-to-aws-ec2 Sets up Nginx and Certbot services using Docker Compose for SSL certificate management. This configuration defines Nginx to serve challenges and Certbot to obtain and renew SSL certificates for a specified domain. ```yaml version: '3.8' services: nginx: image: nginx:latest container_name: rise_nginx restart: always ports: - "80:80" - "443:443" volumes: - ./certbot/www:/var/www/certbot - ./certbot/conf:/etc/letsencrypt networks: - rise_network command: > /bin/sh -c 'echo "server { listen 80; server_name yourdomain.com; location /.well-known/acme-challenge/ { root /var/www/certbot; } location / { return 404; } }" > /etc/nginx/conf.d/default.conf && nginx -g "daemon off;"' certbot: image: certbot/certbot container_name: certbot volumes: - ./certbot/www:/var/www/certbot - ./certbot/conf:/etc/letsencrypt entrypoint: "/bin/sh -c 'certbot certonly --webroot -w /var/www/certbot --email your-email@example.com -d yourdomain.com --agree-tos --no-eff-email && exit 0'" depends_on: - nginx networks: - rise_network networks: rise_network: ``` -------------------------------- ### Update Database Credentials (PHP) Source: https://risedocs.fairsketch.com/knowledge_base/view/57-move-from-one-hosting-server-to-another-migration-guide Modify the database connection details by updating the `$db` array in the `Database.php` configuration file. This is crucial after migrating your database to a new server. ```php // /app/Config/Database.php $db = [ // ... other database settings 'hostname' => 'new_server_hostname', 'username' => 'new_db_username', 'password' => 'new_db_password', 'database' => 'new_database_name', // ... ]; ``` -------------------------------- ### Add Item to Admin Settings Menu in PHP Source: https://risedocs.fairsketch.com/doc/view/52-available-hooks-for-plugins This PHP snippet uses a filter hook to add a new item to the 'setup' section of the admin settings menu. It specifies the name and URL for the new setting. ```php app_hooks()->add_filter('app_filter_admin_settings_menu', function($settings_menu) { $settings_menu["setup"][] = array("name" => "my_plugin_setting", "url" => "my_plugin/setting"); return $settings_menu; }); ``` -------------------------------- ### Create a Model for CodeIgniter Plugin Source: https://risedocs.fairsketch.com/doc/view/50-common-working-processes-in-plugins Illustrates how to create a model for a CodeIgniter plugin by extending the application's Crud_model. This allows the plugin to interact with the database using the application's model structure. ```php add_action('app_hook_signup_extension', function() { //show something }); ``` -------------------------------- ### Prepare and Attach Invoice PDF in PHP Source: https://risedocs.fairsketch.com/doc/view/52-available-hooks-for-plugins This code prepares an invoice PDF by fetching data, creating the PDF, and then setting it as an attachment for an email. It's used to send invoices as attachments. ```php $invoice_data = get_invoice_making_data(invoice_id); $attachement_url = prepare_invoice_pdf($invoice_data, "send_email"); $email_options["attachments"] = array(array("file_path" => $attachement_url)); ``` -------------------------------- ### Define Custom Storage Constant Source: https://risedocs.fairsketch.com/doc/view/52-available-hooks-for-plugins Defines the PLUGIN_CUSTOM_STORAGE constant on the pre_system event. This is the first step for adding custom storage integration. ```php Events::on('pre_system', function () { if (!defined('PLUGIN_CUSTOM_STORAGE')) { define('PLUGIN_CUSTOM_STORAGE', TRUE); } }); ``` -------------------------------- ### Register Plugin Activation Hook Source: https://risedocs.fairsketch.com/doc/view/51-available-functions-for-plugins Registers a hook that is triggered when a plugin is about to be activated. Use this function to perform any setup required for the plugin to become active. ```php register_activation_hook("My_Plugin", function () { //run something }); ``` -------------------------------- ### Regenerate app.all.js - Risedocs Fairsketch Source: https://risedocs.fairsketch.com/doc/view/60-development-customization To re-generate the 'app.all.js' file, locate the relevant commented code within '/app/Views/includes/head.php'. Uncomment the necessary lines, browse the project to trigger the regeneration, and then remember to revert the commented code. ```PHP ``` -------------------------------- ### Handle After Signin Source: https://risedocs.fairsketch.com/doc/view/52-available-hooks-for-plugins Executes custom logic after a user successfully signs in. It uses the 'app_hook_after_signin' action hook. ```php app_hooks()->add_action('app_hook_after_signin', function() { //do something }); ``` -------------------------------- ### Instantiate Library in CodeIgniter Plugin Source: https://risedocs.fairsketch.com/knowledge_base/view/50-common-working-processes-in-plugins Instantiates a custom library within a CodeIgniter plugin. This enables the usage of custom library methods within the plugin. Requires CodeIgniter framework. ```php $my_plugin_library = new \My_Plugin\Libraries\My_Plugin_Library(); ``` -------------------------------- ### Enable Development Mode (.env) Source: https://risedocs.fairsketch.com/doc/view/59-error-debugging-and-troubleshooting Create a .env file in the root directory to enable development mode, which displays errors directly. This is not recommended for production environments. Delete the .env file after debugging. ```env CI_ENVIRONMENT = development ``` -------------------------------- ### Assemble Email Information Array in PHP Source: https://risedocs.fairsketch.com/doc/view/52-available-hooks-for-plugins This snippet constructs an array containing all the necessary information for sending an email, including subject, message, email options, and attachment URL. ```php $info_array = array( "subject" => $subject, "message" => $message, "email_options" => $email_options, "attachement_url" => $attachement_url, ); return $info_array; ``` -------------------------------- ### Show Layout Main View Extension Source: https://risedocs.fairsketch.com/doc/view/52-available-hooks-for-plugins Displays content in the main view of the page layout for logged-in users. It uses the 'app_hook_layout_main_view_extension' action hook. ```php app_hooks()->add_action('app_hook_layout_main_view_extension', function() { //show something }); ``` -------------------------------- ### Enable CSP in App.php Source: https://risedocs.fairsketch.com/doc/view/167-enable-content-security-policy-csp This code snippet shows how to enable the Content Security Policy (CSP) feature by setting the CSPEnabled property to true in the App.php configuration file. ```php public $CSPEnabled = true; ``` -------------------------------- ### Handle Before Signout Source: https://risedocs.fairsketch.com/doc/view/52-available-hooks-for-plugins Executes custom logic before a user signs out. It uses the 'app_hook_before_signout' action hook. ```php app_hooks()->add_action('app_hook_before_signout', function() { //do something }); ``` -------------------------------- ### Pass Data and Render Views in CodeIgniter Plugin Source: https://risedocs.fairsketch.com/knowledge_base/view/50-common-working-processes-in-plugins Demonstrates different methods for rendering views within a CodeIgniter plugin. Includes options for rendering with a template, rendering only the view, and using CodeIgniter's default view function. Requires CodeIgniter framework. ```php $view_data['foo'] = "bar"; //$this->template->rander() function will show the view with left menu and topbar by default. return $this->template->rander('My_Plugin\Views\folder\index', $view_data); //$this->template->view() function will show only the view, but here you'll get the login user's info as $login_user variable if any login user exists return $this->template->view('My_Plugin\Views\folder\index', $view_data); //default view() function of CI return view('My_Plugin\Views\folder\index', $view_data); ``` -------------------------------- ### Define Library for CodeIgniter Plugin Source: https://risedocs.fairsketch.com/knowledge_base/view/50-common-working-processes-in-plugins Defines a library for a CodeIgniter plugin. Libraries are reusable components that can be used across different parts of your plugin. Requires CodeIgniter framework. ```php namespace My_Plugin\Libraries; class My_Plugin_Library { //your methods } ``` -------------------------------- ### Gmail IMAP Troubleshooting: App Password Generation Source: https://risedocs.fairsketch.com/doc/view/65-create-tickets-automatically-from-emails This guide outlines the steps to generate an App Password for Gmail IMAP integration. It involves enabling 2-Step Verification and creating a custom app password within your Google Account security settings. ```text 1. Go to your Google Account and navigate Security tab. 2. Enable 2-Step Verification from Signing in to Google section. 3. After this, there will be a new section called App passwords in Signing in to Google section. Click on that. 4. From Select app dropdown, select Other (Custom name). 5. Input any name like RISE and click on GENERATE button. 6. You'll get the password with yellow badge on a popup. Use this password in the IMAP setting instead of your main password. ``` -------------------------------- ### Add Custom Notification Descriptions for Slack (PHP) Source: https://risedocs.fairsketch.com/knowledge_base/view/52-available-hooks-for-plugins Integrates custom descriptions for Slack notifications, allowing for tailored content specific to the Slack channel. It references a dedicated view file for Slack formatting. ```php app_hooks()->add_filter('app_filter_notification_description_for_slack', function ($notification_descriptions, $notification) { $notification_descriptions[] = view("your_notification_description_for_slack", array("notification" => $notification)) //check .../app/Views/notifications/notification_description_for_slack.php return $notification_descriptions; }); ``` -------------------------------- ### Add Custom Theme Color in FairSketch Source: https://risedocs.fairsketch.com/knowledge_base/view/125-change-the-app-theme This guide explains how to add a custom theme color to the FairSketch application to match brand identity. It involves copying an existing CSS file, renaming it according to the brand color, and updating color codes within the file. This allows for personalized theming across the application. ```css /* Example: Copy an existing CSS file (e.g., 2e86c1.css) */ /* Rename it to your brand color (e.g., ffbb22.css) */ /* Open the new file (ffbb22.css) in a text editor */ /* Replace existing color codes with your brand color codes */ /* For example, replace '2e86c1' with 'ffbb22' */ body { background-color: #ffbb22; } .header { background-color: #ffbb22; color: white; } /* Save the file and it will be available in the app */ ``` -------------------------------- ### Regenerate app.all.js Source: https://risedocs.fairsketch.com/knowledge_base/view/60-development-customization Instructions on how to regenerate the 'app.all.js' file in Risedocs Fairsketch. This process involves uncommenting specific code within the '/app/Views/includes/head.php' file, browsing the project, and then reverting the changes. ```php '; // After regenerating, remember to comment these lines back out. ``` -------------------------------- ### Prepare Notification Query (PHP) Source: https://risedocs.fairsketch.com/doc/view/52-available-hooks-for-plugins Adds a filter to modify the WHERE query for creating notifications. This allows dynamic filtering of recipients based on notification data. The `$data` array contains details about the event, user, options, and notification terms. ```php app_hooks()->add_filter('app_filter_create_notification_where_query', function ($where_queries_from_hook, $data) { //prepare WHERE query and return //check ...app/Models/Notifications_model.php > function create_notification() for better ideas /* The $data variable has this key values: "event" => Event key (your_notification_key). "user_id" => Which user created the notification. If it's 0, then it's created by the app. "options" => It contains another array of available notification item ids. Check ...app/Models/Notifications_model.php > function create_notification() for better ideas. "notify_to_terms" => Notify to terms array as selected in notification setting for this event. Like array("team_members", "team", "project_members"). */ $where_queries_from_hook[] = "YOUR QUERIES"; return $where_queries_from_hook; }); ```