Alex Howes

Forum Replies Created

Viewing 15 posts - 61 through 75 (of 131 total)
  • Author
    Posts
  • in reply to: GD Listings by ID #430657

    Alex Howes
    Expired Member
    Post count: 175

    Thanks Dirk
    I’ve now added the following code

    
    
    wp_set_post_tags($value,"$value",false);
    echo do_shortcode('[gd_listings post_type=gd_cv layout=1, tags="$value"]');

    where $value is the id of the listing I want to show. It’s showing all listings of the type gd_cv so I think the GD tag filter isn’t working.

    in reply to: GD Listings by ID #430649

    Alex Howes
    Expired Member
    Post count: 175

    Hi Kiran,

    I need to do it programmatically as part of a snippet. I’ve got a job CPT, and I’ve written some code that records the job id if a worker applies to that job. As the final part of this I want to list the jobs that a worker has applied to in their profile. My plan was just to do an “echo do_shortcode[gd_listings]” and specify the listing ID, but since this isn’t possible I’ll have to add the tag programmatically and specify it that way.

    Is there a way to add a tag programmatically?

    Thanks 🙂
    Alex

    in reply to: GD Listings by ID #430645

    Alex Howes
    Expired Member
    Post count: 175

    Hello

    Thanks, I’ll do that. Is there a way to add a unique tag programmatically? I tried geodir_save_post_meta($value,’post_tags’,$value) but it doesn’t work.

    in reply to: GD Listings by ID #430546

    Alex Howes
    Expired Member
    Post count: 175

    Cool, thanks drashida, that seems like a good way to make it work 🙂

    Do you know if there’s a way to add a unique tag programmatically?

    in reply to: Geodirectory linked listings #430525

    Alex Howes
    Expired Member
    Post count: 175

    Thanks Paolo for pointing out the JavaScript suggesting and posting that link. I’ve written some code and put it in the footer script code, and it’s working 🙂 In case anyone else wants to do this my code is:

    
    
    <script type="text/javascript">
    
    var submitjobForm = document.forms["propertyform"];
    
    if (submitjobForm) {
    
       submitjobForm.addEventListener('submit',
       function(event){
    
           var x = document.getElementById("geodir_link_cpt_business");
            
           if (x) {
        	   if (x.value == "" || x.value == "No Business") {
                   alert("Please select your farm");
                   event.preventDefault();
               }
            }
        }, 
    true);
    }
    
    </script>
    in reply to: Geodirectory linked listings #430524

    Alex Howes
    Expired Member
    Post count: 175

    Thanks, I think my snippet wasn’t being called because the user claiming the listing wasn’t verifying by email, I was just approving the claim in the back end.

    If anyone else is interested in doing this I’ve posted my code below.

    
    
    add_action('geodir_claim_request_status_change', 'change_user_role_when_claim_farm', 10, 3);
    
    function change_user_role_when_claim_farm( $claim_id, $new_status, $old_status ) {  
      	$claim_info = geodir_claim_get_info( $claim_id );
      	
      	if ($claim_info) {	  
      		$post_id = (int)$claim_info->list_id;
    	    $claimed_post_type = get_post_type($post_id);
    	  	$author_id = (int)$claim_info->user_id;
    	    $new_owner = get_userdata($author_id);	 
    	  	$new_owner_roles = $new_owner->roles;
      
        	if ($claimed_post_type == 'gd_farm') {	 
    		  
    			if ($new_status == 1) {
    			  
    	  			if (in_array('employer', $new_owner_roles)){
    				  
    	  				$new_owner->set_role( 'employer_has_farm' );
    				}
    			}
    		}
    	}
    }
    in reply to: GD Listings by ID #430514

    Alex Howes
    Expired Member
    Post count: 175

    Thanks, that’d be helpful 🙂

    in reply to: Character limit on custom field text and textarea #430513

    Alex Howes
    Expired Member
    Post count: 175

    Ok, thanks 🙂

    in reply to: Geodirectory linked listings #430330

    Alex Howes
    Expired Member
    Post count: 175

    Thanks, that’d be helpful

    in reply to: GD function to change post details php #430329

    Alex Howes
    Expired Member
    Post count: 175

    After some digging around I think geodir_save_post_meta is what I’m looking for.

    in reply to: Character limit on custom field text and textarea #430328

    Alex Howes
    Expired Member
    Post count: 175

    Hi Kor,

    Thanks for your quick reply! I don’t want to set a character limit, I just want to know if there is one (i.e. if GD has set one).

    in reply to: Geodirectory linked listings #430242

    Alex Howes
    Expired Member
    Post count: 175

    Thanks Paolo, I’ll take a look at that.

    I’m currently also writing a snippet to change user role when they claim a listing and admin approves it. I’m hooking to the action geodir_claim_request_status_change, but currently the function isn’t even being called.

    Am I correct in thinking that geodir_claim_request_status_change is called when a) a user claims a listing, b) admin approves the listing claim, and c) if a user deletes their listing claim, or is this incorrect?

    in reply to: Geodirectory linked listings #430239

    Alex Howes
    Expired Member
    Post count: 175

    Just to be clear, I’ve attached a screenshot and circled the field I would like to make required. Since it’s possible to make the other add listing form fields required, is it possible to make this one too? If it’s not simple, would you be able to point me in the right direction- the relevant action or filter I could use to write a snippet to do this?

    Thanks 🙂

    in reply to: Geodirectory linked listings #430220

    Alex Howes
    Expired Member
    Post count: 175

    Is there a way to force users to link a CPT on the add listing form (if the CPT is linked)? I.e. to make the “Link CPT” field non-optional?

    in reply to: Geodirectory linked listings #430219

    Alex Howes
    Expired Member
    Post count: 175

    Ah ok, the two CPTs are linked in geodirectory. I was wondering because I understand the most common use of linked listings are “events” and “venues”- it might seem odd to have a venue without an event linked to it.

    However, if this is not possible, I think what I can do is change the user’s role when they submit a farm listing, or when they claim a farm. I can do the former, but I’m not sure how to change the role when they claim a farm (when the claim is approved). Do you know if there’s a GD action or filter that would let me hook into this?

    Thanks 🙂

Viewing 15 posts - 61 through 75 (of 131 total)
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount