[geeklog-devel] User Profile Plugin API

Blaine Lang devel at portalparts.com
Sun Oct 21 17:30:56 EDT 2007


Ok so I was revisiting how I last left the usersettings.php function 
edituser and the Account Profile functionality.

Let me re-cap the 1.5 changes that have been made and how it can be 
extended. I think it provides the requested and needed functionality.

1) In usersettings.php - function edituser()

The code to create the navbar was changed to use an array to set the 
tabs and headings.
    foreach ($LANG_MYACCOUNT as $id => $label) {
        
$navbar->add_menuitem($label,'showhideProfileEditorDiv("'.$id.'",'.$cnt.');return 
false;',true);
        $cnt++;
    }

So by extending this array, you can create a new working tab. Example in 
your plugins language file:
  - $LANG_MYACCOUNT['myspace'] = 'My Space';
Adds a new tab that now will work.
Just need to add the matching div to one of the profile template - most 
likely preferences/displayprefs.thtml or preferences/profile.thtml
  Example:
    <div id="myspace" class="jsenabled_hide"> 
      custom html and template vars set by any plugin or 
customTemplateSetVars
    </div>

  The class="jsenabled_hide" is necessary so the onload javascript will 
automatically hide these div panels.

All the other functionality to set the custom template variables and 
save data are already in place.

If you wanted to remove any of the existing navbar tabs, you could just 
edit the language file $LANG_MYACCOUNT and remove the ones you did not 
want to use. You could easily only show tabs depending on user permissions.

Regards,
Blaine


Dirk Haun wrote:
> Blaine Lang wrote:
>
>   
>> Another requirement I have seen is being able to not display certain 
>> tabs and while that can be done by removing the content from the 
>> templates, maybe we should have config options to remove them.
>>     
>
> Same here: My employer is preparing to give selected partners and
> customers access to the website and I assume there will soon we requests
> to hide various account options.
>
> For example, from the "Layout & Language" tab, we probably only need the
> Language and Date Format options (and Time Zone, in 1.5). So we would
> need a fine-grained way to control which options are available.
>
> Of course, we'll just remove them from the templates for now, as long as
> we're on 1.4.1.
>
>
> Btw, a similar issue will probably come up with the config options in
> 1.5. We may want to give some people access to some of those options. So
> not only should these things be configurable, we may want to make them
> depend on rights or group membership.
>
> Just a thought ...
>
> bye, Dirk
>
>
>   



More information about the geeklog-devel mailing list