Changing values in "Job Open For" dropdown

I'm trying to change the values in 'Job open for" dropdown when creating a new Job.

Where do I do that? The current values don't fit our needs.

Thanks.

  • Adam Czajczyk

    Hey!

    I hope everything's going great for you. Thanks for your question.

    Right now these values are defined in plugin code and you can't change it from settings panel. If you feel comfortable with editing code you may want to try this solution:

    https://premium.wpmudev.org/forums/topic/how-do-i-change-the-number-of-days-jobs-are-open-for-in-jobs-experts-plugin#post-765054

    Please remember that such a change will break down on plugin update so it's a temporary solution. I can see how handy such feature could be so I flagged this as a feature request. Hopefully some other members will also support this idea.

    If you have any further questions please ask them here, in this thread.

    Hope that helped.
    Cheers,
    Adam

  • Adam Czajczyk

    Hello,

    I'm sorry for the delay, I hope you're doing great today!

    I've checked it on my test install and I've got a working solution for you. It looks like that line in /app/models/je-settings-model.php works only at the moment of plugin installation. I'd let stay those new values there but in order to make it work you have to make one change in the database.

    Please open your phpMyAdmin (I suppose you should have access to it from your hosting account admin panel), select database with your WordPress install. If you're not sure which one is it, open wp-config.php file (it's in the root directory of your WP install) and look for line that says "define('DB_NAME',....)".

    Now select "wp_options" table (note: prefix might be different if you've changed it in wp-config.php) and go to the "Search" tab (top of the screen).

    In the text field in the same row as "option_name" label type "jobs_experts_settings" and run search. The search should return one result so click on "Edit". In the textarea change this:

    "open_for_days";s:9:"3,7,14,21"

    to something like this

    "open_for_days";s:9:"2,8,10,11"

    Of course use the numbers of your choice :slight_smile: I've attached some images to assist you.

    Be sure not to alter the value of the entire textarea in any other way, including additional spaces or other characters - it could stop plugin from working.

    It would also be good to use the same number of days in the database as used in the /app/models/je-settings-model.php file just in case you'd want to remove and the re-install (from file however) plugin.

    Also, please remember that changes like this are generally not recommended and probably will be lost at plugin update.

    I hope that helped.
    Cheers,
    Adam

  • billc108

    Excellent. I had looked, but didn't find that in my db.

    Important hint for anyone else who may read this and try changing their values: the "s:9" portion of that, just before the values which are in the dropdown, is a character count of the values ("3,7,14,21"). So if you need to change to some list of values which is NOT 9 characters long, you'll need to change the "s" value too.

    For example, if you're changing to "30,60,90,180,365" the character count is 16 so your resulting entry would look like

    "open_for_days";s:16:"30,60,90,180,365"

    If you don't change the "s" value, things are definitely going to blow up on you! (This is what's referred to as serialization of data)

  • Adam Czajczyk

    Hello again!

    I understand that the issue is resolved now? Great to hear that.
    Also thank you very much for your great remark on character count! That's an important information as the option value is stored as the serialized array (http://php.net/manual/en/function.serialize.php). Generally we should never play directly with serialized data unless there's no alternative. I should have mention that, so thanks again!

    Cheers,
    Adam

  • Adam Czajczyk

    Hey Bill, hey Zeke!

    I hope you're both well today!

    Bill, I hope that the solution worked for you so I can consider this thread resolved. If you have any further questions please don't hesitate to ask, I'll be glad to help.

    Zeke, I'm unable to give you any ETA on that but if Hoang mentioned such possibility it means that developers are considering including it in one of future updates. The best way to be notified about it would be to keep the plugin updated and also keep an eye on the thread that you mentioned and the "Changelog" on the Jobs & Experts plugin's page.

    Cheers,
    Adam

  • Zeke

    Adam, I made your recommended changes directly to the DB as described. This method appears to work as expected and resets the 'Job Open For' on the front end as well. Obviously not the preferred method however...

    Can you also describe how to change 'job open for' to also accept "Open Until Filled" and "Pending" and prevent the listing from expiring for Open Until Filled , and for Pending show the job as Pending instead of expired...? (This was in that earlier thread request, but if there is a manual way to do it now...)

  • Adam Czajczyk

    Hey Zeke,

    I hope you're well today.

    As it comes to your another thread, I tried to replicate the issue but I wasn't able to. When I change the "Job Open For" value for already expired job, it becomes open again. There's only one important thing to remember though: the "open for" period must be extended beyond current date and also you may need to extend the "Completion date".

    As for your "Open Until Filled" question I've got a quick-and-dirty solution for you, but please remember that it's only a temporary workaround. Generally, I do not recommend changing the plugin's code nor messing directly with the database :slight_smile:

    To keep a particular job open "forever" (until manually closed or - in other words - without end date) first you need to add another "Job open for" value - preferably the value that you don't intend to use ever. I tried this with a "0" days but for some reason that I wasn't able to discover it doesn't work. So I tried with "1" day and it works which you have to remember that this value will be "out of use" as a "real" one. You won't be able to post a job that's really open for only 1 day!

    1) Add a new "Job open for" value to database and /app/models/je-settings-model.php file as described earlier in this thread (please read through all posts)

    2) open this file; /app/models/je-job-model.php
    3) around line 167 you'll spot a public function named "get_due_day()"
    4) exchange the code from the line 175 until the end of the function with this:

    if ($this->open_for > 1) {
    				$expire_date = strtotime('+ ' . $this->open_for . ' days', strtotime($created_date));
    
    				return $this->days_hours($expire_date);
    			}
    			else {
    				return __('Open Until Filled', je()->domain);
    			}
            }

    Save and upload to the server and you should be done. You may want to add a translation for "Open Until Filled" string also, but it's up to you :slight_smile:

    Of course the change will be lost after any plugin update!

    As for "Pending" job I believe that there's no that simple workaround, so perhaps you could post a new topic on our "Features and feedback" forum? Hopefully other members would upvote such feature and it would be added to one of the future releases.

    I hope that helped.
    Cheers,
    Adam

    2) line 175

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.