Author Topic: New module to show entry key information to logged in users  (Read 29751 times)

0 Members and 1 Guest are viewing this topic.

Offline Poffen

  • SOBI Team
  • Moderator
  • Sobi Hero
  • *
  • Posts: 2296
  • Reviews:

    What is it?

Hi all,

I've made a module, the Sobi2 Userlist Module, which i would like to share. The module shows some key information to the Sobi2 entry owner like, entry ID, title, site visits (hits), date of last update, number of days until the entry expires and total payments for each entry. It can be set to show active (published), as well as unpublished/unapproved and expired entries (or any combinations of these) (see attached image). The user can also edit the entries indexed in the module, if the Edit/Delete options are enabled (in Sobi2) for the entry owner.

The module should preferably be shown under the usermenu somewhere and assigned to a module position which extends at least the center column of your template, as the module need some width. Some templates offer a "banner" position, which seems to be appropriate. If your template does not offer a module position with sufficient width, you can create a new module position (see below) to fit the requirements of the module.

The current version is 1.2 and the module is only compatible with J 1.5x.

Feel free to test it and use it at your own risk, of course.

Regards Poffen


DESCRIPTION AND KEY INFORMATION

Sobi2 Userlist Module

The information displayed by the module include number of hits, date of last update, number of days until expiration and the total payment for the entry. The module can be configured to also display the "Edit" and "Delete" buttons as well as the "Renew" link, if these options are set in the Sobi2 configuration.

The module has been created to display Sobi2 entry related content to logged in owners only, and will not display any information to anonymous users. It's recommended therefore that the module is displayed under the usermenu  (see installation instructions below). It will, however, work under any other Joomla menu item.


Installation

Go to Menus --> usermenu and click on "new". Then, select a menu item type of User --> Default User Layout. This page layout will have a default "welcome message" which you can use as it is, or you can edit or even remove. The welcome message can be edited in the WELCOME_DESC key of com_user.ini (site language folder).

Select a suitable module position (which provides some width), or, if necessary, create a new position. Finally, make sure the module is set to be displayed only under the menu link you just created.


HOW TO CREATE A NEW MODULE POSITION

Open your Joomla templateDetails.xml file and find the list of module positions (between <position> tags) in the file. You should see something like:

...........
<position>user8</position>
<position>user9</position>
<position>user10</position>

...........
            
Then, add a new position with a unique name, like e.g. <position>userlist</position> to the  bottom of the list:

...........
<position>user8</position>
<position>user9</position>
<position>user10</position>

<position>userlist</position>
...........

The new module position should now be visible at the module's back end.

This step is not required, as you can still type in the new module position in the dropdown list in the module's admin area, but the new position will always remain in the list when you add it to the templateDetails.xml file. The alternative is to type it in manually in the dropdown list in the modules admin area, in which case it will disappear from the list if no modules are assigned to this position.

Next, open your Joomla Template index.php file and look for <jdoc:include type="component" /> command. This is the position in the template where the components are displayed. Then, add the code below after  the "component" command. This area in the template should provide sufficient space for the module to be displayed properly.

<?php if( $this->countModules('userlist') ) {?>
   <div style="text-align:center"><jdoc:include type="modules" name="userlist" style="XHTML" /></div>
<?php } ?>


You can use other module chromes (module styles), but XHTML is probably fine. The styling element of the div (style="text-align:center") may be added to center the table elements of the module. Additional CSS is included in the module to left-align some table elements.

See here for information on using module chromes:

http://docs.joomla.org/What_is_module_chrome%3F
http://docs.joomla.org/Understanding_Output_Overrides#Module_Chrome


And don't forget to BACKUP before you modify the template files!!


INFORMATION ON UPGRADES OR FIXES

Any information related to upgrade of the module will be posted in this tread. The users are encouraged to also use this tread to report any problems experienced with the use of the module.


CHANGELOG

Version 1.1.1
Fixed bug:    A wrong data format has been fixed
Fixed bug:    The code has been changed to prevent the display of
                    un-assigned Sobi2 entries to anonymous users, if attempted by the admin to display the module publicly.

Add:            A german language file has been included, thanks to
                    KASMorpheus.

