File tree Expand file tree Collapse file tree 4 files changed +11
-6
lines changed Expand file tree Collapse file tree 4 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 11<?php /* vim: set colorcolumn= expandtab shiftwidth=2 softtabstop=2 tabstop=4 smarttab: */
22namespace BNETDocs \Controllers \User ;
33
4+ use \BNETDocs \Libraries \Authentication ;
45use \BNETDocs \Libraries \Credits ;
56use \BNETDocs \Libraries \Document ;
67use \BNETDocs \Libraries \Exceptions \UserNotFoundException ;
@@ -20,6 +21,7 @@ class View extends Controller
2021 public function &run (Router &$ router , ViewLib &$ view , array &$ args )
2122 {
2223 $ model = new UserViewModel ();
24+ $ model ->active_user = Authentication::$ user ;
2325 $ model ->user_id = array_shift ($ args );
2426
2527 $ this ->getUserInfo ($ model );
Original file line number Diff line number Diff line change 1- <?php
2- namespace BNETDocs \Models ;
3- use \CarlBennett \MVC \Libraries \Model ;
4- class ActiveUser extends Model
1+ <?php namespace BNETDocs \Models ;
2+ class ActiveUser extends \CarlBennett \MVC \Libraries \Model
53{
64 public $ active_user ;
75}
Original file line number Diff line number Diff line change 11<?php namespace BNETDocs \Models \User ;
2- class View extends \CarlBennett \ MVC \ Libraries \Model
2+ class View extends \BNETDocs \ Models \ActiveUser
33{
44 public $ contributions ;
55 public $ documents ;
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ namespace BNETDocs\Templates\User;
33use \BNETDocs \Libraries \Document ;
44use \CarlBennett \MVC \Libraries \Common ;
55use \CarlBennett \MVC \Libraries \Pair ;
6+ $ active_user = $ this ->getContext ()->active_user ;
67$ contributions = $ this ->getContext ()->contributions ;
78$ documents = $ this ->getContext ()->documents ;
89$ news_posts = $ this ->getContext ()->news_posts ;
@@ -60,8 +61,12 @@ $this->opengraph->attach(new Pair('url', $url));
6061require ('./header.inc.phtml ' ); ?>
6162<div class="container mb-3">
6263 <span class="float-right">
63- <a class="btn btn-sm btn-primary" href="https://twitter.com/share?text=<?= urlencode ($ title )?> &url=<?= urlencode ($ url )?> " rel="external" data-popup="1"><img class="img-fluid" src="<?= Common::relativeUrlToAbsolute ('/a/social-twitter-24px.png ' )?> "/></a>
64+ <? if ($ active_user && $ user && $ active_user ->getId () == $ user ->getId ()) { ?>
65+ <a class="btn btn-sm btn-secondary" href="<?= Common::relativeUrlToAbsolute ('/user/update ' )?> " title="Update Profile">📝 Update Profile</a>
66+ <a class="btn btn-sm btn-secondary" href="<?= Common::relativeUrlToAbsolute ('/user/changepassword ' )?> " title="Change Password">🔑 Change Password</a>
67+ <? } ?>
6468 <a class="btn btn-sm btn-primary" href="https://facebook.com/sharer/sharer.php?u=<?= urlencode ($ url )?> " rel="external" data-popup="1"><img class="img-fluid" src="<?= Common::relativeUrlToAbsolute ('/a/social-facebook-24px.png ' )?> "/></a>
69+ <a class="btn btn-sm btn-primary" href="https://twitter.com/share?text=<?= urlencode ($ title )?> &url=<?= urlencode ($ url )?> " rel="external" data-popup="1"><img class="img-fluid" src="<?= Common::relativeUrlToAbsolute ('/a/social-twitter-24px.png ' )?> "/></a>
6570 </span>
6671<? if ($ user ) { ?>
6772 <h1>User Profile</h1>
You can’t perform that action at this time.
0 commit comments