#18 userinfo blocks

XOOPS_2.0.x
closed
Core (214)
5
2012-09-25
2003-04-06
No

See here for the original discussion:
http://www.xoops.org/modules/newbb/viewtopic.php?topic_id=7914&forum=10

Synopsis: it would be really cool if modules could add
arbitrary content (or blocks) to the "View Account"
screen. I've attempted to do just that with this patch.

To use, just unzip the archive into your XOOPS2RC3
directory (it will not work with earlier versions).
WARNING: THIS WILL OVERWRITE YOUR html/userinfo.php
FILE! Here are the archive contents:

html/userinfo.php
html/modules/account_block_test/
html/modules/account_block_test/index.php
html/modules/account_block_test/xoops_version.php
html/modules/account_block_test/templates/
html/modules/account_block_test/templates/account_block.html
html/modules/account_block_test/account_blocks/
html/modules/account_block_test/account_blocks/account_block_test.php
html/modules/account_block_test/account_block_test_slogo.png

It comes with an example module so you can see the
effects of the change. After unzipping the archive,
goto the admin section and enable the module. Then go
to your own "View Account" screen. You will see two
blocks added to that page (one that everyone can see
and one that only you can see). You can try browsing
another users userinfo screen and see that it only
displays one block.

I think this is (only kind of) a hack, mostly because I
don't fully understand the XOOPS2 kernel architecture
just yet. In other words, this is right as I know how
to do it right now. It may have been better to create a
new subclass of XoopsObject or XoopsBlock, but I got
lost fairly quickly in examining this option (hence my
current solution).

The changes to html/userinfo.php are surrounded by two
demarcation comments so it should be really easy to see
where I changed the file:

original file start ...
// ================================ ...
account block specific changes ...
// ================================ ...
original file end ...

The ordering and permission of the display of these
account blocks mirrors the ordering and access writes
of the modules which contain them. There's no special
permissions for them. I didn't see a need for any, but
this may be a change to make in the future, but I'm not
sure if this would be overly complicated.

I hope this is somewhat useful to someone. ;-)

Discussion

  • Matt Bogosian

    Matt Bogosian - 2003-04-06

    Modification to html/userinfo.php to allow for module-specific user account blocks

     
  • Matt Bogosian

    Matt Bogosian - 2003-04-06

    templates/system/system_userinfo.html replacement for this patch

     
  • Matt Bogosian

    Matt Bogosian - 2003-04-06

    Logged In: YES
    user_id=79080

    Oops...I almost forgot the new userinfo template. Here it
    is. You'll need to install this and use it in your General
    Preferences section as well for the patch to work.

     
  • Matt Bogosian

    Matt Bogosian - 2003-04-06

    The changed template file in text form (just clone your default templates and use this to override system_userinfo.html)

     
  • Matt Bogosian

    Matt Bogosian - 2003-04-10

    Logged In: YES
    user_id=79080

    Okay, I think I came up with a better solution. This reuses
    XOOPS's existing blocks mechanism, but just creates another
    special "Visible in" choice (much like "Top Page"). Now
    administrators can create custom blocks for the user page
    and assign modules' blocks the way they see fit. Module
    writers don't have to be confused by yet another block
    mechanism. IMHO, this is a much more elegant solution. It
    also requires much fewer modifications to the XOOPS sources.

    Attached is the patch file and archives of the patched files
    from RC3 (in both tar.gz and zip formats). All files for
    this modification start with "attempt2_user_block" (see
    "Existing Files" below).

    To use, just unzip/untar the archive into your XOOPS2RC3
    directory (I'm not sure if it will work with earlier versions).
    WARNING: THIS WILL OVERWRITE THE FOLLOWING FILES:

    html/header.php
    html/modules/system/admin/blocksadmin/blockform.php
    html/modules/system/admin/blocksadmin/blocksadmin.php
    html/modules/system/language/english/admin/blocksadmin.php

    P.S. I have not added the appropriate constants to any other
    language file other than "english".

     
  • Matt Bogosian

    Matt Bogosian - 2003-04-10

    user block feature implementation (2nd approach) patch file

     
  • Matt Bogosian

    Matt Bogosian - 2003-04-10

    user block feature implementation (2nd approach) zip file

     
  • Kazumi Ono

    Kazumi Ono - 2003-04-13

    Logged In: YES
    user_id=669367

    We may need to come up with a more general approach so
    that any block can be displayed within any page. For
    example, a certain block may need to be displayed only
    within the login page, news article page, or forum categpry
    page etc.

     
  • Kazumi Ono

    Kazumi Ono - 2003-04-13

    Logged In: YES
    user_id=669367

    We may need to come up with a more general approach so
    that any block can be displayed within any page. For
    example, a certain block may need to be displayed only
    within the login page, news article page, or forum categpry
    page etc.

     
  • Kazumi Ono

    Kazumi Ono - 2003-04-13

    Logged In: YES
    user_id=669367

    We may need to come up with a more general approach so
    that any block can be displayed within any page. For
    example, a certain block may need to be displayed only
    within the login page, news article page, or forum categpry
    page etc.

     
  • Jan Pedersen

    Jan Pedersen - 2005-05-16

    Logged In: YES
    user_id=841117

    XOOPS 2.2 will have a certain level of page awareness that
    will allow blocks to be placed on the user profile only.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks