• Resolved cordiace_dev

    (@rahul2019)


    Hi, i’m following the doc (here: https://wpjobmanager.com/customization-snippets/#prefillcomplogo) to pre-fill the company logo on the Post a Job Page. But it doesn’t seems to be working for me. I have also found a similar thread but no hope at all (https://www.ads-software.com/support/topic/post-a-job-pre-populate-company-details/).

    When i print_r the fields array in the submit_job_form_fields custom function, i can see the value i set there,

    [company_logo] => Array
                    (
                        [label] => Logo
                        [type] => file
                        [required] => 
                        [placeholder] => 
                        [priority] => 6
                        [ajax] => 1
                        [multiple] => 
                        [allowed_mime_types] => Array
                            (
                                [jpg] => image/jpeg
                                [jpeg] => image/jpeg
                                [gif] => image/gif
                                [png] => image/png
                            )
    
                        [value] => https://lusciouslawn.com/wp-content/uploads/ultimatemember/68/profile_photo-190x190.jpg?1569909184
                    )

    But the problem is that no image is getting displayed on the preview section. Also for a user already posted a job, i noticed that, there is a hidden field with the attachment id of the logo being added to the form. But here, the hidden field is missing too.

    • This topic was modified 5 years, 5 months ago by cordiace_dev.
    • This topic was modified 5 years, 5 months ago by cordiace_dev.
    • This topic was modified 5 years, 5 months ago by cordiace_dev.
Viewing 15 replies - 1 through 15 (of 22 total)
  • @rahul2019
    why don′t you use just the snippet which is provided by WPJM?

    add_filter('submit_job_form_fields', 'dm_prefill_company_logo');
    function dm_prefill_company_logo( $fields ) {
      $fields['company']['company_logo']['value'] = 'full_url_to_the_logo';
      return $fields;
    }
    Thread Starter cordiace_dev

    (@rahul2019)

    I have already tried that but it isn’t working though.

    Strange, on my test system this works

    Thread Starter cordiace_dev

    (@rahul2019)

    Yeah, this is kind of a strange issue. I have assigned the value through the filter and can see it while vardump-ing. But when it reaches the template, the value field is empty. I’m no going through the plug-in core to find if i can get something.

    Maybe its your theme?
    Tried it with a default one?

    Plugin Contributor Richard Archambault

    (@richardmtl)

    Hi! It does sound like there’s something unique to your setup that’s causing the problem. Definitely try with a default theme to rule out a theme issue.

    Thread Starter cordiace_dev

    (@rahul2019)

    Ok lemme try that out. and i’ll getback.

    Thread Starter cordiace_dev

    (@rahul2019)

    I’ve tried it out but the issue is till there.
    https://drive.google.com/file/d/1uR6YffJnxy-2ithF-OFpG0ObbT4LA_v6/view

    The code snippet i’ve used,

    add_filter('submit_job_form_fields', 'custom_prefill_company_logo');
    function custom_prefill_company_logo( $fields ) {
        $fields['company']['company_logo']['value'] = get_avatar_url(get_current_user_id());
        echo "<pre>", print_r($fields) , "</pre>";
        return $fields;
    }
    Plugin Contributor Richard Archambault

    (@richardmtl)

    Hi!

    I think the problem in this case is that you are logged in to an account that has previously submitted a job listing, possibly with no logo. In my case, if I try the snippet while logged in to my regular account, the last logo I uploaded is the one that is listed. However, if I try in an incognito window, I see the default logo I included in the snippet. So, could you try in an incognito window, not logged in, or logged in with a new account, to see what happens?

    Thread Starter cordiace_dev

    (@rahul2019)

    Hi,

    It seems like nothing is going in my way. I’ve tried creating a new account in a private window and once registered, accessed the page but still the logo field is empty. What could be the problem here ?

    Thread Starter cordiace_dev

    (@rahul2019)

    I’ve tried it with default theme as well. But no hope there as well. When trying to post a job without an account, the default image is shown, but not with a logged in account.

    Plugin Contributor Richard Archambault

    (@richardmtl)

    Ok, let’s try this: replace get_avatar_url(get_current_user_id()) with a straight URL, and make sure that works as expected. Once we confirm that this works for you, we’ll try to figure out why your code doesn’t.

    Thread Starter cordiace_dev

    (@rahul2019)

    Same thing happens. this is the code i’ve tried,

    add_filter('submit_job_form_fields', 'custom_prefill_company_logo');
    function custom_prefill_company_logo( $fields ) {
        $fields['company']['company_logo']['value'] = 'https://lusciouslawn.com/wp-content/uploads/job-manager-uploads/company_logo/2019/09/male-profile-avatar-with-brown-hair-vector-12055105.jpg';
        echo "<pre>", print_r($fields) , "</pre>";
        return $fields;
    }

    This is what i’m getting when vardump-ing – https://ibb.co/QQFDMhP

    The image is filled when trying without an account.
    But with an account it stays the same.

    Plugin Contributor Richard Archambault

    (@richardmtl)

    Hi!

    Ok, I was able to reproduce it! Here is what I did:

    1) I registered a new user on my test site.
    2) I logged in with that new user, who had never before submitted a job.
    3) I went to the job submission page.
    4) I saw that the log was *not* pre-filled.

    Progress! I’ll take this to the developer and see what he has to say.

    Thread Starter cordiace_dev

    (@rahul2019)

    Okay, looking forward to it.

Viewing 15 replies - 1 through 15 (of 22 total)
  • The topic ‘Company Logo Pre-Fill is not working.’ is closed to new replies.