<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[GlotPress][966] trunk: Add public profiles to see a user's recent projects, contributions and which projects they can validate.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://glotpress.trac.wordpress.org/changeset/966">966</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://glotpress.trac.wordpress.org/changeset/966","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>markoheijnen</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2014-10-19 21:53:38 +0000 (Sun, 19 Oct 2014)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Add public profiles to see a user's recent projects, contributions and which projects they can validate.

Props Secretmapper for the initial patch.

See <a href="http://glotpress.trac.wordpress.org/ticket/340">#340</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkcssstylecss">trunk/css/style.css</a></li>
<li><a href="#trunkgpincludesassetsloaderphp">trunk/gp-includes/assets-loader.php</a></li>
<li><a href="#trunkgpincludesrouterphp">trunk/gp-includes/router.php</a></li>
<li><a href="#trunkgpincludesroutesprofilephp">trunk/gp-includes/routes/profile.php</a></li>
<li><a href="#trunkgpincludestemplatephp">trunk/gp-includes/template.php</a></li>
<li><a href="#trunkgpincludesthingstranslationphp">trunk/gp-includes/things/translation.php</a></li>
<li><a href="#trunkgpincludesthingsuserphp">trunk/gp-includes/things/user.php</a></li>
<li><a href="#trunkgpincludesurlphp">trunk/gp-includes/url.php</a></li>
<li><a href="#trunkgptemplatesprojectpermissionsphp">trunk/gp-templates/project-permissions.php</a></li>
<li><a href="#trunkgptemplatestranslationrowphp">trunk/gp-templates/translation-row.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkgptemplatesprofilepublicapiphp">trunk/gp-templates/profile-public.api.php</a></li>
<li><a href="#trunkgptemplatesprofilepublicphp">trunk/gp-templates/profile-public.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkcssstylecss"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/css/style.css</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/css/style.css       2014-10-17 16:42:16 UTC (rev 965)
+++ trunk/css/style.css 2014-10-19 21:53:38 UTC (rev 966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -101,7 +101,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">        text-decoration: none;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> #hello {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        font-family: "Helvetica", "Arial", sans-serif;
</del><span class="cx" style="display: block; padding: 0 10px">         color: #333;
</span><span class="cx" style="display: block; padding: 0 10px">        font-weight: normal;
</span><span class="cx" style="display: block; padding: 0 10px">        float: right;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -738,6 +737,63 @@
</span><span class="cx" style="display: block; padding: 0 10px">        left: 1em;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+#profile {
+       overflow: hidden;
+}
+
+.user-card {
+       margin-bottom: 5px;
+       overflow: hidden;
+}
+.user-card .user-avatar {
+       float: left;
+       margin: 0 12px 0 0;
+       width: 100px;
+       height: 100px;
+}
+.user-card dl.user-info dt {
+       font-size: 12px;
+       color: #888;
+       margin: 5px 6px 0 0px;
+       font-weight: bold;
+}
+
+.recent-projects {
+       float:left;
+       width:47%;
+}
+
+.recent-projects li {
+       padding: 8px;
+}
+
+.recent-projects p {
+       margin: 0;
+       padding: 0;
+}
+
+.recent-projects .ago {
+       color: #888;
+       font-size: 13px;
+       font-style:italic;
+       margin: 0;
+       padding: 0;
+}
+
+.validates-projects {
+       margin-left:50%;
+}
+
+.validates-projects p {
+       margin: 0;
+       padding: 0;
+}
+
+.validates-projects li {
+       padding: 8px;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> #add-entry input {
</span><span class="cx" style="display: block; padding: 0 10px">        width: 200px;
</span><span class="cx" style="display: block; padding: 0 10px">        padding: 5px;
</span></span></pre></div>
<a id="trunkgpincludesassetsloaderphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/gp-includes/assets-loader.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/gp-includes/assets-loader.php       2014-10-17 16:42:16 UTC (rev 965)
+++ trunk/gp-includes/assets-loader.php 2014-10-19 21:53:38 UTC (rev 966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -10,7 +10,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        //$styles->text_direction = 'rtl' == get_bloginfo( 'text_direction' ) ? 'rtl' : 'ltr';
</span><span class="cx" style="display: block; padding: 0 10px">        $styles->text_direction = 'ltr';
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $styles->add( 'base', '/style.css', array(), '20140903' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $styles->add( 'base', '/style.css', array(), '20141019' );
</ins><span class="cx" style="display: block; padding: 0 10px">         $styles->add( 'install', '/install.css', array('base'), '20140902' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunkgpincludesrouterphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/gp-includes/router.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/gp-includes/router.php      2014-10-17 16:42:16 UTC (rev 965)
+++ trunk/gp-includes/router.php        2014-10-19 21:53:38 UTC (rev 966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -47,6 +47,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        'get:/logout' => array('GP_Route_Login', 'logout'),
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        'get:/profile' => array('GP_Route_Profile', 'profile_get'),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        "get:/profile/$path" => array('GP_Route_Profile', 'profile_view'),
</ins><span class="cx" style="display: block; padding: 0 10px">                         'post:/profile' => array('GP_Route_Profile', 'profile_post'),
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        'get:/languages' => array('GP_Route_Locale', 'locales_get'),
</span></span></pre></div>
<a id="trunkgpincludesroutesprofilephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/gp-includes/routes/profile.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/gp-includes/routes/profile.php      2014-10-17 16:42:16 UTC (rev 965)
+++ trunk/gp-includes/routes/profile.php        2014-10-19 21:53:38 UTC (rev 966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,5 +1,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><span class="cx" style="display: block; padding: 0 10px"> class GP_Route_Profile extends GP_Route_Main {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        private $projects = array();
+
</ins><span class="cx" style="display: block; padding: 0 10px">         function profile_get() {
</span><span class="cx" style="display: block; padding: 0 10px">                if ( !GP::$user->logged_in() ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        $this->redirect( gp_url( '/login?redirect_to=' ).urlencode( gp_url( '/profile') ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -20,4 +22,97 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $this->redirect( gp_url( '/profile' ) );
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       public function profile_view( $user ) {
+               $user = GP::$user->find_one( array( 'user_nicename' => $user ) );
+
+               if ( ! $user ) {
+                       return $this->die_with_404();
+               }
+
+               $projects    = $user->get_recent_projects();
+               $locales = $user->locales_known();
+
+               $_recent_projects = array_slice( $projects, 0, 5 );
+
+               //recent projects
+               $recent_actions = array();
+               foreach ( $_recent_projects as $recent_project ) {
+                       $set = GP::$translation_set->find_one( array( 'id' => (int) $recent_project->id ) );
+
+                       if ( $set ) {
+                               $action = $this->get_project( $set );
+                               $action->set_id = $set->id;
+                               $action->human_time = $this->time_since( strtotime( $recent_project->last_updated ) );
+                               $action->last_updated = $recent_project->last_updated;
+                               $action->count = $recent_project->count;
+                               $recent_projects[] = $action;
+                       }
+               }
+
+               //validate to
+               $permissions = GP::$permission->find_many_no_map( array( 'user_id' => $user->id, 'action' => 'approve' ) );
+               foreach ( $permissions as $key => &$permission ) {
+                       $object_id = GP::$validator_permission->project_id_locale_slug_set_slug( $permission->object_id );
+                       $set = GP::$translation_set->find_one(
+                               array(
+                                       'project_id' => $object_id[0],
+                                       'locale' => $object_id[1],
+                                       'slug' => $object_id[2]
+                               )
+                       );
+
+                       unset( $permission->id, $permission->action, $permission->object_type, $permission->object_id );
+
+                       if ( $set ) {
+                               $permission = (object) array_merge( (array) $permission, (array) $this->get_project( $set ) );
+                               $permission->set_id = $set->id;
+                       } else {
+                               unset( $permissions[$key] );
+                       }
+               }
+
+               $this->tmpl( 'profile-public', get_defined_vars() );
+       }
+
+       private function get_project( $set ) {
+               if ( ! isset( $this->projects[ $set->project_id ] ) ) {
+                        $this->projects[ $set->project_id ] = GP::$project->get( $set->project_id );
+               }
+
+               $project = $this->projects[$set->project_id];
+               $project_url = gp_url_project( $project, gp_url_join( $set->locale, $set->slug ) );
+               $set_name = gp_project_names_from_root( $project ) . ' | ' . $set->name_with_locale();
+
+               return (object) array(
+                       'project_id' => $project->id,
+                       'project_url' => $project_url,
+                       'set_name' => $set_name
+               );
+       }
+
+       private function time_since( $time ) {
+               $time = time() - $time; // to get the time since that moment
+
+               $tokens = array (
+                       31536000 => 'year',
+                       2592000 => 'month',
+                       604800 => 'week',
+                       86400 => 'day',
+                       3600 => 'hour',
+                       60 => 'minute',
+                       1 => 'second'
+               );
+
+               foreach ( $tokens as $unit => $text ) {
+                       if ( $time < $unit ) {
+                               continue;
+                       }
+
+                       $numberOfUnits = floor( $time / $unit );
+
+                       return $numberOfUnits . ' ' . $text . ( ( $numberOfUnits > 1 ) ? 's' : '' );
+               }
+       }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunkgpincludestemplatephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/gp-includes/template.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/gp-includes/template.php    2014-10-17 16:42:16 UTC (rev 965)
+++ trunk/gp-includes/template.php      2014-10-19 21:53:38 UTC (rev 966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -96,6 +96,19 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function gp_project_names_from_root( $leaf_project ) {
+       $names = array();
+       $path_from_root = array_reverse( $leaf_project->path_to_root() );
+
+       foreach ( $path_from_root as $project ) {
+               $names[] = esc_html($project->name);
+       }
+
+       $project_path = implode( " | ", $names );
+
+       return $project_path;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> function gp_project_links_from_root( $leaf_project ) {
</span><span class="cx" style="display: block; padding: 0 10px">        $links = array();
</span><span class="cx" style="display: block; padding: 0 10px">        $path_from_root = array_reverse( $leaf_project->path_to_root() );
</span></span></pre></div>
<a id="trunkgpincludesthingstranslationphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/gp-includes/things/translation.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/gp-includes/things/translation.php  2014-10-17 16:42:16 UTC (rev 965)
+++ trunk/gp-includes/things/translation.php    2014-10-19 21:53:38 UTC (rev 966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -174,9 +174,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                if ( $user ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                        $row->user_login = $user->user_login;
</span><span class="cx" style="display: block; padding: 0 10px">                                        $row->user_display_name = $user->display_name;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                        $row->user_nicename = $user->user_nicename;
</ins><span class="cx" style="display: block; padding: 0 10px">                                 }
</span><span class="cx" style="display: block; padding: 0 10px">                        } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                $row->user_login = $row->user_display_name = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         $row->user_login = $row->user_display_name = $row->user_nicename = '';
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                        $row->translations = array();
</span><span class="cx" style="display: block; padding: 0 10px">                        for( $i = 0; $i < $locale->nplurals; $i++ ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -241,5 +242,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                wp_cache_set( $translation_set->id, (string) $last_modified, 'translation_set_last_modified' );
</span><span class="cx" style="display: block; padding: 0 10px">                return $last_modified;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> GP::$translation = new GP_Translation();
</span></span></pre></div>
<a id="trunkgpincludesthingsuserphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/gp-includes/things/user.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/gp-includes/things/user.php 2014-10-17 16:42:16 UTC (rev 965)
+++ trunk/gp-includes/things/user.php   2014-10-19 21:53:38 UTC (rev 966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -138,7 +138,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        public function get_avatar( $size = 80 ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function get_avatar( $size = 100 ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 return 'http://www.gravatar.com/avatar/' . md5( strtolower( $this->user_email ) ) . '?s=' . $size;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -165,7 +165,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $set->id = $translations->translation_set_id;
</span><span class="cx" style="display: block; padding: 0 10px">                        $set->count = $translations->count;
</span><span class="cx" style="display: block; padding: 0 10px">                        $set->locale = $translations->locale;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $set->date_added = $translations->date_added;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $set->last_updated = $translations->date_added;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        $projects[ $translations->translation_set_id ] = $set;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span></span></pre></div>
<a id="trunkgpincludesurlphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/gp-includes/url.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/gp-includes/url.php 2014-10-17 16:42:16 UTC (rev 965)
+++ trunk/gp-includes/url.php   2014-10-19 21:53:38 UTC (rev 966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -131,6 +131,10 @@
</span><span class="cx" style="display: block; padding: 0 10px">        return gp_url( array( 'projects', $project_path, $path ), $query );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+function gp_url_profile( $user_nicename ) {
+       return apply_filters( 'gp_url_profile', gp_url( array( '/profile', $user_nicename ) ), $user_nicename );
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> function gp_url_login( $redirect_to = null ) {
</span><span class="cx" style="display: block; padding: 0 10px">        return gp_url( '/login', array( 'redirect_to' => $redirect_to? $redirect_to : gp_url_current() ) );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunkgptemplatesprofilepublicapiphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/gp-templates/profile-public.api.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/gp-templates/profile-public.api.php                         (rev 0)
+++ trunk/gp-templates/profile-public.api.php   2014-10-19 21:53:38 UTC (rev 966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,29 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+$meta = array(
+       'meta' => array(
+               'user_display_name' => $user->display_name,
+               'user_registered'   => $user->user_registered,
+       )
+);
+
+foreach ( $recent_projects as $project ) {
+       $project->set_name = html_entity_decode( $project->set_name );
+       unset($project->project_id);
+       unset($project->set_id);
+}
+
+$arr = array_merge( $meta,
+       compact( 'locales', 'recent_projects' )
+);
+
+switch ( gp_get('filter') ) {
+       case 'meta':
+               echo json_encode( $meta );
+               break;
+       case 'recent_projects':
+               echo json_encode( compact('recent_projects') );
+               break;
+       default:
+               echo json_encode( $arr );
+               break;
+}
</ins></span></pre></div>
<a id="trunkgptemplatesprofilepublicphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/gp-templates/profile-public.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/gp-templates/profile-public.php                             (rev 0)
+++ trunk/gp-templates/profile-public.php       2014-10-19 21:53:38 UTC (rev 966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,56 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+gp_title( __('Profile &lt; GlotPress') );
+gp_breadcrumb( array( __('Profile') ) );
+
+gp_tmpl_header();
+?>
+
+<h2><?php echo $user->display_name; ?> <?php if ( $user->admin() ) { _e('(Admin)'); }; ?></h2>
+
+<div>
+       <div class="user-card">
+               <div class="user-avatar"><img src="<?php echo $user->get_avatar(); ?>" /> </div>
+
+               <dl class="user-info">
+                       <dd><?php vprintf( _n( '%s is a polyglot who contributes to %s',
+                                                                       '%s is a polyglot who knows %s but also knows %s.', count( $locales ) ),
+                                                                       array_merge( array( $user->display_name ), array_keys( $locales ) ) ); ?></dd>
+                       <dt><?php _e( 'Member Since' ); ?></dt>
+                       <dd><?php echo date( 'M j, Y', strtotime( $user->user_registered ) ); ?></dd>
+               </dl>
+       </div>
+</div>
+
+<div id="profile">
+       <div class="recent-projects">
+               <h3><?php _e( 'Recent Projects' ); ?></h3>
+
+               <ul>
+               <?php foreach ( $recent_projects as $project ): ?>
+                       <li>
+                               <p><?php printf( '%s: %s contributions', gp_link_get( $project->project_url, $project->set_name ), $project->count ); ?></p>
+                               <p class="ago">
+                                       <?php printf( 'last translation about %s ago (UTC)', $project->human_time ); ?>
+                               </p>
+                       </li>
+               <?php endforeach; ?>
+               </ul>
+       </div>
+       <div class="validates-projects">
+               <h3><?php _e( 'Validator to' ); ?></h3>
+
+               <?php if ( count($permissions) >= 1 ): ?>
+                       <ul>
+                       <?php foreach ( $permissions as $permission ): ?>
+                               <li>
+                                       <p> <?php echo gp_link_get( $permission->project_url, $permission->set_name ); ?> </p>
+                               </li>
+                       <?php endforeach; ?>
+                       </ul>
+               <?php else: ?>
+                       <p><?php printf( '%s is not validating any projects!', $user->display_name )?></p>
+               <?php endif ?>
+       </div>
+</div>
+
+<?php gp_tmpl_footer();
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span></span></pre></div>
<a id="trunkgptemplatesprojectpermissionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/gp-templates/project-permissions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/gp-templates/project-permissions.php        2014-10-17 16:42:16 UTC (rev 965)
+++ trunk/gp-templates/project-permissions.php  2014-10-19 21:53:38 UTC (rev 966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -18,7 +18,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">        <?php foreach( $permissions as $permission ): ?>
</span><span class="cx" style="display: block; padding: 0 10px">                <li>
</span><span class="cx" style="display: block; padding: 0 10px">                        <span class="permission-action"><?php _e('user'); ?></span>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        <span class="user"><?php echo esc_html( $permission->user->user_login ); ?></span>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 <span class="user"><?php printf( '<a href="%s">%s</a>',
+                                       gp_url_profile( $permission->user->user_nicename ), esc_html( $permission->user->user_login ) ); ?></span>
</ins><span class="cx" style="display: block; padding: 0 10px">                         <span class="permission-action"><?php printf( __('can %s strings with locale'), esc_html( $permission->action ) ); ?></span>
</span><span class="cx" style="display: block; padding: 0 10px">                        <span class="user"><?php echo esc_html( $permission->locale_slug ); ?></span>
</span><span class="cx" style="display: block; padding: 0 10px">                        <span class="permission-action"><?php _e('and slug'); ?></span>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -34,7 +35,8 @@
</span><span class="cx" style="display: block; padding: 0 10px">                <?php foreach( $parent_permissions as $permission ): ?>
</span><span class="cx" style="display: block; padding: 0 10px">                        <li>
</span><span class="cx" style="display: block; padding: 0 10px">                                <span class="permission-action"><?php _e('user'); ?></span>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                <span class="user"><?php echo esc_html( $permission->user->user_login ); ?></span>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         <span class="user"><?php printf( '<a href="%s">%s</a>',
+                                               gp_url_profile( $permission->user->user_nicename ), esc_html( $permission->user->user_login ) ); ?></span>
</ins><span class="cx" style="display: block; padding: 0 10px">                                 <span class="permission-action"><?php printf(__('can %s strings with locale'), esc_html( $permission->action )); ?></span>
</span><span class="cx" style="display: block; padding: 0 10px">                                <span class="user"><?php echo esc_html( $permission->locale_slug ); ?></span>
</span><span class="cx" style="display: block; padding: 0 10px">                                <span class="permission-action"><?php _e('and slug'); ?></span>
</span></span></pre></div>
<a id="trunkgptemplatestranslationrowphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/gp-templates/translation-row.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/gp-templates/translation-row.php    2014-10-17 16:42:16 UTC (rev 965)
+++ trunk/gp-templates/translation-row.php      2014-10-19 21:53:38 UTC (rev 966)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -140,9 +140,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                <dt><?php _e('Translated by:'); ?></dt>
</span><span class="cx" style="display: block; padding: 0 10px">                                <dd><?php
</span><span class="cx" style="display: block; padding: 0 10px">                                if ( $t->user_display_name && $t->user_display_name != $t->user_login ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        printf( '%s (%s)', $t->user_display_name, $t->user_login );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 printf( '<a href="%s">%s(%s)</a>',
+                                               gp_url_profile( $t->user_nicename ),
+                                               $t->user_display_name,
+                                               $t->user_login
+                                       );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                        echo $t->user_login;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                 printf( '<a href="%s">%s</a>',
+                                               gp_url_profile( $t->user_nicename ),
+                                               $t->user_login
+                                       );
</ins><span class="cx" style="display: block; padding: 0 10px">                                 }
</span><span class="cx" style="display: block; padding: 0 10px">                                ?></dd>
</span><span class="cx" style="display: block; padding: 0 10px">                        </dl>
</span></span></pre>
</div>
</div>

</body>
</html>