Should we install IP.Shoutbox?
4 members have voted
Here is a little tutorial on how to add a visibility feature for your members in their UserCP.
Step 1: Go to ACP -> Support Tab - SQL Toolbox and run the following SQL:
ALTER TABLE ibf_members ADD showbar TINYINT( 1 ) default 1
Step 2: Go to ACP -> Look & Feel -> Select Skin (You must use every skin you have)
Create a new template bit called: bbarSettingsForm in group: skin_bottombar with the following content:
Also Note That: Once you have created the template bit in ONE skin, every skin has that template bit, you just then need to copy the following into every skin.
<if test="$this->memberData['showbar'] == 0"> <form action='{parse url="app=bottombar" base="public"}' method='post' enctype='multipart/form-data' id='postingform' onsubmit='return ValidateForm()' name='REPLIER'> <input type='hidden' name='module' value='bbarsettings' /> <input type='hidden' name='section' value='settings' /> <input type='hidden' name='cmd' value='showbar' /> <input type='submit' class='input_submit' value='Show The Bottom Bar'/> </form> <else /> <form action='{parse url="app=bottombar" base="public"}' method='post' enctype='multipart/form-data' id='postingform' onsubmit='return ValidateForm()' name='REPLIER'> <input type='hidden' name='module' value='bbarsettings' /> <input type='hidden' name='section' value='settings' /> <input type='hidden' name='cmd' value='hidebar' /> <input type='submit' class='input_submit' value='Hide The Bottom Bar'/> </form> </if>
Step 3: Open up FTP and go to Forums Dir -> admin -> applications_addon -> other -> bottombar -> sources -> hooks.php
Inside that file, Find:
public function getHookOutput() { //----------------------------------------- // Member only //----------------------------------------- if ( ! $this->member->getProperty('member_id') ) { return ''; } //----------------------------------------- // Something to return //----------------------------------------- return $this->registry->output->getTemplate('bottombar')->showBottomBar(); }
Replace All With:
public function getHookOutput() { if ( $this->memberData['showbar'] == 1 ) { //----------------------------------------- // Member only //----------------------------------------- /*if ( ! $this->member->getProperty('member_id') ) { return ''; }*/ //----------------------------------------- // Something to return //----------------------------------------- return $this->registry->output->getTemplate('bottombar')->showBottomBar(); } else { if ( $this->memberData['member_group_id'] == $this->settings['guest_group'] ) { //----------------------------------------- // Member only //----------------------------------------- /*if ( ! $this->member->getProperty('member_id') ) { return ''; }*/ //----------------------------------------- // Something to return //----------------------------------------- return $this->registry->output->getTemplate('bottombar')->showBottomBar(); } else { return; } } }
Step 4: Open up FTP and go to Forums Dir -> admin -> applications_addon -> other -> bottombar -> extensions,
Create a file called: usercpForms.php and copy the below text into that file:
<?php if ( !defined( 'IN_IPB' ) ) { print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files."; exit(); } class usercpForms_bottombar extends public_core_usercp_manualResolver implements interface_usercp { public $tab_name = 'Bottom Bar'; public $defaultAreaCode = 'settings'; public $ok_message = ''; public $hide_form_and_save_button = true; public $uploadFormMax = 0; /** * Initiate this module * * @access public * @return void */ public function init() { } /** * Return links for this tab * You may return an empty array or FALSE to not have * any links show in the tab. * * The links must have 'area=xxxxx'. The rest of the URL * is added automatically. * 'area' can only be a-z A-Z 0-9 - _ * * @access public * @return array array of links */ function getLinks() { $array = array(); $array[] = array( 'url' => 'area=settings', 'title' => 'Bottom Bar', 'active' => $this->request['tab'] == 'bottombar' && $this->request['area'] == 'settings' ? 1 : 0, 'area' => 'settings' ); return $array; } /** * Run custom event * * If you pass a 'do' in the URL / post form that is not either: * save / save_form or show / show_form then this function is loaded * instead. You can return a HTML chunk to be used in the UserCP (the * tabs and footer are auto loaded) or redirect to a link. * * If you are returning HTML, you can use $this->hide_form_and_save_button = 1; * to remove the form and save button that is automatically placed there. * * @access public * @param string Current 'area' variable (area=xxxx from the URL) * @return mixed html or void */ public function runCustomEvent( $currentArea ) { return; } /** * UserCP Form Show * * @access public * @param string Current area as defined by 'get_links' * @param array Errors * @return string Processed HTML */ public function showForm( $current_area, $errors=array() ) { //----------------------------------------- // Where to go, what to see? //----------------------------------------- switch( $current_area ) { default: case 'settings': return $this->showFormSettings(); break; } } /** * UserCP Form Check * * @access public * @param string Current area as defined by 'get_links' * @return string Processed HTML */ public function saveForm( $current_area ) { //----------------------------------------- // Where to go, what to see? //----------------------------------------- } # # Everything above this section are standard, must-have functions # Everything below can be your own specific functions # /** * Show the Settings form * * @access public * @author Matt Mecham * @return string Processed HTML */ public function showFormSettings() { /* Show the form */ return $this->registry->getClass('output')->getTemplate('bottombar')->bbarSettingsForm(); } /** * UserCP Save Form: Settings * * @access public * @param array Array of member / core_sys_login information (if we're editing) * @return mixed Array of errors / boolean true */ public function saveFormSettings( $member=array() ) { return; } }
Step 5: Open up FTP and go to Forums Dir -> admin -> applications_addon -> other -> bottombar -> modules_public,
Create a new folder called: bbarsettings, then create three(3) files called: defaultSection.php, settings.php and a BLANK index.html file
Step 6: Copy the following content into defaultSection.php and save:
<?php if ( ! defined( 'IN_IPB' ) ) { print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files."; exit(); } $DEFAULT_SECTION = 'settings';
Step 7: Copy the following in to settings.php
<?php if ( ! defined( 'IN_IPB' ) ) { print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'."; exit(); } class public_bottombar_bbarsettings_settings extends ipsCommand { /** * Main class entry point * * @access public * @param object ipsRegistry reference * @return void [Outputs to screen] */ public function doExecute( ipsRegistry $registry ) { //----------------------------------------- // What to do? //----------------------------------------- switch($this->request['cmd']) { //----------------------------------------- case 'showbar': $this->showBar(); break; case 'hidebar': $this->hideBar(); break; } } /** * Show The Bottom Bar * * @access public * @author Matt Mecham * @return string Processed HTML */ public function showBar() { $showbar = 1; $this->DB->update( 'members', array('showbar' => $showbar ), "member_id=".$this->memberData['member_id']); $this->registry->output->redirectScreen( 'Bottom Bar Visibility Toggled (Showing)', $this->settings[ 'base_url' ].'app=core&module=usercp&tab=bottombar&area=settings' ); } /** * Hide The Bottom Bar * * @access public * @author Matt Mecham * @return string Processed HTML */ public function hideBar() { $showbar = 0; $this->DB->update( 'members', array('showbar' => $showbar ), "member_id=".$this->memberData['member_id']); $this->registry->output->redirectScreen( 'Bottom Bar Visibility Toggled (Hiding)', $this->settings[ 'base_url' ].'app=core&module=usercp&tab=bottombar&area=settings' ); } }
Step 8: Go to Your UserCP and test the function to see if it is working. If so, you're done with the tutorial and have successfully installed a Member Visibility feature for Bottom Bar Beta 1.
http://videos.tiberiumstudios.net/bottom-bar-visibility/bottom-bar-visibility.htm (Video dimensions: 1600x900 HD)
Good Luck!
Donald
Source: Download: Bottom Bar (Beta 1)
0 Comments
Recommended Comments
There are no comments to display.