Support » Plugin: WP-MQTT » Code Suggestion

  • woutervddn

    (@woutervddn)


    I wanted to suggest a code edit, but I’m not sure if the source has a public repo.

    In either case, I noticed that event_pageview() has no args passed to it. This is unfortunate because I think most people, me included, want to know which page has been viewed.

    I suggest editing the code to get access to the wp_query:

    public function event_pageview(){
        global $wp_query;
        $this->assemble_mqtt_message( 'event_pageview', (array) $wp_query );
    }

    Another suggestion is to also use replace_placeholders in the topic. This way we can have a different subtopic depending on which page is actually viewed. This is easily achieved by adding: topic = $this->replace_placeholders( $topic, $args ); in the assemble_mqtt_message() function.

    • This topic was modified 1 year ago by woutervddn. Reason: extra suggestion
Viewing 1 replies (of 1 total)
  • Plugin Author Roy Tanck

    (@roytanck)

    Hi @woutervddn. This plugin is not currently being actively developed. I’ve made the code available on Github (https://github.com/roytanck/WP-MQTT) and am happy to look at PRs.

    I’m no longer using MQTT in any projects, and have taken my broker offline a while ago. This makes it harder to test against new WordPress versions. Releasing a new version on wordpress.org requires at least some testing to make sure it works with whatever is the current version of WP at that time.

    Ideally, someone with a more active interest could take over development.

Viewing 1 replies (of 1 total)
  • The topic ‘Code Suggestion’ is closed to new replies.