Version 1.1.2
Change:      Reversed the output of owner name and accompanying text above table to comply with the
                   grammer of our Italian friends.

Add:           Added Italian language file, thanks to J. Sparrow.

Version 1.2
Fixed bug:   In version 1.1.2 a wrong payment was returned if an entry was listed in several non-free categories.
                   This should now be fixed.
Fixed bug:   Proper escaping was missing for a couple of output values.

Change:      The options in the module's back end (v 1.1.2) to set "User can see unpublished entries" and "User can see expired
                   entries", have been removed. The visibility of "unpublished" and "expired" entires are now automatically set by the
                   config keys in the Registry Editor of Sobi2 (i.e. "can_see_unpublished" and "can_see_expired").

Add:            A javascript (jQuery) navigation option has been included (optional). This option is based on a slightly modified
                    version of a jQuery plugin, Table Navigation, made by Ryan Zielke . To avoid conflicts with the mootools library of Joomla,
                    an option is included to load a "noconflict" script  with the jQuery library. Both scripts are loaded by default. If
                    your installation is already using jQuery, with a noconflict option included, you should set both "Load noconflict
                    script" and "Load jQuery" to "No", or if jQuery is loaded without a noconflict script, you should set "Load jQuery"
                    to "No" and "Load noconflict script" to "Yes". The jQuery plugin require jQuery v1.2.3 or above.

                    To avoid the columns from jumping around (changing width), when using the navigation option, it may be
                    necessary to give the table header cells in the template file (default.php) a fixed width.

                    If you don't need the pagination option, it's recommende that you turn this off at the module's back end to avoid
                    unneccessary loading of scripts.

Add:            The title can now be truncated and set to a predefined character length, followed by three dots (...). This feature is
                    useful if you have long entry titles.

Add:            French and spanish translations have been included, thanks to aka VeeTouine and aka silvasfull.

Add:            Some new language definitions have been included in the ini files.


DOWNLOAD

The module can be downloaded from the Download Directory of Sigsiu.net: User List Module
« Last Edit: 09. February 2011, 22:20:00 by Poffen »
Joomla - 1.5.7, Sobi2 - 2.9.0.1
PHP - 5.2.4, MySQL - 5.0.51a, Apache - 2.2.8, Firefox - 3.0.3
Country: Norway Norway |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile


Offline Syrinx

Re: New module to show entry key information to logged in users
« Reply #1 on: 03. May 2009, 07:25:53 »
Very useful module!  Thanks for sharing it with the community  :)
Country: United States United States |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Offline leven

  • SOBI Team
  • Moderator
  • Sobi Experte
  • *
  • Posts: 456
  • Reviews:

    What is it?

Re: New module to show entry key information to logged in users
« Reply #2 on: 03. May 2009, 14:14:28 »
Nice work! Thank you.  :)
{The Difference Between Sobi2 and SobiPRO}

"Everything that irritates us about others can lead us to an understanding of ourselves." Carl Jung
Country: Greece Greece |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile Greek guide to free internet access

Offline Poffen

  • SOBI Team
  • Moderator
  • Sobi Hero
  • *
  • Posts: 2296
  • Reviews:

    What is it?

Re: New module to show entry key information to logged in users
« Reply #3 on: 04. May 2009, 21:19:05 »
Hi,

I've corrected some problems with rendering of images with IE6 and also included the option to select a thousand separator (white space, punctuation or comma) for the payment value.

A new version has been uploaded.

Regards Poffen
« Last Edit: 04. May 2009, 21:23:20 by Poffen »
Joomla - 1.5.7, Sobi2 - 2.9.0.1
PHP - 5.2.4, MySQL - 5.0.51a, Apache - 2.2.8, Firefox - 3.0.3
Country: Norway Norway |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Offline Poffen

  • SOBI Team
  • Moderator
  • Sobi Hero
  • *
  • Posts: 2296
  • Reviews:

    What is it?

Re: New module to show entry key information to logged in users
« Reply #4 on: 16. May 2009, 02:29:48 »
Hi,

I've fixed a couple of minor issues and uploaded a new version.

Fixed bug related to variable undefined if user has no entries.
Also fixed a couple of minor html issues, so the module should now validate according to W3C.

