Forum Replies Created

Viewing 15 replies - 1 through 15 (of 28 total)
  • Thread Starter hursey013

    (@hursey013)

    Just an update – this issue is actually still occuring and I’m still trying to get it figured out. Sometimes it has the right URL, sometimes it doesn’t. If anyone else is using job alerts with a multisite set up, please let me know if you are able to reproduce the issue!

    Thread Starter hursey013

    (@hursey013)

    Hmm, yes thank you for pointing that out. I would like the old posts removed without manually pressing the rebuild index button. Would using something like this:

    if (!wp_next_scheduled('relevanssi_build_index')) {
        wp_schedule_event( time(), 'daily', 'relevanssi_build_index' );
    }

    automatically remove the old posts?

    Thread Starter hursey013

    (@hursey013)

    Awesome, that did the trick, here’s what I used:

    add_filter('relevanssi_do_not_index', 'index_the_recent', 11, 2);
    function index_the_recent($post_ok, $doc) {
    	$date = get_the_time('Y-m-d H:i:s', $doc);
    	$date_filter = date('Y-m-d H:i:s', strtotime('-30 days'));
        if ($date < $date_filter) $post_ok = true;
        return $post_ok;
    }
    Thread Starter hursey013

    (@hursey013)

    I think I found a couple more:

    Line 80:
    add_filter( 'posts_where', array( $this, 'filter_ ' . $alert->alert_frequency ) );

    Line 102:
    remove_filter( 'posts_where', array( $this, 'filter_ ' . $alert->alert_frequency ) );

    hursey013

    (@hursey013)

    Just checked out my error logs and for the snippet you provided earlier:

    add_filter('relevanssi_post_ok', 'ok_the_expired', 11);
    function ok_the_expired($post_ok, $doc) {
        $status = relevanssi_get_post_status($doc);
        if ('expired' == $status) $post_ok = true;
        return $post_ok;
    }

    I’m getting the following error, which could explain why it wasn’t working:

    [09-Feb-2014 05:56:37 UTC] PHP Warning: Missing argument 2 for ok_the_expired() in /public_html/wordpress/wp-content/themes/jobify-child/functions.php on line 127

    Any suggestions on how to fix that? Thank you!

    Thread Starter hursey013

    (@hursey013)

    Is it based on the date the job was posted or the modified date of the job page? If it’s modified date, then that would explain things, because with my setup all jobs postings are refreshed/updated daily. If that is the case, how can I change it to use the publish date rather than the modify date? Sorry to be such a pain, I swear I’ll get out of your hair once I get this thing working!

    Thread Starter hursey013

    (@hursey013)

    Yeah… adjusting the settings of the domain mapping plugin did the trick. I deselected the “Redirect administration pages to site’s original domain (remote login disabled if this redirect is disabled)” setting and it fixed the URLs in the email. For others reference, see here for the domain mapping settings I used: https://screencast.com/t/pPccNbptkK

    Thanks for your help Mike.

    hursey013

    (@hursey013)

    Thank you for the pointer – I don’t think I fully thought out the code I posted, yours makes much more sense and gets things working right. I’ll keep trying the filter method to see if I can get it to work, still don’t understand why it doesn’t. Thanks a bunch, keep up the good work!

    Thread Starter hursey013

    (@hursey013)

    I think I’m finally catching on to what you are getting at – I’ve modified some of the settings in that domain mapping plugin, to see if that may be the issue: https://screencast.com/t/gVP4VWP1p6K I previously had “Redirect administration pages to site’s original domain” checked.

    Is there a way to force send out the job alert email? I tried changing the publish date of the alert page in phpmyadmin but that didnt seem to trick it into sending it again.

    Thread Starter hursey013

    (@hursey013)

    I’m using this: https://www.ads-software.com/plugins/wordpress-mu-domain-mapping/installation/ – is that what you are referring to?

    Thread Starter hursey013

    (@hursey013)

    Awesome, thank you, first WP site so I’m still catching on. There is one other reference that I need to update – the job-alerts URL at the bottom of the email. It’s within the format_email function of class-wp-job-manager-alerts-notifier.php:

    $replacements = array(
    			'{display_name}'    => $user->display_name,
    			'{alert_name}'      => $alert->post_title,
    			'{alert_expirey}'   => $alert_expirey,
    			'{alert_next_date}' => date_i18n( get_option( 'date_format' ), $next ),
    			'{alert_page_url}'  => get_blog_permalink( $alert->blog_id, get_page_by_path( get_option( 'job_manager_alerts_page_slug' ) )->ID ),
    			'{jobs}'            => $job_content
    		);

    Is it possible to override that with a filter hook as well? Here’s my best guess:

    add_filters( 'job_manager_alerts_template', 'multisite_job_manager_alerts_template', 10, 1 );
    	public function multisite_job_manager_alerts_template( $alert, $user, $jobs ) {
    
    		$replacements = array(
    			'{display_name}'    => $user->display_name,
    			'{alert_name}'      => $alert->post_title,
    			'{alert_expirey}'   => $alert_expirey,
    			'{alert_next_date}' => date_i18n( get_option( 'date_format' ), $next ),
    			'{alert_page_url}'  => get_blog_permalink( $alert->blog_id, get_page_by_path( get_option( 'job_manager_alerts_page_slug' ) )->ID ),
    			'{jobs}'            => $job_content
    		);	
    
    }
    Thread Starter hursey013

    (@hursey013)

    Yes when I’m in the admin section I get the same long URL with the primary site and the sub site in a directory. Somehow on the frontend it’s all magically fixed, but yeah that same logic doesn’t seem to be applied behind the scenes with the email. I did find a solution, wp-job-manger-template.php, I had to change this function to use get_blog_permalink:

    function get_the_job_permalink( $post = null ) {
    	$post = get_post( $post );
    	$link = get_blog_permalink( $post->blog_id, $post );
    
    	return apply_filters( 'the_job_permalink', $link, $post );
    }

    Is it possible to override this within functions.php or something to avoid it being overwritten – and do you see any potential issues with this?

    Very cool, thank you. I pasted the hook you suggested above, it looks like exactly what I need, but unfortunately it’s not working. The only way I can manage to get it to work is to change lib/common.php:

    if ('publish' != $status ) {
    		$post_ok = false;
    	}

    to

    if ('publish' != $status && 'expired' !=$status ) {
    		$post_ok = false;
    	}

    Seems like this is the same thing as the filter hook, any idea why it wouldn’t be working? Thanks again for the assistance.

    Thanks for the tip in this post, I have a custom post type that uses a custom status of “expired” that I want indexed, so I used:

    add_filter(‘relevanssi_valid_status’, ‘only_publish’);
    function only_publish($array) { return array(‘publish’,’expired’); }

    I do see that the correct number of posts are being indexed, however when I actually execute a search on the website none of the posts with the custom status “expired” are displaying. Do I need to modify the main WordPress search query too in order to get this to work?

    Thanks for the great plugin.

    Thread Starter hursey013

    (@hursey013)

    Yes, it’s a vanilla install.

    I have my multisite set up to have each website in a subdirectory, so the link does actually work, it just shows the primary sites URL with the subsite directory: https://screencast.com/t/I2vWIUEuh7G – the actual url should just be https://governmentjobsinarizona.com/blah-blah-blah – it’s displayed that way throughout Job Manager and the rest of the site, just this email that’s different.

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