function call geodir_cf_email

This topic contains 3 replies, has 3 voices, and was last updated by  Dirk 6 years ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #430309

    Dirk
    Full Member
    Post count: 390

    Hi

    I like to have the link with the form popup done by a function call. When I checked the function geodir_cf_email the $cf parameter (array) can also be a string as it will look for an individual field at the beginning:

    
    
        // check we have the post value
        if(is_int($p)){$post = geodir_get_post_info($p);}
        else{ global $post;}
    
        if(!is_array($cf) && $cf!=''){
        	$cf = geodir_get_field_infoby('htmlvar_name', $cf, $post->post_type);
            if(!$cf){return NULL;}
        }
    
        $html_var = $cf['htmlvar_name'];

    the geodir_get_field_infoby is returning a StdClass so the $html_var = $cf[‘htmlvar_name’]; will not work.

    An explicit cast is needed here:
    $cf = (array) geodir_get_field_infoby(‘htmlvar_name’, $cf, $post->post_type);

    With this change the function can also be called with just a string like ‘geodir_email’ and it will give you the html code for this link.

    Could you please consider to change this in the repo?

    Or do I miss something more elegant to get to my goal?

    Thanks,
    Dirk

    #430501

    Alex Rollin
    Moderator
    Post count: 27815

    Hi!
    Sorry for the delayed response, we have flagged your topic for the developers to take a look.

    #430858

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    The function is really only used there so i changed the return from the function.

    Thanks,

    Stiofan

    #430887

    Dirk
    Full Member
    Post count: 390

    Even better.

    Thanks,
    Dirk

Viewing 4 posts - 1 through 4 (of 4 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket