We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4385
    • 372 Posts
    This is an auto-generated topic for MODxTweeter 1.0-beta1 by bwente.

    Brief Description:

    This is plugin that will update your twitter status when you publish. To get it to work you need to create an application at dev.twitter.com and use the keys generated there. I would create an application name with the name of your website and link back to as well. The placation type is "browser" and the access is "Read & Write".

    It also requires two template variables and one chunk. One TV (tweet) is used to turn on the tweet for that resource/document, the other TV (twitterStatus) is the message that you are posting. The chunk (tweetChunk) is used to format the twitterStatus TV.

    The default chunk is "[[*pagetitle]] [[gus]] [[*tags]]", gus is a snippet that creates a link using goo.gl as a url shortener. If you do not have gus installed your status update will fail unless you change the chunk.

    I have my blog posts setup not to publish on save, I then use right-click to publish. That will then send the status to twitter.
      DropboxUploader -- Upload files to a Dropbox account.
      DIG -- Dynamic Image Generator
      gus -- Google URL Shortener
      makeQR -- Uses google chart api to make QR codes.
      MODxTweeter -- Update your twitter status on publish.
      • 4385
      • 372 Posts
      This does not count characters. If your message (page title + url + tags > 140) it will not update.

      If anyone has any ideas, please share. On my local system I did make a custom field that validated char count, but that was it.
        DropboxUploader -- Upload files to a Dropbox account.
        DIG -- Dynamic Image Generator
        gus -- Google URL Shortener
        makeQR -- Uses google chart api to make QR codes.
        MODxTweeter -- Update your twitter status on publish.
        • 436 ☆ A M B ☆
        • 265 Posts
        I can’t seem to get this working - do you know if Twitter have updated their OAuth system or APIs in general which might have caused this to break?
          MODX Ambassador for Thailand. Managing Director at Monogon, a web design and development studio based in Bangkok, Thailand. - Follow me on Twitter.
          • 4385
          • 372 Posts
          I am not using this on a live site, so I have seen any problems. I checked out my local version and it is still working. I had to go to https://dev.twitter.com and create a new app to get new keys and codes. Also don’t forget to set up read and write.

            DropboxUploader -- Upload files to a Dropbox account.
            DIG -- Dynamic Image Generator
            gus -- Google URL Shortener
            makeQR -- Uses google chart api to make QR codes.
            MODxTweeter -- Update your twitter status on publish.
            • 436 ☆ A M B ☆
            • 265 Posts
            hmm yes, that seems pretty much the same as what I’ve got:



            And then I have copy-pasted those keys into the plugin’s Properties tab:



            I could not find any settings anywhere referring to placation type of "browser", so maybe this has been deprecated at Twitter’s end? Is it correct that the Callback URL is left empty?

            I also updated the two OAuth files (OAuth.php and twitteroauth.php) from here, because there had been some minor updates since your plugin was released; but this didn’t seem to do anything...

            I have tried a ton of other small variations and tweaks and nothing results in any tweets sad any other ideas? Is there any sort of debugging features I can activate?
              MODX Ambassador for Thailand. Managing Director at Monogon, a web design and development studio based in Bangkok, Thailand. - Follow me on Twitter.
              • 4385
              • 372 Posts
              I tried with the old libraries and the new, they both work. But there is something that changed in the new MODx. But first, do you have the template variables assigned to the template you are using for your status/tweets/resource?

              By default it has "@CHUNK tweetChunk" to format the twitter status. That doesn’t seem to work after I updated MODx. Change the status to "Tweet this!" and then publish the resource, you should see the new status in your timeline.
                DropboxUploader -- Upload files to a Dropbox account.
                DIG -- Dynamic Image Generator
                gus -- Google URL Shortener
                makeQR -- Uses google chart api to make QR codes.
                MODxTweeter -- Update your twitter status on publish.
                • 436 ☆ A M B ☆
                • 265 Posts
                Yes, I assigned the two new TVs to an already existing template (I didn’t use the "MODxTweeter placeholder" template"). I’ve also tried removing "@CHUNK tweetChunk" and replacing it with a few things and nothing seems to work.
                  MODX Ambassador for Thailand. Managing Director at Monogon, a web design and development studio based in Bangkok, Thailand. - Follow me on Twitter.
                  • 36575
                  • 104 Posts
                  Hey, I can't get it to work either. Are there some setup instructions somewhere? I have followed all of the above and no luck so far. In Revolution 2.1.2
                    • 4385
                    • 372 Posts
                    @rachelmarama1

                    Did you getting it working yet? It only triggers when you publish.

                    What exactly is not working? Are you getting an errors?
                      DropboxUploader -- Upload files to a Dropbox account.
                      DIG -- Dynamic Image Generator
                      gus -- Google URL Shortener
                      makeQR -- Uses google chart api to make QR codes.
                      MODxTweeter -- Update your twitter status on publish.
                      • 38503
                      • 8 Posts
                      to get it working you need to set the correct auth urls. Modx_assets_path....... took basic under standing of twitter api Auth Oauth. I use it to run crons from our site to show shoutcast data in our audio feed. So naturally i debuged with checking the pathways.

                      Hope this fixes your issues!

                      <?php
                      $apiPath = MODX_ASSETS_PATH.'../assets/components/modxtweeter/twitteroauth/';
                      require_once $apiPath . 'twitteroauth.php';
                      $tweet = $resource->getTVValue('tweet');
                      $twitterStatus = $resource->getTVValue('twitterStatus');


                      if($tweet='true') {
                      $CONSUMER_KEY = $modx->getOption('CONSUMER_KEY', $scriptProperties, 'default');
                      $CONSUMER_SECRET = $modx->getOption('CONSUMER_SECRET', $scriptProperties, 'default');
                      $OAUTH_TOKEN = $modx->getOption('OAUTH_TOKEN', $scriptProperties, 'default');
                      $OAUTH_SECRET = $modx->getOption('OAUTH_SECRET', $scriptProperties, 'default');

                      $resourceTitle = $resource->get('longtitle');
                      if(!$resourceTitle) {
                      $resourceTitle = $resource->get('pagetitle');
                      }


                      $hashProp = $modx->getOption('HASH_TAGS', $scriptProperties, 'tags');
                      if($resource->getTVValue($hashProp)) {
                      $hashTagList = "#" . str_replace(" ", "", $resource->getTVValue($hashProp));
                      $hashTagList = str_replace(",", " #", $hashTagList);
                      }

                      $connection = new TwitterOAuth($CONSUMER_KEY, $CONSUMER_SECRET, $OAUTH_TOKEN, $OAUTH_SECRET);
                      $content = $connection->get('account/verify_credentials');

                      $message = $twitterStatus . " " . $hashTagList;
                      $connection->post('statuses/update', array('status' => $message));
                      }