Home ¤ Register ¤ FAQ ¤ Search ¤ Active Topics ¤ Log In

UseBB Zone » Modifications » [G]uPortal

[G]uPortal

Page: 1 2 >

Author Post
Administrator
Registered: Jan 2006
Posts: 368
Location: Canada
uPortal
This file was submitted by the poster at the posted time

UseBB Version: v1.0.x
File Version: v1.0.1
Demo: http://usebbzone.com

This modification adds a fully functional portal to your useBB forum. Features:

* Sortable Box positions
* Left/Right box positions
* Permissions per portal box
* Edit, delete, disable portal boxes
* Can create plain HTML or PHP driven boxes
* Support's add-ons
* Easily edit all add-on settings from one location
* Easily add add-ons.
* Setable left and right box widths

**UPDATE v1.0.2
To update, please re-upload portal.tpl.php and latest_posts.php.
- Fixed template issue with Latest Posts module.
- Added "stripslashes" to Latest Posts module.

**UPDATE v1.0.1
- Added default variable $portalbox_width. Makes it easier to switch portal box positions.
- Updated add-ons to reflect the new default variable.
- Updated latest_posts.php to include TABLE_PREFIX

Download This File
_______________
« Last edit by Gaia on Wed Mar 11, 2009 10:22 am. »
Administrator
Registered: Jan 2006
Posts: 368
Location: Canada
How To Create Add-Ons

uPortal requires that all add-ons use .php extensions. Any other file extensions will be ignored.

Database Explained

Settings are all saved in one row in the table usebb_settings.

You can create an add-on with no settings required or with 1 or more settings reqired. You cannot create an add-on that requires multiple rows of data within the usebb_portal_settings table. If you need it, then just create your own table, acp module ( categorized under uPortal acp module ), etc. The box can still be added on the same way as the others on the end user side, except the settings will be on a different section then the rest.

Creating an add-on with one setting or more required, is a little more tricky.

You will need to create a row in the database table usebb_portal_settings.

The table has the following fields:

id
This is an auto increment, nothing you need to do with this.

heading_title
This is the name of your add-on. So, My Add-On.

titles
This depends on the number of settings you have. If you have one, just add in the one title. If you have more then one, add in each title, separated with a comma.

Setting One Title,Setting Two Title

descr
This depeonds on your titles. You will want them to correspond to each other. Also separated with a comma.

This is my setting one title description,This is my setting two title description

box_id
Don't need to worry about this part. Leave it blank. The end user will set this when they create the portal box.

file_name
This needs to be the same file name as the add-on you created. So, if i created the file my_addon.php, that is what I would put there

my_addon.php

Default Values

There are 3 main default values. These are as follows:

$title
This is the title that the end user set for the add-on. You need to use this as the table header name to reflect the end users settings.

$portalbox_width
This assigns a width to the portal box, depending which position it is.

$portalbox_width needs to be used when parsing the table head of any add-on as: {portalbox_width}.

The last default values are the add-on settings themselves. They are stored in an array, as numeric values.

So, if there are 2 settings, then you will get each setting by using:

$settings['0']; //This is the first setting
$settings['1']; //This is the second setting.


Default Template Bits

There are some default template bits that you can use in portal.tpl.php without having to edit the file. They are as follows:


$templates['leftbox'] = '<table class="maintable" style="width:{portalbox_width};">
<tr>
<td class="forumcat">{title}</td>
</tr>
<tr>
<td>
{content}
</td>
</tr>
</table>';

Used for HTML based left boxes. Can also be used for static PHP boxes.


$templates['rightbox'] = '<table class="maintable" style="width:{portalbox_width}">
<tr>
<td class="forumcat">{title}</td>
</tr>
<tr>
<td>{content}</td>
</tr>
</table>';

Used for HTML based right boxes. Can also be used for static PHP boxes.


$templates['table_end'] = '</table>';

A simple table end. For PHP based boxes that loop the data for multiple rows.


$templates['head_basic'] = '<table class="maintable" style="width:{portalbox_width};">
<tr>
<td class="forumcat">{title}</td>
</tr>
<tr><td>';

$templates['body_basic'] = '{content}';

$templates['end_basic'] = '</td></tr></table>';

This basic layout is used for PHP data that loops data, but the data doesn't require seperate rows. Such as the top posters add-on.

If there isn't a template bit that suits your needs, just open up portal.tpl.php and add in your own template bits under the comment.


//
// ADD-ON TEMPLATES BELOW!
//


Default Layout


<?php

/*

ADD-ON NAME

FOR: uPortal

No additional settings are needed for this add-on :).

*/


//
// Die when called directly in browser
// THIS IS REQUIRED
//
if ( !defined('INCLUDED') )
exit();

/*
Get any settings if you need them.
*/
$limit = $settings['0'];
$fid = $settings['1'];

