New usersetting

I'm trying to make a usersetting that allow user icon display, it's not working. In newestmembers.php,

$show_icon = get_plugin_usersetting('show_icon', 'me4real');  - yes or no from edit.php

foreach($newest_members as $mem) {
      if ($mem->show_icon == 'no')
      continue;

      code ....

What am I doing wrong here?

  • Can somebody see what I'm missing? This is supposed to hide the usericon from newest members. Is it the wrong way to go?

        foreach($newest_members as $mem) {
            if ($mem->show_icon == 'no')
                continue;
            echo "<div class=\"recentMember\">" . elgg_view("profile/icon", array('entity' => $mem, 'size' => 'tiny')) . "</div>";
        }

  • Is it possible to get a little hint about this?

  • Try ->

        foreach($newest_members as $mem)
        {
        echo"<pre>";
        echo"($show_icon)\nMEM=>\n";
        print_r($mem);
        echo"</pre>";
        EXIT();

    Then send me the display that this shows .

     

  • Thank you. A long list...

    MEM=>
    ElggUser Object
    (
    [attributes:protected] => Array
    (
    [guid] => 525
    [type] => user
    [subtype] => 0
    [owner_guid] => 0
    [container_guid] => 0
    [site_guid] => 1
    [access_id] => 2
    [time_created] => 1291956982
    [time_updated] => 1291956982
    [last_action] => 1291956982
    [enabled] => yes
    [tables_split] => 2
    [tables_loaded] => 2
    [name] => Pia Piasen
    [username] => piasen
    [password] => 92fc40241f07ba65b5db6d5a7689d2fe
    [salt] => cdd6929a
    [email] => admin@elggzone.com
    [language] =>
    [code] =>
    [banned] => no
    [admin] => no
    [prev_last_action] => 0
    [last_login] => 0
    [prev_last_login] => 0
    )

    [url_override:protected] =>
    [icon_override:protected] =>
    [temp_metadata:protected] => Array
    (
    )

    [temp_annotations:protected] => Array
    (
    )

    [volatile:protected] => Array
    (
    )

    [valid:private] =>
    )

     

  • hmmm... i do not see what i was after ;-( goto skype and we'll have a closer look ;

  • Following the documentation - http://docs.elgg.org/wiki/Pluginsettings - I have added a usersetting, and it's working, the right value is set on edit.php. But the value is not parsed to the view, which is myplugin/myview, the avatar_on is empty,

    $avatar_on = get_plugin_usersetting('avatar_on', 'myplugin');                                   
    $newest_members = elgg_get_entities_from_metadata(array('metadata_names' => 'icontime', 'types' => 'user', 'limit' => 18));


                foreach($newest_members as $mem){
                        if ($mem->avatar_on == 'no')
                        continue;
                        echo "<li>";
                        echo "<div class=\"recentMember\">" . elgg_view("profile/icon", array('entity' => $mem, 'override' => TRUE, 'size' => 'small')) . "</div>";
                        echo "</li>";
                    }               

    How do I handle this. Does anybody know of a bug causing this to fail or am I just doing this completely wrong?