Customize River message for new plugin...

Hi,

I was able to create a new plugin and once it is used by a member it's being pusehd to the river. In the Activity Stream it now says USER posted to URL...

I would like to change that message, espascially the 'posted to' part. I can't seem to find any code to change in the create.php. Also if there's a way to do it with language files please let me know. I might offer different languages to the users in the future.

Here's my code in the create.php of the plugin:

<?php
$object = $vars['item']->getObjectEntity();
$performed_by = get_entity($vars['item']->subject_guid);
// print_R($object);

$txt = "";

if ($object->laud != "")
    $txt .= elgg_echo("laud_items:laud") .": ". $object->laud ."<br>";

$icon = $object->getIconURL('tiny');
if (strpos($icon, "default/tiny.png") == 0)
    $txt .= "<img src='". $icon ."'/>";

$url_artist = "";
if ( ($object->artist != "") || ($object->song != "")) {
    $url_web = substr($vars['url'], 0, strlen($vars['url'])-5);

    $url_artist = "<a href='". $url_web ."title/". $object->song_slug ."/artist/". $object->artist_slug ."/' target='_blank'>". $object->song ." - ". $object->artist ."</a>";
}

$url_user = "<a href='". $performed_by->getURL() ."'>". $performed_by->name ."</a>";

// $msg = sprintf(elgg_echo("laud_items:river:created"), $url_user, $txt);

echo elgg_view('river/elements/layout', array(
    'item' => $vars['item'],
    'summary' => sprintf(elgg_echo("river:create:object:laud_item"), $url_user, $url_artist),
    'message' => $txt,
/*
    'attachments' => elgg_view_entity_icon($object, 'tiny', array(
        'use_hover' => false,
        'use_link' => false,
    )),
*/
));
?>

 

 

Also in the activiy stream I can now select the plugin to only show these plugins statements which is great but it only says 'Show Item:object:laud_item'

How do I give it a real name?

Thanks

Tino

 

  • I was able to figure this out myself. In the plugin folder there needs to be a /language/ folder in there en.php for the english language. I was able to copy what I needed from another plugin and it works great after reactivating and flushing cache.

     

    Starting to figure out elgg more and more and I start to love it... :)

     

     

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking