Jamroom Logo Jamroom 5 Core
is now Open Source!
User Support Forum Archive (Read Only)
User Site Design, Integration and Customization:
Selectbox for switching artist profiles
Bloodcrave



Joined: 05 Jan 2008
Posts: 748

Posted: 04/23/12 08:11 
Hi,

I want to make a selectbox in the control panel where you can switch to an other artist profile.
e.g: If i select "Artist A" in the selectbox It will switch direct to their 'control panel'.

Now you can only switch artist profiles via: Artists -> Select Artist -> choose artist -> select.

I want to make it easier for power users and users with multiple artists accounts by creating a selectbox in the header of their cp where they can select the active artist profile.

But, I don't know where to start. Which functions and variables do I need etc?
How can I use the selectbox html code with the if/else statements etc.

Back to top
Bloodcrave



Joined: 05 Jan 2008
Posts: 748

Posted: 04/23/12 09:01 
After some research on the web:


Code
{html_options name=switch options=$userArtists selected=$userArtist}



Code
<?php
$smarty->assign('userArtists', array(
                                Artist ID? => '$BAND_NAME',
                                Artist ID? => '$BAND_NAME',
                                Artist ID? => '$BAND_NAME')
                                );
$smarty->assign('userArtist', Artist ID?);
?>


Not sure what 'Artist ID?' needs to be and if the $BAND_NAME is correct.

Back to top
Michael
Jamroom Team


Joined: 22 Apr 2008
Posts: 3423
Location: Tokyo

Posted: 04/23/12 19:08 
If it was me, i wouldnt be using that {html_options becasue i dont know what it does. it might be perfect, but i've never used it.

I would do something like this in the templates:

Code

 {apModuleName_util mode="get_allowed_bands" assign="ALLOWED_BANDS"}
                            <select size="10" name="change_band_id">
                            {foreach from=$ALLOWED_BANDS item="_b"}
                                <option value="{$_b.band_id}">{$_b.band_name}</option>
                            {/foreach}
                            </select>


then in the module smarty custom function do somthing like this

Code
function smarty_function_apModuleName_util($params, &$smarty) {
    global $_user, $jamroom_db;
    switch ($params['mode']) {
        /**
         * get_allowed_bands() is used to get all the bands that this user is allowed to change to.
         */
        case'get_allowed_bands':
            $sql  = "SELECT *
                      FROM {$jamroom_db['band_info']} ";
            $rows = dbQuery($sql, 'NUMERIC');
            $smarty->assign($params['assign'], $rows);
            break;
    }
}


then just change the get_allowed_bands function to return only the bands that this $_user is allowed to access and you should be good.


_________________
Michael Ussher
Jamroom Network Team Member: http://www.jamroom.net
Priority Support: http://www.jamroom.net/Support_Center
Back to top
Bloodcrave



Joined: 05 Jan 2008
Posts: 748

Posted: 04/24/12 00:56 
Thanks for your reply!

I'll take a look a it today.

The html_options smarty functions will have this output:

Code
<select name="switch">
<option label="Band name" value="Artist ID?">Band name</option>
<option label="Band name" value="Artist ID?">Band name</option>
<option label="Band name" value="Artist ID?">Band name</option>
</select>


Back to top
Display posts from previous:   
User Support Forum Archive (Read Only)
User Site Design, Integration and Customization

 
Solutions
• Social Media Platform
• Social Networking Software
• Musician Website Manager
• Community Builder
Products
• Jamroom Core
• Jamroom Addons
• Jamroom Modules
• Jamroom Marketplace
Support
• Support Forum
• Documentation
• Support Center
• Contact Support
Community
• Community Forum
• Member Sites
• Developers
Company
• About Us
• Contact Us
• Privacy Policy
©2003 - 2010 Talldude Networks, LLC.