• Hi,

    Can you possibly provide a list of variables that is available in the $_aRoutineArguments array from within doAction()?

    I tried to dump the array to screen, but I’m afraid I’m not getting any output.

    I’m particularly interested in any variables that are category related (category ID or at least category name).

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author miunosoft

    (@miunosoft)

    Hi,

    The second parameter passed to doAction() is a routine object which can return action arguments.

    
    public function doAction( $sExitCode, $oRoutine ) {
        $_aRoutineMeta        = $oRoutine->getMeta();
    

    Here $_aRoutineMeta contains the stored settings for the action. The category IDs should be stored in there with the key named auto_post_term_ids. If you dump the contents of $_aRoutineMeta, you should see something like the following.

    
        [auto_post_term_ids] => Array
            (
                [category] => Array
                    (
                        [1] => 1
                    )
    
            )
        ...
    

    You see category and it is a taxonomy slug. You should be able to retrieve its category ID from the slug. And it is an array holding its terms and the array key-value represents a term id and the state of being enabled or not (1 is checked, 0 is not).

    Thread Starter yosmc

    (@yosmc)

    Hi,

    First of all I appreciate the fast response, that’s fantastic.

    Secondly: When I insert a print_r() – or any other type of echo – in that function I get no output on screen. When I call http://www.mysite.com/?task_scheduler_checking_actions=1 (which is how I use the plugin) all I ever see is my main page.

    Anyway, with your info, I got it right in no time at all. For anyone else looking at this, the actual variable would be:
    $_aRoutineArguments[ ‘auto_post_term_ids’ ][ ‘category’ ][1]

    Thanks again!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Category variable available from within doAction () ?’ is closed to new replies.