Is it possible to have multiple wires?

Hi!, im doing rapid prototyping using elgg for a very large corp. I want to have 2 wires, or at least filter wire content.

For example, i want to show 2 wires on the dashboard, one showing all entries tagged with #something, and on wire showing all entries tagged with #something else.

Is this doable in any convenient manner? :)

 

cheers!

  • It would require some modification to the plugin, but nothing huge.  The biggest problem is that the wire doesn't support hashtags, so there is no way to pull out posts based upon content unless you want to start writing your own custom SQL queries.

    One approach would be to search the post's content during the save action to extract the hash tags, and then set those as tags on the post entity.  You can then use Elgg's API to pull out the post entities to display them in the widgets based upon tags.

  • Hm! Can you give me some pointers, code examples or what API methods to use? :) Thanks in advance.

  • If you're familiar with Elgg's API already, just dive into the code: mod/thewire/actions/add.php will be where you extract the hash tags and apply them to the object.  preg_match() is your friend for this.

    If you're not familiar with Elgg's API, check out the Developer's Docs on the wiki.  There is a bit of a learning curve with Elgg, but if you've used any other frameworks most of the concepts will be pretty familiar.  There is also the Reference Site for low-level API documentation.

  • Hmm, yes, i dont want to fiddle with the core, all my functionality lies in my theme_****-folder. Views where easy to override, is actions as easy? Trying to determin the file structure i should use.

    Seems like the object already saves the whole body as tags?

        // convert the shout body into tags
            $tagarray = filter_string($body);

    and then that is being saved with the object..

  • Would no the proper path be:

    /mod/theme_myown/actions/thewire/add.php

    /mod/theme_myown/thewire/actions/add.php

    My add.php is a 0byte file but i can still save a wire post...

     

  • You can do this without touching the thewire code. Register for the 'create', 'entity' event. In your callback, check that the entity has the subtype for the thewire and then extract and add tags there.

    About the tagarray - ugh! That was removed and shouldn't have been a part of Elgg 1.7. That is really frustrating. It'll be gone in Elgg 1.7.1

  • Hi Cash, so my /mod/theme_foo/start.php would contain:

    register_elgg_event_handler('create','entity','foo');

    function foo(){
        if($entity->getSubtype() == 'thewire')){
            //do stuff
        }
    }

    Is this what you mean?

  • @Cash - Which part of $tagarray was removed?