Skip to content

Instantly share code, notes, and snippets.

//Contact Capabilities
edit_wpcrm-contact
read_wpcrm-contact
delete_wpcrm-contact
edit_wpcrm-contacts
edit_others_wpcrm-contacts
publish_wpcrm-contacts
read_private_wpcrm-contacts
read_wpcrm-contact
delete_wpcrm-contacts
@wpcrmsystem
wpcrmsystem / invoice-data.php
Created April 11, 2016 20:13
Variables available to edit WP-CRM System Invoicing template.
$status //Returns 'not-paid' or 'paid'
$businessImage //Returns the URL to the image for your business set in WP-CRM System>Settings>Invoicing tab
$businessName //Returns the name of the business set in WP-CRM System>Settings>Invoicing tab
$businessAddress //Returns the address for the business set in WP-CRM System>Settings>Invoicing tab
$businessPhone //Returns the phone number for the business set in WP-CRM System>Settings>Invoicing tab
$businessEmail //Returns the email address for the business set in WP-CRM System>Settings>Invoicing tab
$businessURL //Returns the website URL for the business set in WP-CRM System>Settings>Invoicing tab
$numFields //Returns the number of line items for a specific invoice. Used to loop through each line. See for loop starting on line 124 of the default template.
for ( $x = 1; $x <= $numFields; $x++ ) {
$lineName[$x] //Returns the name of the product/service on a line item.
@wpcrmsystem
wpcrmsystem / ninja-demo-page-filter.php
Created May 2, 2016 17:45 — forked from zachskaggs/ninja-demo-page-filter.php
Ninja Demo Page Filter Example
<?php
function add_pages_to_filter( $array ) {
$array[] = 'post-new.php?post_type=my-custom-post-type';
return $array;
}
add_filter( 'nd_allowed_pages' , 'add_pages_to_filter' );
@wpcrmsystem
wpcrmsystem / wp-crm-system-dashboard-reports.php
Created August 30, 2016 19:39
WP-CRM System Custom Roles
/* How are displayed in the dropdown menu on WP-CRM System Dashboard
-------------------------------------------------------------------*/
add_filter( 'wpcrm_system_user_role_options', 'wpcrm_system_select_user_roles', 10 );
//roles should be listed with a capability as the key and the name of the role as the value
//all roles with the capability listed in the key will have access to WP-CRM System
function wpcrm_system_select_user_roles( $array ){
$array = array(
'manage_options' => __('Administrator', 'wp-crm-system'),
'edit_pages' => __('Editor', 'wp-crm-system'),
@wpcrmsystem
wpcrmsystem / wp-crm-system.php
Created August 30, 2016 19:48
WP-CRM System Update Capabilities
/* Default User Roles
--------------------*/
add_filter( 'wpcrm_system_default_user_roles', 'wpcrm_system_check_user_roles', 10 );
function wpcrm_system_check_user_roles( $array ){
$array = array(
'subscriber',
'contributor',
'author',
'editor',
'administrator'
@wpcrmsystem
wpcrmsystem / wp-crm-system-dashboard-reports.php
Created August 30, 2016 20:00
WP-CRM System Dashboard Boxes
/* Action hooks that add the default boxes.
-----------------------------------------*/
add_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_create_new_box', 1 );
add_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_extensions_box', 2 );
add_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_categories_box', 3 );
add_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_settings_box', 4 );
add_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_projects_box', 5 );
add_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_tasks_box', 6 );
add_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_opportunities_box', 7 );
add_action( 'wpcrm_system_custom_dashboard_boxes', 'wpcrm_system_dashboard_campaigns_box', 8 );
@wpcrmsystem
wpcrmsystem / wp-crm-system.php
Created August 30, 2016 20:11
WP-CRM System Custom Fields and Meta Boxes
<?php
/* Add a new meta box with your own custom field.
------------------------------------------------*/
// Add a custom meta box to Contact edit pages.
// For more information, see https://developer.wordpress.org/reference/functions/add_meta_box/
function extend_wpcrm_system() {
add_meta_box( 'wpcrm_custom_meta', __( 'Custom Meta', 'wp-crm-system-extend' ), 'wpcrmCustomMeta', 'wpcrm-contact', 'side', 'low' );
}
add_action( 'wpcrm_system_custom_meta_boxes', 'extend_wpcrm_system' );
@wpcrmsystem
wpcrmsystem / overview-reports.php
Created August 30, 2016 20:28
Modify overview report tab
<?php
/* Default hooks that display on overview page
-----------------------------------------------*/
add_action( 'wpcrm_system_overview_reports', 'wpcrm_system_opportunity_value_overview_report', 1 );
add_action( 'wpcrm_system_overview_reports', 'wpcrm_system_projects_value_overview_report', 2 );
add_action( 'wpcrm_system_overview_reports', 'wpcrm_system_overdue_tasks_overview_report', 3 );
/* Reorder overview report lines
--------------------------------*/
remove_action( 'wpcrm_system_overview_reports', 'wpcrm_system_opportunity_value_overview_report', 1 );
@wpcrmsystem
wpcrmsystem / wp-crm-system-reports.php
Created August 30, 2016 20:43
Add Tab to WP-CRM System Reports
<?php
/* Add custom report tab and content
------------------------------------*/
// Add custom report's tab
add_action( 'wpcrm_system_report_tab', 'wpcrm_system_custom_report_tab', 8 );
function wpcrm_system_custom_report_tab() {
// Retrieve the active tab
global $wpcrm_reports_active_tab;
//Be sure 'my-tab-name' is the same in both places! ?>
<a class="nav-tab <?php echo $wpcrm_reports_active_tab == 'my-tab-name' ? 'nav-tab-active' : ''; ?>" href="?page=wpcrm-reports&tab=my-tab-name"><?php _e('My Tab Name', 'wp-crm-system'); ?></a>
@wpcrmsystem
wpcrmsystem / wp-crm-system.php
Created August 30, 2016 20:49
Add custom settings page
<?php
// Add a tab to the dashboard page
function wpcrm_system_custom_setting_tab() {
//Get current dashboard tab name
global $wpcrm_active_tab;
//Be sure that 'my-tab-name' is the same in both places! ?>
<a class="nav-tab <?php echo $wpcrm_active_tab == 'my-tab-name' ? 'nav-tab-active' : ''; ?>" href="?page=wpcrm-settings&tab=my-tab-name"><?php _e('My Tab Name', 'wp-crm-system') ?></a>
<?php }
add_action( 'wpcrm_system_settings_tab', 'wpcrm_system_custom_setting_tab' );