Hook: Click the Update Button

This topic contains 11 replies, has 4 voices, and was last updated by  Alex Rollin 6 years, 3 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #420129

    TomFox
    Expired Member
    Post count: 41

    Hello,

    maybe somebody can help me.

    I want to edit the post title after someone clicks the Update Button on the preview Page.

    Unfortunately I can’t find a suitable hook.

    Or is there a better way to adjust the title?

    Best Regards

    Tom

    #420157

    Guust
    Moderator
    Post count: 29970

    Can you explain a bit more, possibly with an example?
    What changes do you want to make to the Post Title as entered by the user? And why?

    Thanks

    #420232

    TomFox
    Expired Member
    Post count: 41

    In my directory the user can enter first name, last name and Job Qualifications and so on.

    Now it often happens that the user enters different variants of his Title and Qualifications.

    Now I want to set the field .post_title to hidden and compile it from the other (Select) fields.

    This ensures that a certain syntax is adhered to.
    We have a duty to observe certain legal notations.

    Greetings

    #420306

    Alex Rollin
    Moderator
    Post count: 27815

    Hello,

    this is not a functionality of GD, but is something that is regularly accomplished for WordPress with 3rd party plugins like this one: https://wordpress.org/plugins/auto-post-title/ , which plugin would likely need customization from a developer to make use of GD custom fields.

    I will flag your question for the developers in case they have an idea for you about altering the title after submit.

    #420324

    TomFox
    Expired Member
    Post count: 41

    Thank you, the problem of legal requirements could have some.
    Is there no hook after preview or save the Post?
    I also wanted to check the number of tags and so on.

    #420344

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hi Tom,

    Things will be changing in GDv2 but for now i think the hook u want is

    $request_info = apply_filters('geodir_action_get_request_info', $request_info);

    This filters the save listing request info.

    Thanks,

    Stiofan

    #420365

    TomFox
    Expired Member
    Post count: 41

    Hello Stiofan,
    i do that now:

    
    
    
    add_action('save_post','save_post_gd_place');
    function save_post_gd_place($post_id)
    {
      	//echo 'listing_type:' . $_REQUEST['listing_type'];	
    	if(isset($_REQUEST['listing_type']) && 'gd_place' == esc_attr($_REQUEST['listing_type']))
        {
    		$request_info = apply_filters('geodir_action_get_request_info', $request_info);
    		print_r($request_info);
    		echo 'xxx';
        }
    }

    But it doesn’t seem right.
    Can you give me an example?

    #420411

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Not tested but something like below:

    
    
    add_filter('geodir_action_get_request_info','_my_edit_save_request');
    function _my_edit_save_request($request_info){
    
        //print_r($request_info);exit; // for testing
    
        // anything changed here will change the post info
        $request_info['post_title' = 'zzzzz';
    
        return $request_info;
    }
    #420423

    TomFox
    Expired Member
    Post count: 41

    Great!
    Thanks, you’ve helped me a lot with that.

    #420470

    Alex Rollin
    Moderator
    Post count: 27815
    This reply has been marked as private.
    #420487

    TomFox
    Expired Member
    Post count: 41

    I liked to get a good rating.

    #420549

    Alex Rollin
    Moderator
    Post count: 27815
    This reply has been marked as private.
Viewing 12 posts - 1 through 12 (of 12 total)

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

Open Support Ticket