Poffen
Joomla - 1.5.7, Sobi2 - 2.9.0.1
PHP - 5.2.4, MySQL - 5.0.51a, Apache - 2.2.8, Firefox - 3.0.3
Country: Norway Norway |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Offline obperryo

Re: New module to show entry key information to logged in users
« Reply #5 on: 25. May 2009, 16:32:55 »
I have installed and created the menu button.. getting this error

Warning: mysql_query() [function.mysql-query]: Unable to save result set in /home/content/o/b/p/obperryo/html/dev/sobi2/libraries/joomla/database/database/mysql.php on line 223

Warning: DB reports: DB function failed with error number 1242
Subquery returns more than 1 row SQL=SELECT item.itemid, item.title, item.published, item.approved, item.hits, item.publish_up, item.publish_down, item.last_update, SUM( payments.amount ) AS amount, ( SELECT catid FROM `jos_sobi2_cat_items_relations` WHERE itemid = item.itemid ) AS catid FROM `jos_sobi2_item` AS item LEFT JOIN `jos_sobi2_payments` AS payments ON item.itemid = sid WHERE item.owner = 64 AND item.published != 0 AND item.approved != 0 AND ( item.publish_down > '2009-05-25 07:19:13' OR item.publish_down = '0000-00-00 00:00:00' ) GROUP BY item.itemid ORDER BY item.publish_up DESC LIMIT 5 in /home/content/o/b/p/obperryo/html/dev/sobi2/modules/mod_sobi2userlist/mod_sobi2userlist.php on line 69


Any thoughts?  Joomla 1.5.10 and php 5.2.5
Country: United States United States |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Offline Poffen

  • SOBI Team
  • Moderator
  • Sobi Hero
  • *
  • Posts: 2296
  • Reviews:

    What is it?

Re: New module to show entry key information to logged in users
« Reply #6 on: 25. May 2009, 21:12:27 »
Hi obperryo,

I'm not sure what the problem could be, but I don't think it's due to php version you are using. I'll look into it and see what I can find out, and hopefully fix it.

Thanks for reporting...

Poffen

Joomla - 1.5.7, Sobi2 - 2.9.0.1
PHP - 5.2.4, MySQL - 5.0.51a, Apache - 2.2.8, Firefox - 3.0.3
Country: Norway Norway |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Offline obperryo

Re: New module to show entry key information to logged in users
« Reply #7 on: 26. May 2009, 00:20:15 »
Hi obperryo,

I'm not sure what the problem could be, but I don't think it's due to php version you are using. I'll look into it and see what I can find out, and hopefully fix it.

Thanks for reporting...

Poffen



Thank you!  Please let me know what i can do to help.
Country: United States United States |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Offline Poffen

  • SOBI Team
  • Moderator
  • Sobi Hero
  • *
  • Posts: 2296
  • Reviews:

    What is it?

Re: New module to show entry key information to logged in users
« Reply #8 on: 26. May 2009, 00:43:49 »
Hi obperryo,

I've had a look at the issue with the module and it seems from the information I could find that the error you reported is due to MySQL not being happy with the way I constructed the query. It complains about a sub-query outputting several rows. What I don't understand (and I'm far from an expert coder) is that I didn't get the same error at my end  :blink:. I've tested the module both on a live site and in my local environment, and found no errors, whatsoever. I assume therefore that this is due to you having another MySQL version than those I've tested the modules with.

I have now reorganized the code and broken up the single query into two queries, and this seems to work at my end. I don't know, however, if this solves the problem you had (since I'm not able to reproduce that...). I would appreciate therefore if you could test the rewritten code of the mod_sobi2userlist.php (attached) to see if this solves your issue.

Also, I would appreciate if you could report back...  :)


Regards Poffen

[attachment=1]
« Last Edit: 26. May 2009, 09:04:04 by Poffen »
Joomla - 1.5.7, Sobi2 - 2.9.0.1
PHP - 5.2.4, MySQL - 5.0.51a, Apache - 2.2.8, Firefox - 3.0.3
Country: Norway Norway |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Offline obperryo

Re: New module to show entry key information to logged in users
« Reply #9 on: 26. May 2009, 02:45:49 »


Reporting back!  That worked.  Thank you!
Country: United States United States |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Tags: