Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GS Custom Settings [v0.6.2]
(2015-10-27, 22:19:48)Oleg06 Wrote: I checked on two different servers hosting with Apache, the problem is everywhere.
as if stops working checkbox plugin I18N Custom Fields.

I can just hide the link to deactivate the plugin Smile

Eureka! (maybe).. You know that if you deactivate GS Custom Settings, and have GS Custom Settings code in the Special Page templates, PHP will throw a function undefined error if it encounters calls to any of the plugin's functions (which could indeed result in a broken lay-out).
Reply
special page code looks like this
Code:
<div class="post">
    <div class="row">
        <div class="<?php if(return_custom_field('full')=='on') { ?><?php if (return_special_field('block')) { ?>col-md-6<?php } else { ?>col-md-12<?php } ?><?php } else { ?>col-md-12<?php } ?>">
            <?php get_special_field('content'); ?>
<?php if(return_special_field('goodshare')=='on') { ?>
    <?php if (return_setting('share_setting','goodshare-use_setting')) { ?>
        <?php get_component('goodshare'); ?>
    <?php } ?>
<?php if (return_setting('share_setting','sharethis-use_setting')) { ?>
    <?php if (return_setting('share_setting','sharethis_setting','value') === 1) { ?>
        <?php get_component('sharethis-gor'); ?>
    <?php } ?>
<?php } ?>
<?php if (return_setting('share_setting','shareeasy-use_setting')) { ?>
    <?php get_component('shareeasy'); ?>
<?php } ?>
<?php } ?>
        </div>
<?php if (return_special_field('block')) { ?>
        <div class="<?php if(return_custom_field('full')=='on') { ?>col-md-6<?php } else { ?>col-md-12<?php } ?>">
            <div class="extra">
           <?php get_special_field('block','',true); ?>
           </div>
        </div>
<?php } ?>
    </div>
</div>
<?php if(return_special_field('team')=='on') { ?>
<!--.team -->
<h2><?php get_special_field('title1','',false); ?></h2>
<div class="row">
<div class="all-carousels owl-carousel owl-theme">
<?php get_i18n_search_results(array('tags'=>'_special_team-member', 'DATE_FORMAT'=>'', 'max'=>99, 'i18n'=>0, 'numWords'=>'-1', 'order'=>'+created','showPaging'=>0,'HEADER'=>'')); ?>
</div>
</div>
    <?php } ?>                
<!--.team -->
and stops working here this part of the code
if(return_custom_field('full')=='on')

since I'm not an expert in php, it may be an error on my part
Reply
I disabled your plugin, the error is this
Code:
[28-Oct-2015 00:58:31 Europe/Moscow] PHP Fatal error:  Call to undefined function return_setting() in /home/cp893527/public_html/vse-nozhi.ru/0/theme/Building/template.php on line 17
no other errors
line 17
Code:
if (return_setting('site_settings','large-menu_setting')) { include('header2.inc.php'); } else { include('header.inc.php'); }
Reply
Haha well it's not an error really. It's normal that you can't use the plugin's functions when it is deactivated. 
Ofc. if you use GS Custom Settings in theme dev, then it is a requirement that the plugin is activated.  

JFYI if you want to provide the user 3 options for share bars or something but only 1 should be used at a time, you might want to consider a radio type setting instead of 3 checkboxes.

Your code could be reduced in size by 75%, see below.

Example of usage:

PHP Code:
<?php 
// share_setting tab has a checkbox setting to enable share bars ('enable_shares') and 
// a setting to select a share bar ('share_choice') with options: 
// [(0) 'goodshare', (1) 'sharethis-gor', (2) 'shareeasy']

   
if (return_setting('share_setting''enable_shares')) {
      
// calling get_setting with 3rd param false RETURNS the TEXT value of the selected option
      
$sharebar get_setting('share_setting''share_choice'false);
 
     get_component($sharebar); 
   }
?>
Reply
I have every species has its own settings
http://prntscr.com/8w3ork
Reply
(2015-10-28, 09:48:50)Oleg06 Wrote: I have every species has its own settings
http://prntscr.com/8w3ork

Sure, do as suits you best.
BTW if you don't want users to see the </> code tags, in your data file you can add the enableCodeDisplay property and set it to 'false'. If you specify a default property on settings, and add the enableReset property to the tab, users can hit a Reset button and the setting values will be set to the defaults.

Code:
    "tab": {
        "lookup": "my_tab",
        "label": "My tab",
        "enableCodeDisplay": false,
        "enableReset": true
    },
    "settings": [
        {
        "lookup": "sharethis_usesetting",
        "label": "Use the Share This",
        "type":"checkbox",
        "default": true
        }
    ]
Reply
thanks for the tip
Reply
(2015-10-27, 09:38:36)Oleg06 Wrote: I noticed one oddity
http://youtu.be/BHZwRkOKZls?hd=1
when you deactivate/activate your plugin for some reason stop working plugin I18N Special Pages or I18N Custom Fields
Sorry, this garbage comes when disconnecting any plugin Smile
I try just change the code
Reply
(2015-10-30, 05:44:21)Oleg06 Wrote:
(2015-10-27, 09:38:36)Oleg06 Wrote: I noticed one oddity
http://youtu.be/BHZwRkOKZls?hd=1
when you deactivate/activate your plugin for some reason stop working plugin I18N Special Pages or I18N Custom Fields
Sorry, this garbage comes when disconnecting any plugin Smile
I try just change the code
I found a solution to your problem by replacing the code
Code:
<?php if(return_custom_field('full')=='on') { ?>
with this code
Code:
<?php if (returnPageField(return_page_slug(),'full')=='on') { ?>

again sorry for the trouble
Reply
GS Custom Settings 0.6.2 released

Big bugfix release:

Code:
05/11/2015 - V. 0.6.2 (Bugfix)

New:
 - Keyboard shortcut Ctrl + S to save settings
 - Backups of settings are now saved to backups/other/custom_settings
Bugfixes:
 - Fixed: Minor JS error when changing setting type from 'section-title' to something else
 - Fixed: Save button doesn't record a change when a property is not in the cached data
 - Fixed: Checking for changes compared only to data on first load (now refresh after every save)
 - Fixed: FontAwesome library icons (upgraded to 4.4.0) & cleaned from corruption
 - Fixed: sidebar toggle for lookup/ label editing not showing up
 - Fixed: 'expanded' property shouldn't be saved to data output
 - Fixed: bugs with multilingual settings
 - Fixed: bugs with editing permission
 - Fixed: Litespeed server doesn't update JSON content on save with x-www-urlencoded content-type
 - Fixed: PHP non-object notice when admin.xml missing
 - Fixed: Switch setting display in Manage mode showed as checkbox
 - Fixed: Color Setting not updating when using color picker
 - Fixed: Search works cross-tab again
 - Fixed: broken datepicker display when imanager activated
 - Fixed: import/export bugs: incompatible export format for 'all' site tabs;
  - Fixed: tab list not updating on import in manage mode (both since 0.6)

(@0leg let me know if this setup breaks on litespeed, I had to revert some changes)
Reply
V 0.7 roadmap
  • Simplified/ more customizable import/export (check what you'd like to include), and standardized export format.
  • New PHP function for returning an entire tab's settings
  • PHP internal simplifications
  • New setting: link (with site pages dropdown or external)
  • Documentation updates
Reply
this setup breaks on litespeed
Reply
(2015-11-06, 19:07:33)Oleg06 Wrote: this setup breaks on litespeed

Hey 0leg, thanks.

I think I figured out the problem. With x-www-url-form-encoded header in a GET req. data is sent as a URL query string. However Litespeed servers (and Windows too) have URL request length limits at approx.  8192 bytes. As the entire settings' data is passed in GS Custom Settings, this is very likely to be bigger than the request length limit. Plus, because Cyrillic chars are multi-byte, the file is quickly heavier. I just tested your export in a string-to-byte converter, and it's at 44.000 bytes, so your server probably blocks the request.

(Another possible cause, check that php.ini post_max_size is > 1MB)

Documentation on this is hard to find, so I can't promise anything. Could you test the patch in attachment (extract to plugins folder) and tell me specifically if (1) the data loads on the screen, and (2)  if the data gets saved (modify some values & reload).


Attached Files
.zip   custom_settings_0.6.2_ajax_patch.zip (Size: 44.57 KB / Downloads: 2)
Reply
in my php.ini there is no such code post_max_size
nothing works and is not saved Smile
I rented Apache to work with your plugin
Reply
(2015-11-07, 09:47:28)Oleg06 Wrote: in my php.ini there is no such code post_max_size
nothing works and is not saved Smile
I rented Apache to work with your plugin


Ok, but I think your problems indicate that I'm doing something wrong that might cause trouble later on all servers.. 
Could you try once more with the attachment in this post and tell me results?


.zip   custom_settings_0.6.2_ajax_patch2.zip (Size: 46.15 KB / Downloads: 3)
Reply
all still
Reply
I can not use this tag for links in the description
Code:
<?php get_site_url(); ?>
http://prntscr.com/93wnzo
http://prntscr.com/93wodo
Reply
(2015-11-18, 06:34:39)Oleg06 Wrote: I can not use this tag for links in the description

Code:
<?php get_site_url(); ?>
http://prntscr.com/93wnzo
http://prntscr.com/93wodo

Nope, that's impossible. The plugin does all with Javascript, so PHP doesn't get parsed.
You can use HTML/JS, but can't use PHP in the value fields either, you'll need a plugin like Dynpages for that.

Workarounds: 
- Go to Settings and copy site link from there.
- Create a GS Custom Settings plugin (a bit overkill)
Reply
Hello!
All can be done checkbox on the page "plugins" to show or hide block https://yadi.sk/i/9pd_hr4BjcrFd ?
This option is very necessary!
Thank you!
I use machine translation. Forgive my errors.
Reply
(2015-11-18, 17:23:30)gslexx Wrote: Hello!
All can be done checkbox on the page "plugins" to show or hide block https://yadi.sk/i/9pd_hr4BjcrFd ?
This option is very necessary!
Thank you!

Hi gslexx, you can't hide the full block. You can only hide the 'Edit' button.

If you use MultiUser plugin: 
  1. click the user you want to hide the button for; 
  2. scroll to 'Denied permissions' title, and check GS Custom Settings
  3. now the user will not see the 'Edit' button
Without Multiuser plugin:
  1. find the user in data/users/user.xml and add a node <KO_EDIT>FALSE</KO_EDIT
  2. now the user will not see the 'Edit' button
You can also find this info in the documentation.

I'm not going to hide the full bar as I have argued before against it.

If you really want to completely hide the nav, open plugins/custom_settings.php, and find the line // GS Hooks.
Under that paste the following code:

PHP Code:
$restricted_users = array('my_user1''my_user2');

if (@
$_GET['id'] === 'custom_settings')
  
add_action('header''restrict_GSCS_nav_access', array($restricted_users));

function 
restrict_GSCS_nav_access($for_users)
{
  global 
$USR
  if (
array_search($USR$for_users) > -1)
    echo 
'<style>.edit-nav { display: none !important; }</style>';


In $restricted_users, include all user names that should not be able to see the nav.
Reply
(2015-11-18, 17:23:30)gslexx Wrote: Hello!
All can be done checkbox on the page "plugins" to show or hide block https://yadi.sk/i/9pd_hr4BjcrFd ?
This option is very necessary!
Thank you!

Use plugin Custom Admin CSS 


Code:
.invisible-input-container {
   display:none !important;
}
#cs-help {
   display:none !important;
}
[data-bind*="toggleMode"] {
   display:none !important;
}
Reply
Thanks for the tips, I will try!
And the customer has "edited" settings! )))
I use machine translation. Forgive my errors.
Reply
Hi!
I noticed error:
If it was a text field, and then we change its image - the settings are not saved, and the file is written:
"value": "",
"i18n": [
'"
]
I use machine translation. Forgive my errors.
Reply
(2015-11-24, 04:48:16)gslexx Wrote: Hi!
I noticed error:
If it was a text field, and then we change its image - the settings are not saved, and the file is written:
"value": "",
"i18n": [
'"
]

Hey gslexx. 
Thanks for reporting, you are right - although it seems to be an issue with the image input - it just doesn't save.
I will fix this in next release. I've also noticed another bug with reverting an i18n input back to regular text input.
Reply
hi there,

i tried to install gs custom settings to a new installation with the following result: See attachment.

Any idea?

Thank you.


Attached Files Thumbnail(s)
   
Reply




Users browsing this thread: 2 Guest(s)