Showing posts with label dolphin. Show all posts
Showing posts with label dolphin. Show all posts

Thursday, September 3, 2009

Customizing your Dolphin Community - a popular topic

Now let's look at PHP within Dolphin and pull it together. I hope this post will help you customize your dolphin (community) site. We'll start by dissecting a simple page from the Dolphin community builder application.

You should read the previous post ( a simple PHP primer ) before reading this popular blog entry on customizing your dolphin web site. It will help you see the very basic PHP skill you should have before customizing your web site yourself.

Let's go ahead and open the file (dolphin root directory) /faq.php - this is the simplest file to start with, when customizing your Boonex community software.

After the Boonex copyright, you will notice the next 2 lines.

require_once( './inc/header.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
These lines include important files for the dolphin framework and should not be removed.

Next in the dolphin page framework we tell it:
$_page['name_index'] = 13;
$_page['css_name'] = 'faq.css';
$_page['name_index'] Tells dolphin to use that numbered template (from the tmpl_uni directory) These template files are called page_xxx.html in your template directory (templates/tmpl_xxx/)

$_page['css_name'] Tells dolphin to include that named css file (for style) 
NOTE: For it to pickup and use the CSS file you reference in this setting, the css file must be in the /templates/tmpl_uni/css/ directory.

Then you will notice more PHP....

if ( !( $logged['admin'] = member_auth( 1, false ) ) )
{
if ( !( $logged['member'] = member_auth( 0, false ) ) )
{
if ( !( $logged['aff'] = member_auth( 2, false ) ) )
{
$logged['moderator'] = member_auth( 3, false );
}
}
}
This is where dolphin looks for the security details.. what level is the current user logged in as. Again, do not alter this yet - we can cover the user-level access in another post about Dolphin security.

Here Dolphin will set some page content but get the actual content from your specific dolphin install and admin settings.

$_page['header'] = _t( "_FAQ_H" );
$_page['header_text'] = _t( "_FAQ_H1", $site['title'] );
Take notice of the function this calls:

$_page['header'] = (we want that variable to be set at runtime)

_t( "_FAQ_H" ); This is what we want to set it to: This is actually the language function, it uses the function _t to get the value from the language settings (managed in dolphin admin panel)

For this example - the function _t uses the language entry _FAQ_H -- which means: in the language file there is an item (key) called _FAQ_H with a value that will replace the _FAQ_H at run time.
You will also notice the use of another variable (being passed to the _t function (  $site['title'] ) this is set in the header.inc.php file in your /inc/ directory and references the site title, you chose during install (or later edited when customizing your dolphin site.
Now the server has processed the above and is creating the HTML content to send to your visitors web browser. It still does not have the bulk of the page - the actual content.

Content is created by the PageCompPageMainCode() function.

$_page_cont[$_ni]['page_main_code'] = PageCompPageMainCode();

$_page_cont[$_ni]['page_main_code']  is what we want to replace with the results of the PageCompPageMainCode() function. Which, if you look at the template file you will see it as 
__page_main_code__ -> and notice where it will place those results in a basic HTML structure.

Lets dissect that function for better understanding how to make changes to it and customize your dolphin community to get out of the cookie cutter contents of such an open source application.

function PageCompPageMainCode()
{
global $oTemplConfig;
    $ret = _t( "_FAQ_INFO" );
    return DesignBoxContent(_t( "_FAQ_H1", $site['title'] ), $ret, $oTemplConfig -> PageCompThird_db_num );
}

 $ret = _t( "_FAQ_INFO" ); -- This is setting the $ret (the HTML code we want in the main content of the page) - it gets the _FAQ_INFO value from that key's entry in the language file. and puts it in the variable $ret

Then... we want to put that value into a Design Block on that page....

return DesignBoxContent(_t( "_FAQ_H1", $site['title'] ), $ret, $oTemplConfig -> PageCompThird_db_num );

Here the PHP 'returns' the design box with the header _FAQ_H1, the site title and then (3rd variable) the actual content from the language key. The final setting there PageCompThird_db_num chooses the type of design box -- border, no border etc.

We can cover those in more details in another post - hopefully this will introduce the very basics of manipulating dolphin into a truly customized social community.

Much more to learn as we move forward creating your unique dolphin site.

See you next time.


Wednesday, September 2, 2009

Add/Remove 'Actions' - Dolphin profile view

You can change the options in the actions menu (on the profile view page) by following these simple steps.

Open:
/templates/base/scripts/BxBaseProfileView.php

Find the function:
showBlockActionsMenu()

You will  find within this function are the links. Add and remove links in this area.
BEWARE:: Make sure you keep the code entact, and follow the other links as guides. For instance - one link opens a standard page within the same browser - other links have an OnClick event - which opens a pop up window.

As long as you are careful to add a new link in the exact fashion, or remove a link by taking away the entire line (from $ret .= all the way to and including the semi-colin. ( ; ) - you will be able to completely customize this area of your dolphin community.

Saturday, August 29, 2009

Add Group Delete Function for Dolphin 6.x

OPEN ::
/ group_actions.php
FIND:::

case 'delmem':
if( $arrGroup['creatorID'] == $memberID )
{
$mem = (int)$_REQUEST['mem'];
if( $mem )
{
if( $mem != $memberID )
{
$oGroups->resignGroupMember( $mem, $groupID );
Header( "Location: {$site['url']}grp.php?action=mygroups" );
exit;
}
else
{
$_page['header'] = _t( "_Group member delete error" );
$_page['header_text'] = _t( "_Group member delete error" );
$_page_cont[$_ni]['page_main_code'] = MsgBox(_t( "_You cannot delete yourself from group because you are group creator" ));
}
}
exit;
}
else
{
$_page['header'] = _t( "_Group member delete error" );
$_page['header_text'] = _t( "_Group member delete error" );
$_page_cont[$_ni]['page_main_code'] = MsgBox(_t( "_You cannot delete group member because you are not group creator" ));
}
break;

(AFTER IT...) ADD:

case 'delgrp': // start delete group function
if( $arrGroup['creatorID'] == $memberID )
{
// put delete function here
$sql = "DELETE FROM `Groups` WHERE `ID` = '".$groupID."' ";
db_res ( $sql);
$sql = " DELETE FROM `GroupsGallery` WHERE `groupID` = '".$groupID."' ";
db_res ( $sql) ;
if( $_SERVER['HTTP_REFERER'] )
Header( "Location: {$_SERVER['HTTP_REFERER']}" );
else
Header( "Location: {$site['url']}grp.php" );
exit;
}

else
{
$_page['header'] = _t( "_Group member delete error" );
$_page['header_text'] = _t( "_Group member delete error" );
$_page_cont[$_ni]['page_main_code'] = MsgBox(_t( "_You cannot delete group because you are not group creator" ));
}
break; // end delete group

OPEN :::
/inc/classes/BxDolGroups.php
FIND :::
if ( $aGroupInfo['creatorID'] == $iMemberID ){
$sRetHtml .= $this->genGroupActionBtn( 'Edit group', "{$this->sCurrFile}?action=edit&ID={$iGroupID}" );
}

CHANGE TO :::
if ( $aGroupInfo['creatorID'] == $iMemberID ){
$sRetHtml .= $this->genGroupActionBtn( 'Delete group', "group_actions.php?a=delgrp&ID={$iGroupID}", true );
$sRetHtml .= $this->genGroupActionBtn( 'Edit group', "{$this->sCurrFile}?action=edit&ID={$iGroupID}" );
}

Saturday, August 8, 2009

Automatic Login after Dolphin Join


Many of the dolphin sites I have been involved with, as a freelancer, have requested that the visitor be automatically logged in after they join.

Here is the simple changes needed to log the new member in, automatically after they complete the Dolphin join form.

Open :: /join.php

Find ::

echo _t( '_Join complete' );
echo '
';
echo _t( $sStatusText );

Just above it paste the following:::

// automatically log the user in after join process
$sql = " SELECT * FROM Profiles WHERE `ID` = '".$iMemID."'";
$new_info = db_res( $sql );
$the_user = mysql_fetch_assoc( $new_info );
setcookie( "memberID", $the_user['ID'], 0, '/' );
setcookie( "memberPassword", $the_user['Password'], 0, '/' );
// end auto login


This will log them into the Dolphin community without requesting username and password.




Thursday, August 6, 2009

Adding a page to Dolphin Site.


I have been asked many times "How do I add a new page to my Dolphin Community Site?"

Other than using the Page Builder, in your admin area - which has some limitations, there is another simple way to add a page to your site.

First: Open /faq.php and save it as something new (like detailed_info.php)

Then look for the following code.

function PageCompPageMainCode()
{
global $oTemplConfig;

$ret = _t( "_FAQ_INFO" );


return DesignBoxContent(_t( "_FAQ_H1", $site['title'] ), $ret, $oTemplConfig -> PageCompThird_db_num );
}

Notice the line -> $ret = _t( "_FAQ_INFO" );
<- this tells the dolphin script to get that key from the language table.

Now change the _FAQ_H1 to _MORE_INFO (or anything else you'd like to use, and resave the file.

Go into your dolphin admin area, click on language settings, then Add New and enter the key ( _MORE_INFO (or whatever you named it) and enter the value for each language your site has available.

Done. Now just link to that file, by adding a link to the navigation menu, or anywhere.

Just a quick post and simple instructions, I know - but let me know if you need any further description on how to add a page to your Dolphin web site.

D

Tuesday, August 4, 2009

Dolphin webmasters, worst of the breed!


Freelancing means dealing with 'know-it-all' "webmasters" - in most cases it's the 'weekend-webmaster'. The worst of the breed!

This past weekend, a holiday weekend here in Toronto, I took 2 days off - the Sunday and the Monday. I don't get too many days off in my business, which I guess is a good thing, means I am a busy freelancer.

When I returned to my desk Tuesday morning, I was met with angry emails from a MOD sale, the profile customizer for Dolphin MOD.

Why do these people, who spend on average $120 on mod with me, why do they feel they own me. Where do they get off threatening me with PayPal chargebacks, just because I took a couple of days off - especially when its a HOLIDAY WEEKEND???

I just dont understand these dolphin webmasters - drive a guy nuts! Needless to say, he will not be getting a refund, and his threats of negative feedback, may make there way to the Dolphin community. Frankly - I couldnt care less! More power to him and all the other weekend webmasters before him that resort to threats when I am not immediately available for their emails.

Just had to vent, figured - where better than the blog?

Webmasters should realize that geeks have lives and families too - that we deserve a day or two off from time to time, especially considering the long nights and weekends we usually work for them. For pennies I might add. Perhaps I will change my pricing back to the industry standard - then I might not be so upset over threats resulting from a simple two-day holiday with my family.

Since I rarely take time off -- I wont run into this again for a while, but for gosh sakes! Give a guy a break. A day off from time to time is not that much to ask. Is it?