Osclass Support Forums

Osclass theme support => CareerJob Osclass Jobs Theme => Topic started by: developGr on March 03, 2021, 03:37:28 PM

Title: osclass problem publishing ads
Post by: developGr on March 03, 2021, 03:37:28 PM
I found a bug that its making the users (company that its posting a 2nd,3rd.. classified) and the admin problematic cause that ad box information are getting mixed text. I will explain more specific in the line below:

In your demo website https://careerjob.mb-themes.com/ i make an account so i can test if you are facing the same problem. And I confirm that you are.

So, I clicked the "Add listing" button https://careerjob.mb-themes.com/item/new and I published just the correct a classified.The demo classified that I published is this one. Until here everything works just perfect. Now here is the problem: After the ad its published when you click again "Add listing" button https://careerjob.mb-themes.com/item/new to add a 2nd classified all the selections and the text boxes that are filled with the text for the previous classified are showing here again (image attached below). The image that its attached its not the 1st add but the 2nd one after i select just the "Add listing" button. After this problem come if you hit "Add listing" button again with out publishing it then the fields and text boxes are getting blank. This problem its coming on and on just after you select "Add listing" after an add its published!

The users do not know this problem and when they publish a 2nd article just over the other the info of the new add its getting mixed with the info of the previous one making the user and the admin not knowing what is happening.

Title: Re: osclass problem publishing ads
Post by: MB Themes on March 03, 2021, 03:50:00 PM
Data in form are preserved in case of failed listing publish.
Once listing is published, session should be cleared by osclass.
Code: [Select]
function careerjob_post_preserve() {
$post = Params::getParamsAsArray();

foreach($post as $n => $v) {
Session::newInstance()->_setForm($n, $v);

osc_add_hook('pre_item_post', 'careerjob_post_preserve');

function careerjob_post_drop() {

osc_add_hook('posted_item', 'careerjob_post_drop');

You can remove this line in functions.php to not keep these data in session:
Code: [Select]
osc_add_hook('pre_item_post', 'careerjob_post_preserve');