Custom Profile Fields

Here you can find documentation on the Profile Manager plugin

  • Hi,

    I have a question about displaying the outputs from profile fields. I have customized my own profile according to my instructions here: http://community.elgg.org/mod/groups/topicposts.php?topic=343221&group_guid=343202.

    However, I have one small but pretty annoying problem. I can't get the profile fields for a particular profile page to come out. For example, if I use 'value' => $vars['entity']->(internalname), it doesn't show anything. The only thing close to working is when I use $vars['user'] instead of $vars['entity'], but that just shows the profile field outputs of the person who's logged in, not the actual profile owner. 

    Here is the code I have been playing with for a very long time without much success:  

     

    <?php

    $username = get_input('username');

    $page_owner = get_entity($username)->guid;

    ?>

    <?php echo elgg_view("output/text",array('value' => $page_owner->(internalname)));?>

    Where (internalname) is just the internal name I have set for the particular profile field.

    If you can help me figure this out, I would greatly appreciate it.

    Thanks in advance!

    Carlos

     

  • Answer to a question regarding above:

    Hi,

    I definitely solved it a while ago, although using other techniques. Please post this yourself where necessary.

    In general, when you use get_entity(), you must specify a GUID, not the username. Specifically, you must specifiy the GUID of the profile owner. You get that by calling page_owner().  So for example:

    $guid = page_owner();
    $user = get_entity($guid);

    Then you can do the following:

    $user->username

    You can actually call any property for that user given it is set to it's desired access level (make sure you set it to public or at least logged in users when you set up Elgg). If you want to add a property, simply include it upon registration. For example, you can save a public_username in registration by doing the following on register.php

    $username = get_input('username');

    $user->public_username = $username;

    $user->save();

    Do this for any property you wish to save for the user or any Elgg object in general. Then, wherever you want to show it, just get the object's entity (i.e get_entity(guid)) and call its property (i.e. $object->property). It will show depending on its access property (public, logged in users, friends, or private).

    Hope this helps. Please let me know if you have questions regarding anything else on Elgg.

    Best,

    Carlos

  • PROBLEM :: why i see :" plugin_manager doesn't exist ! "

Jeroen Dalsem

Owner of ColdTrick IT Solutions, developing social networking sites for the dutch market