Forum Replies Created

Viewing 15 replies - 1 through 15 (of 61 total)
  • Thread Starter Brandon Meyer

    (@indigetal)

    Okay, removing and re-installing the plugin worked! Thanks for looking into it and for the solid advice.

    Cheers,
    Brandon

    Thread Starter Brandon Meyer

    (@indigetal)

    Okay, I have resolved the issue by removing the custom logic that specifies directory-specific paths and instead leverage WordPress’s inherent template hierarchy functions in `includes/class-mas-wp-job-manager-company-template-loader.php’. I would like to propose this change be included in the next update of the “MAS Companies for WP Job Manager” plugin to align its template loading mechanism with standard WordPress practices. This change would enhance compatibility with Full Site Editing (FSE) themes and popular plugins like Blocksy, GreenShift, and Search & Filter Pro.Current Issue

    Currently, the plugin employs a custom template loading mechanism through the MAS_WPJMC_Template_Loader class. This approach specifies a very specific set of template file paths, including directory-specific paths, and defaults to the plugin’s own templates. This custom logic overrides the standard WordPress template hierarchy, which can cause compatibility issues.

    I suggest modifying the template loading logic to follow the standard WordPress template loading hierarchy. This involves using WordPress’s built-in locate_template function, which respects the theme’s template overrides and integrates seamlessly with other plugins.

    Below is the revised class-mas-wp-job-manager-company-template-loader.php file:

    <?php
    /**
    * Template Loader
    *
    */

    defined( 'ABSPATH' ) || exit;

    /**
    * Template loader class.
    */
    class MAS_WPJMC_Template_Loader {

    /**
    * Store the company page ID.
    *
    * @var integer
    */
    public static $companies_page_id = 0;

    /**
    * Hook in methods.
    */
    public static function init() {
    self::$companies_page_id = mas_wpjmc_get_page_id('companies');

    // Hook into template_include to load custom templates
    add_filter('template_include', array(__CLASS__, 'template_loader'));
    }

    /**
    * Load a template.
    *
    * Handles template usage so that we can use our own templates instead of the themes.
    *
    * @param string $template Template to load.
    * @return string
    */
    public static function template_loader($template) {
    if (is_singular('company')) {
    $new_template = locate_template(array('single-company.php'));

    if ($new_template) {
    $template = $new_template;
    }
    } elseif (is_post_type_archive('company') || is_page(self::$companies_page_id) || mas_wpjmc_is_company_taxonomy()) {
    $new_template = locate_template(array('archive-company.php'));

    if ($new_template) {
    $template = $new_template;
    }
    }

    return $template;
    }
    }

    add_action('init', array('MAS_WPJMC_Template_Loader', 'init'));

    By adhering to WordPress’s standard template loading hierarchy, the plugin will gain broad compatibility and integrate with Full Site Editing themes and plugins like Blocksy, GreenShift, and other plugins that rely on the standard template loading process.

    Thank you for your attention to this matter.

    Best Regards,
    Brandon

    Thread Starter Brandon Meyer

    (@indigetal)

    Okay, I have confirmed that overriding the PHP templates in a mas-wp-job-manager-company folder in the child theme works as expected. However, my larger goal is to determine the source of compatibility issues between the MAS Companies template loader and Blocksy’s Content Blocks, which typically work with standard WordPress template loaders.

    I have looked into this more after learning about the particular file path that is required and I have identified that the MAS_WPJMC_Template_Loader class in includes/class-mas-wp-job-manager-company-template-loader.php hooks into the template_include filter to implement custom logic via self::get_template_loader_files() and self::get_template_loader_default_file() in the template_loader() function to determine which files to search for in a specific order. This logic overrides the standard WordPress template hierarchy, effectively nullifying implementations like Blocksy’s Content Blocks that rely on the standard WordPress template loading mechanism.

    Here’s the relevant code snippet from the template_loader method beginning on line 46 in includes/class-mas-wp-job-manager-company-template-loader.php:

    public static function template_loader($template) {
    if (is_embed()) {
    return $template;
    }

    $default_file = self::get_template_loader_default_file();

    if ($default_file) {
    $search_files = self::get_template_loader_files($default_file);
    $template = locate_template($search_files);

    if (!$template) {
    $template = mas_wpjmc()->plugin_dir . 'templates/' . $default_file;
    }
    }

    return $template;
    }

    So the plugin constructs a very specific set of template file paths, including directory-specific paths, which may also present compatibility issues with Full Site Editing themes. Ideally, MAS Companies would follow the standard WordPress template loading mechanism to ensure broad compatibility.

    I have also consulted with Blocksy and can still reach out to them about how to potentially modify the get_template_loader_files() to include paths where Blocksy places its templates. However, a long-term solution would involve MAS Companies aligning more closely with the standard WordPress template loading practices.

    Thank you for your assistance in addressing this issue. Please let me know if additional information is needed.

    Thread Starter Brandon Meyer

    (@indigetal)

    Hi Abbas,

    I am simply attempting to override php template files the standard WordPress way via the child theme, or via Blocksy’s Content Blocks (which normally work with all page template files and CPT’s). I have successfully overridden the template files of WP Job Manager, including the single job template, the job archive template, the single resume template, and the resume archive template, but I am unable to override the MAS Companies plugin’s templates. As I mentioned, I asked Blocksy developers about it and they have said that there is something preventing standard template overrides from working on MAS Companies template files. The files that I am attempting to override are the single-company.php and archive-company.php files in the “templates” folder.

    Better Messages has an integration that is specific to WP Job Manager for instant messaging capability with email notfication alerts. There is also a shortcode available to add a message button to any page to contact the user_id from the environment, such as the author of the post. There is a free version for you to check out.

    Thread Starter Brandon Meyer

    (@indigetal)

    Okay, I began to suspect that this might be an incompatibility with another plugin, so I network deactivated LiteSpeed Cache, MalCare, Patchstack, Redis, WP Hide, and WP OPcache before attempting to update AIOS again. The update went through without an issue and I then re-activated the other plugins one at a time. However, I did not experience any issues when activating them.

    I will chock this up as a fluke, or at best some issue specifically with the update – possibly caused by one of those other plugins. I cannot say for sure, but everything is working fine!

    Thanks,
    Brandon

    Thread Starter Brandon Meyer

    (@indigetal)

    That’s great, but it’s also a very, very small list of direct integrations and I do not use any of them. Plugins or Themes with front end log-in forms that I do use include the GreenShift block library, the Blocksy theme, Fluent Forms, Fluent Support, Paid Memberships Pro, WP Ultimo, TutorLMS and the Skillate theme, Woocommerce, and WP Job Manager (and addons).

    It would be great to get integrations for all of those, but what I’m asking is for a way to implement the OTP field in any front end form by adding something like a shortcode to the page. Even if that is only included with the premium version, but know that the 2FA can be bypassed by logging into any front end form that does not trigger the OTP field.

    Thread Starter Brandon Meyer

    (@indigetal)

    That’s great! Note that a shortcode is just my assumption of a user-friendly solution, but I have found that the 2FA functionality does not work on front end log in forms of several plugins generated via shortcodes or in theme login modals. I wonder why it isn’t a standard to use the wordpress login hooks or whatever in third-party login shortcodes and modals but it isn’t at all!

    I understand that is in no way the fault of AIOS, but some sort of pop-in solution would go a long way to correcting the missing OTP field in those places. I’ll be on the look out!

    Thanks,
    Brandon

    • This reply was modified 2 years, 4 months ago by Brandon Meyer.
    Thread Starter Brandon Meyer

    (@indigetal)

    Aaah, that’s it – thank you so much!

    Just as an FYI, we can completely re-design archive layouts and override templates from the Gutenberg editor with a number of plugins in WordPress now. I am using the Blocksy theme’s content block (single template) to override the company pages, but all FSE theme’s have this ability. I then use GreenShift’s query block’s addon to pull in each element and redesign them in Gutenberg. I also use the Search & Filter plugin to add advanced search abilities. All using post type and meta fields.

    I appealed to WorkScout to update several of their plugins that are currently packaged with their theme so that they can work in any theme and I would say that Madras Themes should do the same. Regardless of whether or not users are semi-advanced like myself – the future of WordPress is less and less theme-oriented!

    Cheers,
    Brandon

    Thread Starter Brandon Meyer

    (@indigetal)

    I mixed up “Company Dashboard page” with “Company Listings Page” in my last post, but I’m sure you got my point. To be clear, the “Company Listings Page” is missing.

    • This reply was modified 2 years, 4 months ago by Brandon Meyer.
    Thread Starter Brandon Meyer

    (@indigetal)

    I might be misunderstanding what it is that you are trying to say, but the “Company Listings Page” setting is one of the options expected to be there in the Company settings page. So it’s not “replacing” the Company Dashboard Page setting, the Company Dashboard Page setting is simply missing.

    I do see what you mean in your screenshot by the “All Posts” appearing in the admin toolbar when visiting Companies > All Companies in the dashboard, but that is also not there – see screenshot here.

    I am now testing in a local dev site with the Twenty Twenty-Three theme activated and only WP Job Manager, MAS Companies for WP Job Manager, and MAS Company Reviews for WP Job Manager activated. Everything is up-to-date and I even imported some demo companies from my main site just to be sure.

    I don’t know why that is happening either, but it seems like the plugin is due for an update in any case.

    Thank You,
    Brandon

    Thread Starter Brandon Meyer

    (@indigetal)

    I checked the html and the code is not in there at all.

    https://drive.google.com/file/d/1u2ONl2dwscLV4o8_Rqqng2_1LJwUPDpT/view?usp=sharing

    I also installed “WP Job Manager,” “MAS Companies For WP Job Manager,” and “MAS Company Reviews For WP Job Manager” on a site in a local dev environment that does not have, nor ever had WorkScout installed and it is not there. In fact, I’m starting to think that WorkScout didn’t break something – they fixed it – but the fix is implemented in their theme.

    I am trying to create a default company listing page for all companies. I do not see how redirecting company list pages in Companies > All companies > View posts achieves that.

    Thank You,
    Brandon

    Thread Starter Brandon Meyer

    (@indigetal)

    I have a license for the Front theme if that helps with prioritizing this, but my premium support has actually expired.

    Thread Starter Brandon Meyer

    (@indigetal)

    I disabled all plugins today except “MAS Companies For WP Job Manager,” “MAS Company Reviews For WP Job Manager,” “WP Job Manager,” and “WooCommerce.” I also activated the “Twenty Twenty-Three” theme. I still did not get back the “Company Listings Page” drop down option in the settings!

    I’m starting to suspect that the WorkScout Theme did something to mess with this. I previously had it activated but decided against it. I had the setting before and even confirmed with a fresh install of WorkScout in a local dev environment that the setting is there. But for some reason it’s just not in my live environment that previously used WorkScout but is not now…

    I already tried to re-download the MAS plugins from the WordPress repository and deleted WorkScout-related database tables, but that didn’t fix it. It’s amazing how stingy those developers are with their Theme, core plugin and WorkScout Freelancer plugin but not only do they use MadrasThemes MAS plugins, I suspect they are doing something to mess with it (though I’m stumped as to how they’re doing it).

    Thread Starter Brandon Meyer

    (@indigetal)

    Fantastic! Thank you so much Mr. Nakib!

Viewing 15 replies - 1 through 15 (of 61 total)