自分のプロフィールだけを変更できるようにする
他人のプロフィールを見る事はできるけれど、変更はできないようにします。
/var/www/podtv/apps/frontend/modules/profile/actions /actions.class.php
public function executeShow() { $this->profile = sfGuardUserProfilePeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($this->profile); }
↑はもともと $this->sf_guard_user_profileに代入していたのですが、それだと viewでの表示に問題が出たので、$this->profileに代入するようにしました。
/var/www/podtv/apps/frontend/modules/profile/templates/showSuccess.php
<?php if ( $sf_user->isAuthenticated()) { // 認証済 if ( $sf_request->getParameter( 'id') == $sf_user->getProfile()->getId()) { // 自分のプロフィールを表示した場合はプロフィール変更のリンクを表示させる echo '<h1>' .link_to( 'プロフィールを変更する', 'profile/edit?id='.$sf_user->getProfile()->getId()) .'</h1><br />'; } } ?>
http://podtvlabo.com/profile/show/id/2
というわけで、できました。