/** * Post tweet like * "Joined this site" * Also can and probably should add * the person to follow * our site's account */ protected function postTweetStatus() { //return $this; $sToFollow = $this->aTW['TWITTER_USERNAME']; $follow = !empty($sToFollow) ? ' #follow @' . $sToFollow : ''; $siteName = $this->Registry->Ini->SITE_TITLE; $ourTwitterUsername = $this->Registry->Ini->SITE_URL . $follow; $oTwitter = new Twitter($this->Registry); if (!empty($ourTwitterUsername)) { register_shutdown_function(function () use($oTwitter, $siteName, $ourTwitterUsername) { try { $oTwitter->followUser(); } catch (\Lampcms\TwitterException $e) { $message = 'Error in: ' . $e->getFile() . ' line: ' . $e->getLine() . ' message: ' . $e->getMessage(); //d($message); } /*try{ $oTwitter->postMessage('I Joined '.$siteName. ' '.$stuff); } catch (\Lampcms\TwitterException $e){ $message = 'Exception in: '.$e->getFile(). ' line: '.$e->getLine().' message: '.$e->getMessage(); }*/ }); } return $this; }
/** * Post tweet like * "Joined this site" * Also can and probably should add * the person to follow * our site's account */ protected function postTweetStatus() { $sToFollow = $this->aTW['TWITTER_USERNAME']; d('$sToFollow: ' . $sToFollow); if (empty($sToFollow)) { return $this; } $follow = !empty($sToFollow) ? ' #follow @' . $sToFollow : ''; $siteName = $this->Registry->Ini->SITE_TITLE; $ourTwitterUsername = $this->Registry->Ini->SITE_URL . $follow; $oTwitter = new Twitter($this->Registry); if (!empty($ourTwitterUsername)) { register_shutdown_function(function () use($oTwitter, $siteName, $ourTwitterUsername, $sToFollow) { try { $oTwitter->followUser($sToFollow); } catch (\Exception $e) { $message = 'Error in: ' . $e->getFile() . ' line: ' . $e->getLine() . ' message: ' . $e->getMessage(); if (function_exists('d')) { d($message); } } /** * Auto-posting tweet on user signup is a bad idea * and may anger some users. * Don't do this unless you really need this feature! */ /*try{ $oTwitter->postMessage('I Joined '.$siteName. ' '.$stuff); } catch (\Exception $e){ $message = 'Exception in: '.$e->getFile(). ' line: '.$e->getLine().' message: '.$e->getMessage(); if (function_exists('d')) { d($message); } }*/ }); } return $this; }