Commit 9376a6d7 authored by mmn's avatar mmn

ModPlus plugin now links to remote profiles with UserbyidAction

parent 8ad81a6a
......@@ -71,6 +71,11 @@ abstract class ProfileAction extends ManagedAction
return true;
}
public function getTarget()
{
return $this->target;
}
function isReadOnly($args)
{
return true;
......
......@@ -17,9 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if (!defined('STATUSNET')) {
exit(1);
}
if (!defined('GNUSOCIAL')) { exit(1); }
/**
* Some UI extras for now...
......@@ -59,24 +57,6 @@ class ModPlusPlugin extends Plugin
return true;
}
/**
* Add ModPlus-related paths to the router table
*
* Hook for RouterInitialized event.
*
* @param URLMapper $m URL mapper
*
* @return boolean hook return
*/
public function onStartInitializeRouter(URLMapper $m)
{
$m->connect('user/remote/:id',
array('action' => 'remoteprofile'),
array('id' => '[\d]+'));
return true;
}
/**
* Add per-profile info popup menu for author on notice lists.
*
......@@ -110,7 +90,7 @@ class ModPlusPlugin extends Plugin
protected function showProfileOptions(HTMLOutputter $out, Profile $profile)
{
if (!$profile->isGroup() && !$profile->isLocal()) {
$target = common_local_url('remoteprofile', array('id' => $profile->id));
$target = common_local_url('userbyid', array('id' => $profile->getID()));
// TRANS: Label for access to remote profile options.
$label = _m('Remote profile options...');
$out->elementStart('div', 'remote-profile-options');
......
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
class RemoteProfileAction extends ShowstreamAction
{
function title()
{
$base = $this->target->getBestName();
$host = parse_url($this->target->profileurl, PHP_URL_HOST);
// TRANS: Remote profile action page title.
// TRANS: %1$s is a username, %2$s is a hostname.
return sprintf(_m('%1$s on %2$s'), $base, $host);
}
/**
* Instead of showing notices, link to the original offsite profile.
*/
function showNotices()
{
$url = $this->target->profileurl;
$host = parse_url($url, PHP_URL_HOST);
$markdown = sprintf(
// TRANS: Message on remote profile page.
// TRANS: This message contains Markdown links in the form [description](link).
// TRANS: %1$s is a profile nickname, %2$s is a hostname, %3$s is a URL.
_m('This remote profile is registered on another site; see [%1$s\'s original profile page on %2$s](%3$s).'),
$this->target->nickname,
$host,
$url);
$html = common_markup_to_html($markdown);
$this->raw($html);
if ($this->target->hasRole(Profile_role::SILENCED)) {
// TRANS: Message on blocked remote profile page.
$markdown = _m('Site moderators have silenced this profile, which prevents delivery of new messages to any users on this site.');
$this->raw(common_markup_to_html($markdown));
}else{
$pnl = new NoticeList($this->notice, $this);
$cnt = $pnl->show();
if (0 == $cnt) {
$this->showEmptyListMessage();
}
$args = array('id' => $this->target->id);
if (!empty($this->tag))
{
$args['tag'] = $this->tag;
}
$this->pagination($this->page>1, $cnt>NOTICES_PER_PAGE, $this->page,
'remoteprofile', $args);
}
}
function getFeeds()
{
// none
}
/**
* Don't do various extra stuff, and also trim some things to avoid crawlers.
*/
function extraHead()
{
$this->element('meta', array('name' => 'robots',
'content' => 'noindex,nofollow'));
}
function showLocalNav()
{
// skip
}
function showSections()
{
// skip
}
function showStatistics()
{
// skip
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment