solved Little Help With Config Settings

Dazed
Dazed
@dazed
8 years ago
1,022 posts
I am working on a possible conversion from ProJam to Audio Pro. I am trying to move some of the config settings over from PJ and it is not displaying correctly in the skin global config. Any ideas what is wrong?

    // Favorite Song ID
    $_tmp = array(
        'name'     => 'favorite_song',
        'type'     => 'text',
        'default'  => '',
        'validate' => 'not_empty',
        'label'    => 'Favorite Song',
        'help'     => 'Some Helpful Info.',
        'order'    => 8
    );
    jrCore_register_setting('NewSkin',$_tmp);

updated by @dazed: 03/09/17 12:39:05PM
michael
@michael
8 years ago
7,719 posts
Looks fine.
Dazed
Dazed
@dazed
8 years ago
1,022 posts
Yeah it is a virtual copy and past from PJ just changing the skin name. Here is the full file.My addition is at the bottom. The blog_profile does not display in the config.

<?php
/**
 * Jamroom MixAP skin
 *
 * copyright 2003 - 2016
 * by The Jamroom Network
 *
 * This Jamroom file is LICENSED SOFTWARE, and cannot be redistributed.
 *
 * This Source Code is subject to the terms of the Jamroom Network
 * Commercial License -  please see the included "license.html" file.
 *
 * This module may include works that are not developed by
 * The Jamroom Network
 * and are used under license - any licenses are included and
 * can be found in the "contrib" directory within this skin.
 *
 * This software is provided "as is" and any express or implied
 * warranties, including, but not limited to, the implied warranties
 * of merchantability and fitness for a particular purpose are
 * disclaimed.  In no event shall the Jamroom Network be liable for
 * any direct, indirect, incidental, special, exemplary or
 * consequential damages (including but not limited to, procurement
 * of substitute goods or services; loss of use, data or profits;
 * or business interruption) however caused and on any theory of
 * liability, whether in contract, strict liability, or tort
 * (including negligence or otherwise) arising from the use of this
 * software, even if advised of the possibility of such damage.
 * Some jurisdictions may not allow disclaimers of implied warranties
 * and certain statements in the above disclaimer may not apply to
 * you as regards implied warranties; the other terms and conditions
 * remain enforceable notwithstanding. In some jurisdictions it is
 * not permitted to limit liability and therefore such limitations
 * may not apply to you.
 *
 * Jamroom MediaPro Skin
 * @copyright 2003 - 2016 by The Jamroom Network - All Rights Reserved
 */

// make sure we are not being called directly
defined('APP_DIR') or exit();

/**
 * MixAP_skin_config
 */
function MixAP_skin_config(){
    $styles = array('light', 'dark');
    $titles = array('Style','On Sale','Featured Artists', 'Charts');

    // Style
    $_tmp = array(
        'name'     => "style",
        'type'     => 'select',
        'default'  => 'light',
        'options'  => $styles,
        'validate' => 'printable',
        'label'    => "Skin Style",
        'help'     => "Media Pro includes an alternative dark style.",
        'section'  => $titles[0],
        'order'    => 0,
    );
    jrCore_register_setting('MixAP', $_tmp);




    foreach (range(1, 3) as $num) {
        // On Sale IDs
        $_tmp = array(
            'name'     => "list_{$num}_active",
            'type'     => 'checkbox',
            'default'  => 'on',
            'validate' => 'onoff',
            'label'    => "List Active",
            'help'     => 'If you have the payment processor, like of our Foxycart module, you may require a price for songs in this list.',
            'order'    => ($num * 10) + 1,
            'section'  => $titles[$num]
        );
        jrCore_register_setting('MixAP', $_tmp);

        if ($num == 3) {
            $days = array('1' => '1', '7' => '7','14' => '14','30' => '30','365' => '365');

            // Style
            $_tmp = array(
                'name'     => "chart_days",
                'type'     => 'select',
                'default'  => '30',
                'options'  => $days,
                'validate' => 'printable',
                'label'    => "Chart Days",
                'help'     => "Enter the range of days your chart will calculate. it will show the top 17 Tracks.",
                'section'  => $titles[$num],
                'order'    => ($num * 10) + 2,
            );
            jrCore_register_setting('MixAP', $_tmp);
        }
        else {
            // Featured Artist IDs
            $_tmp = array(
                'name'     => "list_{$num}_ids",
                'type'     => 'text',
                'default'  => '',
                'validate' => 'printable',
                'label'    => "$titles[$num] IDs",
                'help'     => 'If you would like to choose which items appear on this list, enter the item IDs for those items. Separate entries by commas.',
                'order'    => ($num * 10) + 2,
                'section'  => $titles[$num]
            );
        }

        jrCore_register_setting('MixAP', $_tmp);

        // On Sale IDs
        $_tmp = array(
            'name'     => "require_price_{$num}",
            'type'     => 'checkbox',
            'default'  => 'off',
            'validate' => 'onoff',
            'label'    => "Require Price",
            'help'     => 'If you have the payment processor, like of our Foxycart module, you may require a price for songs in this list. If this box is check soundcloud items will NOT be listed.',
            'order'    => ($num * 10) + 3,
            'section'  => $titles[$num]
        );

        jrCore_register_setting('MixAP', $_tmp);

        // On Sale IDs
        $_tmp = array(
            'name'     => "list_{$num}_soundcloud",
            'type'     => 'checkbox',
            'default'  => 'on',
            'validate' => 'onoff',
            'label'    => "Show SoundCloud",
            'help'     => 'With this box checked SoundCloud items will appear in this list. Note that if require price is checked it will override this setting.',
            'order'    => ($num * 10) + 4,
            'section'  => $titles[$num]
        );
        jrCore_register_setting('MixAP', $_tmp);
    }





    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    $_tmp = array(
        'name'     => 'auto_play',
        'default'  => 'off',
        'type'     => 'checkbox',
        'validate' => 'onoff',
        'required' => 'on',
        'label'    => 'Auto Play',
        'help'     => 'If this box is checked your players will play when loaded.',
        'order'    => 210,
        'section'  => 'Settings'
    );
    jrCore_register_setting('MixAP',$_tmp);

    // Forum Profile
    $_tmp = array(
        'name'     => 'forum_profile',
        'default'  => '',
        'type'     => 'text',
        'validate' => 'url',
        'label'    => 'Forum Profile URL',
        'sublabel' => 'Check the help section.',
        'help'     => 'If you have a Site Forum, enter the <b>Full URL</b> to the forum (usually the site admin Profile URL)<br><br><b>Note:</b> If you are using Site Builder, add the Discussion Link via the Site Builder menu manager',
        'section'  => 'Settings',
        'order'    => 213,
    );
    jrCore_register_setting('MixAP', $_tmp);


    // Social Media
    $num = 220;
    foreach (array('twitter', 'facebook', 'google', 'youtube', 'linkedin') as $network) {

        // App Store URL
        $_tmp = array(
            'name'     => "{$network}_url",
            'type'     => 'text',
            'default'  => '#',
            'validate' => 'printable',
            'label'    => ucfirst($network) . " page",
            'help'     => "If you have an account for your site on " . ucfirst(str_replace('_', ' ', $network)) .", enter the page url.  Enter 0 to disable.",
            'order'    => $num++,
            'section'  => 'social networks'
        );
        jrCore_register_setting('MixAP', $_tmp);
    }

	    // Blog Profile ID
    $_tmp = array(
        'name'     => 'blog_profile',
        'type'     => 'text',
        'default'  => '1',
        'validate' => 'not_empty',
        'label'    => 'Blog Profile',
        'help'     => 'By default the admin blog is used to show site news - set this profile_id to a valid profile_id if you want to use a different profile for blogs.',
        'order'    => 9
    );
    jrCore_register_setting('MixAP', $_tmp);
    return true;
}

michael
@michael
8 years ago
7,719 posts
Maybe add a 'section' => 'social networks' since it seams like one skin has sections, the other doesn't. Could be the issue.
Dazed
Dazed
@dazed
8 years ago
1,022 posts
Michael how do I get the below on a new tab? Projam just had these all on the same page. Audio Pro has tabs which is a lot cleaner.

    // Favorite Song ID
    $_tmp = array(
        'name'     => 'favorite_song',
        'type'     => 'text',
        'default'  => '',
        'validate' => 'not_empty',
        'label'    => 'Favorite Song',
        'help'     => 'Some Helpful Info.',
        'order'    => 8
    );
    jrCore_register_setting('NewSkin',$_tmp);


updated by @dazed: 12/08/16 05:59:57PM
michael
@michael
8 years ago
7,719 posts
Depends what you want the tab to be called
    // Favorite Song ID
    $_tmp = array(
        'name'     => 'favorite_song',
        'type'     => 'text',
        'default'  => '',
        'validate' => 'not_empty',
        'label'    => 'Favorite Song',
        'help'     => 'Some Helpful Info.',
        'order'    => 8,
       'section' => 'SOME TAB NAME',
    );
    jrCore_register_setting('NewSkin',$_tmp);
Dazed
Dazed
@dazed
8 years ago
1,022 posts
Call it Hail Mary and I will change it hehe. Favorite Song would be fine. :)
michael
@michael
8 years ago
7,719 posts
Then:
    // Favorite Song ID
    $_tmp = array(
        'name'     => 'favorite_song',
        'type'     => 'text',
        'default'  => '',
        'validate' => 'not_empty',
        'label'    => 'Favorite Song',
        'help'     => 'Some Helpful Info.',
        'order'    => 8,
       'section' => 'Hail Mary',
    );
    jrCore_register_setting('NewSkin',$_tmp);
Dazed
Dazed
@dazed
8 years ago
1,022 posts
I completely missed the section on there. You rock Michael.
Dazed
Dazed
@dazed
8 years ago
1,022 posts
Michael one last question. I have the below working but when I entered a value for "favorite_artsist" the gui shows another AOTM field upon save. I am not sure why once i added a value, I had the option to add a second AOTM value. The "AOTM Song ID" however still shows only 1 field when populated.

Any ideas?

Thanks


	// AOTM
    $_tmp = array(
        'name'     => 'favorite_artist',
        'type'     => 'text',
        'default'  => '',
        'validate' => 'not_empty',
        'label'    => 'AOTM',
        'help'     => 'Enter the artist ID you want to show in the Favorite Artist section on the index page.',
		'section'  => 'AOTM',
        'order'    => 0
    );
    jrCore_register_setting('MixAP',$_tmp);
	
    // AOTM
    $_tmp = array(
        'name'     => 'favorite_song',
        'type'     => 'text',
        'default'  => '',
        'validate' => 'not_empty',
        'label'    => 'AOTM Song ID',
        'help'     => 'Enter the song ID you want to show in the Favorite Song section on the index page.',
		'section' => 'AOTM',
        'order'    => 0

    );
    jrCore_register_setting('MixAP',$_tmp);
michael
@michael
8 years ago
7,719 posts
Not understanding the question. You have 2 fields added, 2 fields show up. Whats the problem?

Run the integrity check. ( could be that you changed a name, then deleted the code expecting that would delete the field, it won't. Fields are stored in the database once created. )
Dazed
Dazed
@dazed
8 years ago
1,022 posts
The check is running but this is what is displaying:
Dazed
Dazed
@dazed
8 years ago
1,022 posts
No change after integrity check w/all options set.
michael
@michael
8 years ago
7,719 posts
Use Firebug to see what the ID's of those fields are. guessing they are differently named. If they are you'll need to go into the DB and remove the one you dont want from the jr_jrcore_setting table.

Modules write settings to the database, once they are written, they are there, so if you change the name of the setting you've registered, it re-registers as a different thing, it doesnt delete the old setting name.
Dazed
Dazed
@dazed
8 years ago
1,022 posts
ok thanks. This is on my dev site so should not be an issue. Much appreciated.
michael
@michael
8 years ago
7,719 posts
You can also do this if you know the name:
jrCore_delete_setting('jrPoll', 'self_voting');

It will work in the same way that
jrCore_register_setting('MixAP',$_tmp);
worked to ADD the setting, that function by itself will delete the unwanted setting. thats probably easier once you know the name.