/*
Do your thing here. $my_data is just an example.
*/
$my_data = 'This will display inside a portal box to the left.';

/*
Output your information. $title is a default variable.
*/
$template->parse('leftbox','portal', array(
'title' => $title,
'content' => $my_data,
'portalbox_width' => $portalbox_width
));


?>
_______________
« Last edit by Gaia on Mon May 21, 2007 12:10 pm. »
Administrator
Registered: Jan 2006
Posts: 368
Location: Canada
Misc Info and FAQ

Changing portal box widths

To change the portal box widths, you need to open global.tpl.php.

Find:


'portal_leftbox_width' => '150px',
'portal_rightbox_width' => '100%',


And change the values ( 150px, and 100% ) to the values you want.
_______________
« Last edit by Gaia on Mon May 21, 2007 12:23 pm. »
Administrator
Registered: Jan 2006
Posts: 368
Location: Canada
Reserved for additional add-ons
_______________
Member
Registered: Jun 2006
Posts: 80
Location: Athens, Hellas
It's indeed a nice module Gaia.

:)

I am definitely going to install it to my first public UseBB forum.
_______________
Visit UseBB Greece! :)

“All human actions have one or more of these seven causes: chance, nature, compulsion, habit, reason, passion, and desire.” (Aristotle)
Administrator
Registered: Jan 2006
Posts: 368
Location: Canada
Thanks ^_^.
_______________
Administrator
Registered: Jan 2006
Posts: 368
Location: Canada
I know it's early, but it has been updated. Just re-upload all files ( excluding Pre-Made Files ) and the update is complete.

Quote
**UPDATE v1.0.1
- Added default variable $portalbox_width. Makes it easier to switch portal box positions.
- Updated add-ons to reflect the new default variable.
- Updated latest_posts.php to include TABLE_PREFIX
_______________
Administrator
Registered: Jan 2006
Posts: 368
Location: Canada
Topic merged with support topic.

Try putting the query in separately.


INSERT INTO `usebb_portal_boxes` VALUES (1, 'Navigation', '» <a href="portal.php">Portal</a><br />» <a href="index.php">Forum Home</a><br />» <a href="members.php">Memberlist</a><br />» <a href="members.php?act=staff">Staff List</a>', 'left', 0, '', 0, 0, '');
INSERT INTO `usebb_portal_boxes` VALUES (2, 'Top Posters', '', 'left', 1, 'top_posters.php', 0, 0, '5');
INSERT INTO `usebb_portal_boxes` VALUES (3, 'Latest Posts', '', 'right', 1, 'latest_posts.php', 0, 0, '5');
INSERT INTO `usebb_portal_boxes` VALUES (4, 'Statistics', '', 'left', 2, 'stats_box.php', 0, 0, '');
INSERT INTO `usebb_portal_boxes` VALUES (5, 'Latest News', '', 'right', 0, 'latest_news.php', 0, 0, '3,2');


And then put the other queries in.


CREATE TABLE `usebb_portal_settings` (
`id` int(5) NOT NULL auto_increment,
`heading_title` varchar(255) NOT NULL default '',
`titles` varchar(255) NOT NULL default '',
`descr` text NOT NULL,
`box_id` int(11) NOT NULL default '0',
`file_name` varchar(255) NOT NULL default '',
UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

INSERT INTO `usebb_portal_settings` VALUES (1, 'Latest News', 'News Items,News Forum ID', 'The number of news items you want to display,The forum ID that the news will be extracted from', 5, 'latest_news.php');
INSERT INTO `usebb_portal_settings` VALUES (2, 'Top Posters', 'Number of Posters', 'Number of posters to show.', 2, 'top_posters.php');
INSERT INTO `usebb_portal_settings` VALUES (3, 'Latest Posts', 'Number of Posts', 'Number of posts you want displayed', 3, 'latest_posts.php');
_______________
Administrator
Registered: Jan 2006
Posts: 368
Location: Canada
Before you can insert the INSERT INTO query, you have to make sure you executed the query that creates the table.

So, first execute this:


CREATE TABLE `usebb_portal_boxes` (
`id` int(11) NOT NULL auto_increment,
`title` varchar(255) NOT NULL default '',
`content` text NOT NULL,
`position` varchar(255) NOT NULL default '',
`sort_id` int(5) NOT NULL default '0',
`file` varchar(255) NOT NULL default '',
`auth` tinyint(1) NOT NULL default '0',
`off` tinyint(1) NOT NULL default '0',
`settings` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;


THEN you can execute the inserts
_______________
Member
Registered: Jun 2007
Posts: 4
Ok buanget (= ok and very nice). My database modification problem is solved. Now I'm going to the next step. Thanks. God bless you . . .
Administrator
Registered: Jan 2006
Posts: 368
Location: Canada
No problem, glad it worked. :).
_______________
Member
Registered: Jan 2008
Posts: 3
i have the same error with him..i even follow all the instructions but i have an error.
Administrator
Registered: Jan 2006
Posts: 368
Location: Canada
What is the exact error? If it is the same as him, you will need to place each MySQL query separate.
_______________
Member
Registered: Jan 2008
Posts: 3
what do you mean? am i going to separate the MYSQL query with the insert? Same thing happen!
Member
Registered: Jan 2008
Posts: 3
problem solve. Thanks!
Member
Registered: Nov 2008
Posts: 3
hey. I installed the portal a while ago. I have been noticeing that in some of the active topic subject lines there are \s in them eventhough the actual thread subject line doesnt contain them.

Heres an example:
http://i160.photobucket.com/albums/t173/jaxathon/examp.jpg
« Last edit by Gaia on Wed Mar 11, 2009 10:08 am. »
Administrator
Registered: Jan 2006
Posts: 368
Location: Canada
Hey, sorry, didn't see this. I'll get that fixed for you tomorrow. Seems I forgot to add the function to remove slashes.
_______________
Member
Registered: Nov 2008
Posts: 3
Thanks =)
Administrator
Registered: Jan 2006
Posts: 368
Location: Canada
Sorry, it looks as though I won't get it updated till after the holidays. I'll get it up as soon as I can.
_______________
Member
Registered: Nov 2008
Posts: 3
Gaia wrote
Sorry, it looks as though I won't get it updated till after the holidays. I'll get it up as soon as I can.


