64a4dd30 by Jeff Balicki

clean up

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent ec90ef80
......@@ -3,10 +3,12 @@ error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED);
@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );
require_once __DIR__ . '/vendor/autoload.php';
require_once 'inc/users.php';
require_once 'inc/learn.php';
require_once 'inc/menus.php';
require_once 'inc/menus_widgets.php';
require_once 'inc/custom_post_type.php';
add_action('wp_enqueue_scripts', 'theme_broker_enqueue_scripts');
function theme_broker_enqueue_scripts()
......@@ -129,9 +131,6 @@ function theme_broker_enqueue_scripts()
}
function wp_disable_emojis()
{
remove_action('wp_head', 'print_emoji_detection_script', 7);
......@@ -156,7 +155,6 @@ function my_deregister_styles(){
add_action('init', 'wp_disable_emojis');
add_filter('the_content', 'attachment_image_link_remove_filter');
function attachment_image_link_remove_filter($content)
{
......@@ -200,42 +198,6 @@ add_theme_support('custom-header');
function register_widgets()
{
register_sidebar(array(
'name' => 'Footer Sidebar 1',
'id' => 'footer-sidebar-1',
'description' => 'Appears in the footer area',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
));
register_sidebar(array(
'name' => 'Footer Sidebar 2',
'id' => 'footer-sidebar-2',
'description' => 'Appears in the footer area',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
));
register_sidebar(array(
'name' => 'Footer Sidebar 3',
'id' => 'footer-sidebar-3',
'description' => 'Appears in the footer area',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
));
}
add_action('admin_head', 'my_custom_css');
function my_custom_css() {
......@@ -246,8 +208,8 @@ function my_custom_css() {
</style>';
}
//end register_widgets()
add_action('widgets_init', 'register_widgets');
/**
......@@ -316,81 +278,7 @@ function projectivemotion_logout_home($logouturl, $redir)
return $logouturl . '&amp;redirect_to=' . urlencode($redir);
}
/**
* Redirect login page to custom login page
*/
function redirect_login_page()
{
// Store for checking if this page equals wp-login.php
$page_viewed = basename($_SERVER['SCRIPT_NAME']);
// Where we want them to go
$login_page = site_url('/broker-login');
// Two things happen here, we make sure we are on the login page
// and we also make sure that the request isn't coming from a form
// this ensures that our scripts & users can still log in and out.
if ($page_viewed == "wp-login.php" && $_GET["action"] == 'rp') {
$key = $_GET["key"];
$login = $_GET["login"];
$password_reset = site_url('/password-reset/?action=rp&key=' . $key . '&login=' . $login);
// And away they go...
wp_redirect($password_reset);
exit();
}
if ($page_viewed == "wp-login.php" && $_GET["action"] == 'lostpassword') {
$lost = site_url('/lost-password/');
// And away they go...
wp_redirect($lost);
exit();
}
if ($page_viewed == "wp-login.php" && $_GET["action"] == 'logout') {
wp_logout();
}
if ($page_viewed == "wp-login.php" && $_SERVER['REQUEST_METHOD'] == 'GET') {
// And away they go...
wp_redirect($login_page);
exit();
}
}
//add_action('init', 'redirect_login_page');
function my_login_redirect($redirect_to, $request, $user)
{
//is there a user to check?
global $user;
if (isset($user->roles) && is_array($user->roles)) {
//check for admins
if (in_array("administrator", $user->roles)) {
// redirect them to the default place
// return home_url();
return $redirect_to; //get rid of this for testing purposes
} else {
return $redirect_to;
}
} else {
return $redirect_to;
}
}
//add_filter("login_redirect", "my_login_redirect", 10, 3);
// Change from email address
//add_filter('wp_mail_from', 'custom_wp_mail_from');
function custom_wp_mail_from($email)
{
//Make sure the email is from the same domain
//as your website to avoid being marked as spam.
return 'lost_password@thecommonwell.ca';
}
add_filter('mandrill_payload', 'sendEmailThroughMandrillSubaccount', 100);
function sendEmailThroughMandrillSubaccount(array $message)
......@@ -410,19 +298,6 @@ function custom_wp_mail_from_name($original_email_from)
add_action('wp_ajax_nopriv_ajax-callback', 'ajax_callback');
add_action('wp_ajax_ajax-callback', 'ajax_callback');
// Disable password reset function
function remove_lostpassword_text($text)
{
if ($text == 'Lost your password?') {
$text = '';
}
return $text;
}
//add_filter('gettext', 'remove_lostpassword_text');
add_action('init', 'handle_preflight');
function handle_preflight()
......@@ -450,75 +325,6 @@ add_role(
);
// Our custom post type function
function create_posttype()
{
// Set UI labels for Custom Post Type
$labels = array(
'name' => _x('Notifications', 'Post Type General Name', 'commonwell-corp'),
'singular_name' => _x('Notification', 'Post Type Singular Name', 'commonwell-corp'),
'menu_name' => __('Notifications', 'commonwell-corp'),
'parent_item_colon' => __('Parent Notification', 'commonwell-corp'),
'all_items' => __('All Notifications', 'commonwell-corp'),
'view_item' => __('View Notification', 'commonwell-corp'),
'add_new_item' => __('Add New Notification', 'commonwell-corp'),
'add_new' => __('Add New', 'commonwell-corp'),
'edit_item' => __('Edit Notification', 'commonwell-corp'),
'update_item' => __('Update Notification', 'commonwell-corp'),
'search_items' => __('Search Notification', 'commonwell-corp'),
'not_found' => __('Not Found', 'commonwell-corp'),
'not_found_in_trash' => __('Not found in Trash', 'commonwell-corp'),
);
// Set other options for Custom Post Type
$args = array(
'label' => __('notifications', 'twentythirteen'),
'description' => __('notification news and reviews', 'twentythirteen'),
'labels' => $labels,
// Features this CPT supports in Post Editor
'supports' => array(
'title',
'editor',
'excerpt',
'author',
'thumbnail',
'comments',
'featured_image',
'set_featured_image',
'use_featured_image',
'revisions',
'custom-fields',
),
// You can associate this CPT with a taxonomy or custom taxonomy.
'taxonomies' => array('genres'),
/* A hierarchical CPT is like Pages and can have
* Parent and child items. A non-hierarchical CPT
* is like Posts.
*/
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'post',
);
// Registering your Custom Post Type
register_post_type('notifications', $args);
}
// Hooking up our function to theme setup
add_action('init', 'create_posttype');
/*
* Creating a function to create our CPT
......@@ -879,13 +685,10 @@ function add_hr_shortcode()
add_action('wp_logout', 'remove_custom_cookie_admin');
function remove_custom_cookie_admin()
{
setcookie('dialog_cookie', '', time() - 96400, '/');
}
function remove_custom_cookie_admin()
{
setcookie('dialog_cookie', '', time() - 96400, '/');
}
if (!function_exists('str_contains')) {
function str_contains(string $haystack, string $needle): bool
......@@ -1039,11 +842,8 @@ function ParseXML($xml) {
/**
* Disable User Notification of Password Change Confirmation
*/
// Disable User Notification of Password Change Confirmation
add_filter( 'send_password_change_email', '__return_false' );
// Disables the block editor from managing widgets in the Gutenberg plugin.
add_filter( 'gutenberg_use_widgets_block_editor', '__return_false' );
// Disables the block editor from managing widgets.
......
<?php
// Our custom post type function
function create_posttype()
{
$labels = array(
'name' => _x('Notifications', 'Post Type General Name', 'commonwell-corp'),
'singular_name' => _x('Notification', 'Post Type Singular Name', 'commonwell-corp'),
'menu_name' => __('Notifications', 'commonwell-corp'),
'parent_item_colon' => __('Parent Notification', 'commonwell-corp'),
'all_items' => __('All Notifications', 'commonwell-corp'),
'view_item' => __('View Notification', 'commonwell-corp'),
'add_new_item' => __('Add New Notification', 'commonwell-corp'),
'add_new' => __('Add New', 'commonwell-corp'),
'edit_item' => __('Edit Notification', 'commonwell-corp'),
'update_item' => __('Update Notification', 'commonwell-corp'),
'search_items' => __('Search Notification', 'commonwell-corp'),
'not_found' => __('Not Found', 'commonwell-corp'),
'not_found_in_trash' => __('Not found in Trash', 'commonwell-corp'),
);
$args = array(
'label' => __('notifications', 'twentythirteen'),
'description' => __('notification news and reviews', 'twentythirteen'),
'labels' => $labels,
'supports' => array(
'title',
'editor',
'excerpt',
'author',
'thumbnail',
'comments',
'featured_image',
'set_featured_image',
'use_featured_image',
'revisions',
'custom-fields',
),
'taxonomies' => array('genres'),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'post',
);
register_post_type('notifications', $args);
}
add_action('init', 'create_posttype');
\ No newline at end of file
......@@ -174,3 +174,40 @@ function clean_custom_moblie_menus()
}
echo $menu_list;
}
function register_widgets()
{
register_sidebar(array(
'name' => 'Footer Sidebar 1',
'id' => 'footer-sidebar-1',
'description' => 'Appears in the footer area',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
));
register_sidebar(array(
'name' => 'Footer Sidebar 2',
'id' => 'footer-sidebar-2',
'description' => 'Appears in the footer area',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
));
register_sidebar(array(
'name' => 'Footer Sidebar 3',
'id' => 'footer-sidebar-3',
'description' => 'Appears in the footer area',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
));
}
add_action('widgets_init', 'register_widgets');
......