Thats quite alright =) ive been quite busy myself too =)
Administrator
Registered: Jan 2006
Posts: 368
Location: Canada
This has been updated, fixed issues with latest_posts.php module.
_______________
Member
Registered: Jul 2009
Posts: 1
the sql commands gave me trouble when i executed through the built in "executor" << lol
any way, works great when i executed it through the phpmyadmin executor <<lol

Thanks allot Gaia!!
Member
Registered: Aug 2009
Posts: 1
Hello there, I need some assistance plz. First thing. I am crazy about the useBB forum soft, I have been seeking for something like this for a long time, how I found out about it was through some generic directory listing. I have bought IPB v3.0 just not long ago and after checking out useBB, I dropped IPB in a flash, mainly it is so bloated and etc. useBB is exactly what I've looked for, a fourm that is small as in being centered into the page as small as it is. I cant stand extended forums.

Now, for the help I need. I have installed the portal but I cannot figure where in the acp to enable it and all. I followed the install instructions to a "T" with no errors. The useBB install I have is UseBB v1.0.9. Can you please help me to make this work? I've finally found a forum soft that I like and now I only have this one lil issue. Thanks


EDIT::

OK, I have some of it fixed, I now can see in the ACP

uPortal

* Settings
* Portal Boxes

However, in the index of my forum, there is no link for the portal. Your downloaded file that has index.php I cannot figure out. I renamed my original index.php to index1.php and then uploaded yours. now when I try to access my forum, it sends me to some soite like mydomain.com which is a 404 error. Here is your file

<?php

//
// INDEX FILE FOR PORTAL REDIRECTION
//

/********MANUAL EDITS --- PLEASE CHANGE THESE!**********/

//
// This is the FULL PATH to the portal.php file. If you are not sure of this, please check your php.ini or ask your web host.
//
$path = '/home/user/public_html/forum/portal.php';

//
// This is the URL to the portal.php file.
//
$p_url = "http://mydomain.com/forum/portal.php";

//
// This is the URL to your forum index.php file.
//
$i_url = "http://mydomain.com/forum/index.php";



now this part I really dont get because I have never had to really enter in a path like this

$path = '/home/user/public_html/forum/portal.php';


I normally would just put in

http://mysite.com/forum
« Last edit by No14u on Tue Aug 18, 2009 1:09 am. »
Administrator
Registered: Jan 2006
Posts: 368
Location: Canada
You need to contact your host for the correct full path for your account.

Quote
// This is the FULL PATH to the portal.php file. If you are not sure of this, please check your php.ini or ask your web host.
_______________
Member
Registered: May 2007
Posts: 6
First, very nice forum board and excellent modifications.

I have installed this uPortal addon to version 1.0.1.0 and I get the following error;



In file sources\modules\portal_settings.php on line 99:

E_NOTICE - Uninitialized string offset: 0

Can someone shine some light on this error?

The offending code is;

$content .= '<tr><td class="fieldtitle">'.stripslashes($title[$i]).'</td><td><input type="text" name="setting-'.$tmp.'-'.$i.'" value="'.$bsettings[$i].'" /><div class="descr">'.stripslashes($descr[$i]).'</div></td></tr>';


on line 99

Page: 1 2 >

UseBB Zone » Modifications » [G]uPortal

Parse time: 0.0815 s · Server load: 0.72 · Template sections: 2 · SQL queries: 9