Forum Replies Created

Viewing 15 replies - 1 through 15 (of 23 total)
  • Thread Starter llucax

    (@llucax)

    Hi, I installed 1.2 and still getting some notices:

    Notice: Undefined index: administrator in /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/mvb_wp_access.php on line 506
    
    Call Stack:
        0.0001     655696   1. {main}() /home/luca/repos/sca/index.php:0
        0.0002     661160   2. require('/home/luca/repos/sca/wp-blog-header.php') /home/luca/repos/sca/index.php:17
        0.2860   40013488   3. wp() /home/luca/repos/sca/wp-blog-header.php:14
        0.2860   40013704   4. WP->main() /home/luca/repos/sca/wp-includes/functions.php:1567
        0.2928   40118328   5. do_action_ref_array() /home/luca/repos/sca/wp-includes/class-wp.php:504
        0.2928   40119848   6. call_user_func_array() /home/luca/repos/sca/wp-includes/plugin.php:486
        0.2928   40119904   7. mvb_WPAccess->wp_front() /home/luca/repos/sca/wp-includes/plugin.php:0
        0.2929   40119984   8. mvb_WPAccess->checkPostAccess() /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/mvb_wp_access.php:148
    Thread Starter llucax

    (@llucax)

    Thanks!

    Do you have any references on why using @ slow down scripts? Thank you.

    Thread Starter llucax

    (@llucax)

    And here is another patch with more notices silencing:

    commit 1794f3ce48bbd10e72f9ee00cb2bee76527ae95f
    Author: Leandro Lucarella <[email protected]>
    Date:   Sun Aug 28 13:08:55 2011 -0300
    
        AAM: Remove more notice messages
    
    diff --git a/wp-content/plugins/advanced-access-manager/module/class-module_optionmanager.php b/wp-content/plugins/advanced-access-manager/module/class-module_optionmanager.php
    index 0eee5f2..328e757 100644
    --- a/wp-content/plugins/advanced-access-manager/module/class-module_optionmanager.php
    +++ b/wp-content/plugins/advanced-access-manager/module/class-module_optionmanager.php
    @@ -79,7 +79,6 @@ class module_optionManager extends mvb_corePlugin {
         function __construct($curentRole = FALSE, $return = FALSE) {
             global $table_prefix;
    
    -        $this->pObj = $pObj;
             $this->return = $return;
             $this->templObj = new mvb_coreTemplate();
             $templatePath = WPACCESS_TEMPLATE_DIR . 'admin_options.html';
    @@ -285,7 +284,7 @@ class module_optionManager extends mvb_corePlugin {
                     $markers = array(
                         '###role###' => $this->currentRole,
                         '###title###' => $cap,
    -                    '###description###' => htmlspecialchars($capabilitiesDesc[$cap], ENT_QUOTES),
    +                    '###description###' => htmlspecialchars(@$capabilitiesDesc[$cap], ENT_QUOTES),
                         '###checked###' => $this->checkChecked('capability', array($cap)),
                         '###cap_name###' => $m->getCapabilityHumanTitle($cap)
                     );
    @@ -383,21 +382,21 @@ class module_optionManager extends mvb_corePlugin {
             $checked = '';
             switch ($type) {
                 case 'submenu':
    -                if ($this->currentParams[$this->currentRole]['menu'][$args[0]]['sub'][$args[1]] ||
    -                        $this->currentParams[$this->currentRole]['menu'][$args[0]]['whole']) {
    +                if (@$this->currentParams[$this->currentRole]['menu'][$args[0]]['sub'][$args[1]] ||
    +                        @$this->currentParams[$this->currentRole]['menu'][$args[0]]['whole']) {
    
                         $checked = 'checked';
                     }
                     break;
    
                 case 'menu':
    -                if ($this->currentParams[$this->currentRole]['menu'][$args[0]]['whole']) {
    +                if (@$this->currentParams[$this->currentRole]['menu'][$args[0]]['whole']) {
                         $checked = 'checked';
                     }
                     break;
    
                 case 'capability':
    -                if (isset($this->roles[$this->currentRole][capabilities][$args[0]])) {
    +                if (isset($this->roles[$this->currentRole]['capabilities'][$args[0]])) {
                         $checked = 'checked';
                     }
                     break;
    diff --git a/wp-content/plugins/advanced-access-manager/mvb_wp_access.php b/wp-content/plugins/advanced-access-manager/mvb_wp_access.php
    index cc4b82a..474c8be 100644
    --- a/wp-content/plugins/advanced-access-manager/mvb_wp_access.php
    +++ b/wp-content/plugins/advanced-access-manager/mvb_wp_access.php
    @@ -600,7 +600,7 @@ class mvb_WPAccess extends mvb_corePlugin {
          */
    
         function manager_page() {
    -        $m = new module_optionManager($_POST['current_role']);
    +        $m = new module_optionManager(@$_POST['current_role']);
             $m->manage();
         }
    
    diff --git a/wp-content/plugins/advanced-access-manager/module/class-module_user.php b/wp-content/plugins/advanced-access-manager/module/class-module_user.php
    index f0932d5..c0c4fa0 100644
    --- a/wp-content/plugins/advanced-access-manager/module/class-module_user.php
    +++ b/wp-content/plugins/advanced-access-manager/module/class-module_user.php
    @@ -25,7 +25,7 @@ class module_User extends WP_User {
         }
    
         function getCurrentUserRole() {
    -        if (is_array($this->data->{$this->cap_key})){
    +        if ($this->data && is_array($this->data->{$this->cap_key})){
                 $result = array_keys($this->data->{$this->cap_key});
             }else{
                 $result = array();
    Thread Starter llucax

    (@llucax)

    There is another problem I don’t know how to fix:

    Notice: Array to string conversion in /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/core/class-mvb_coretemplate.php on line 109
    
    Call Stack:
        0.0012     892552   1. {main}() /home/luca/repos/sca/wp-admin/users.php:0
        0.0016    1022104   2. require_once('/home/luca/repos/sca/wp-admin/admin.php') /home/luca/repos/sca/wp-admin/users.php:10
        0.3650   49401104   3. do_action() /home/luca/repos/sca/wp-admin/admin.php:151
        0.3651   49403312   4. call_user_func_array() /home/luca/repos/sca/wp-includes/plugin.php:405
        0.3651   49403368   5. mvb_WPAccess->manager_page() /home/luca/repos/sca/wp-includes/plugin.php:0
        0.3661   49731144   6. module_optionManager->manage() /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/mvb_wp_access.php:604
        0.3662   49731448   7. module_optionManager->getMainOptionsList() /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/module/class-module_optionmanager.php:131
        0.3664   49741616   8. module_optionManager->renderMainMenuOptions() /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/module/class-module_optionmanager.php:200
        0.3715   49960904   9. module_optionManager->renderMetaboxList() /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/module/class-module_optionmanager.php:271
        0.3751   50060240  10. mvb_coreTemplate->updateMarkers() /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/module/class-module_optionmanager.php:347
        0.3752   50064032  11. str_replace() /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/core/class-mvb_coretemplate.php:109

    The problem is this function call:
    $template = str_replace($marker, $content, $template);

    $marker is “###args###”, $content is array(“taxonomy” => “category”) (the problematic argument), and $template is some HTML which seems to be a meta box. Same happens with other taxonomies and with other cases where the array has the form array(“box” => 0) (or another integer).

    Another case has $marker == “###callback###” and the $content array in question is huge, is a metabox from Subscribe2 plug-in.

    Thread Starter llucax

    (@llucax)

    Are you trying to prevent warnings so they don’t annoy you?

    Yes I am.

    If so, just add the @ character before the function. Yes, I realize that doesn’t fix the “inherent problem”, just letting you know it’s an option.

    There is no need for that, I already did (and published) a patch to solve all the warning-making problems I found in a proper way (not just silence them).

    I hope this patch can be included in following versions. Do the authors of the plug-in read this forum? If not, do you have any idea on how to contact them?

    Thanks…

    Thread Starter llucax

    (@llucax)

    Here is a patch to silence all the notices I observed. I don’t know if silence them is the right call, maybe they are hiding some bug, but just in case, here is the patch:

    commit 8ad19738348d69b82a317f4a78be6de368dccc12
    Author: Leandro Lucarella <[email protected]>
    Date:   Sat Aug 27 21:54:01 2011 -0300
    
        Advanced Access Manager: silence supposedly harmless notices
    
    diff --git a/wp-content/plugins/advanced-access-manager/module/class-module_filtermenu.php b/wp-content/plugins/advanced-access-manager/module/class-module_filtermenu.php
    index d1f715d..b1cb5e6 100644
    --- a/wp-content/plugins/advanced-access-manager/module/class-module_filtermenu.php
    +++ b/wp-content/plugins/advanced-access-manager/module/class-module_filtermenu.php
    @@ -35,9 +35,9 @@ class module_filterMenu extends module_User {
             $userRoles = $this->getCurrentUserRole();
             if (is_array($userRoles)) {
                 foreach ($userRoles as $role) {
    -                if (is_array($this->cParams[$role]['menu'])) {
    +                if (is_array(@$this->cParams[$role]['menu'])) {
                         foreach ($this->cParams[$role]['menu'] as $main => $data) {
    -                        if ($data['whole'] == 1) {
    +                        if (@$data['whole'] == 1) {
                                 $this->unsetMainMenuItem($main);
                             } elseif (is_array($data['sub'])) {
                                 foreach ($data['sub'] as $sub => $dummy) {
    @@ -64,11 +64,11 @@ class module_filterMenu extends module_User {
    
                     if (is_array($this->cParams[$role]['menu'])) {
                         foreach ($this->cParams[$role]['menu'] as $menu => $sub) {
    -                        if (($sub['whole']) == 1 && ($this->compareMenus($requestedMenu, $menu))) {
    +                        if ((@$sub['whole']) == 1 && ($this->compareMenus($requestedMenu, $menu))) {
                                 return FALSE;
                             }
    
    -                        if (is_array($sub['sub'])) {
    +                        if (is_array(@$sub['sub'])) {
                                 foreach ($sub['sub'] as $subMenu => $dummy) {
                                     if ($this->compareMenus($requestedMenu, $subMenu)) {
                                         return FALSE;
    @@ -171,4 +171,4 @@ class module_filterMenu extends module_User {
    
     }
    
    -?>
    \ No newline at end of file
    +?>
    diff --git a/wp-content/plugins/advanced-access-manager/mvb_wp_access.php b/wp-content/plugins/advanced-access-manager/mvb_wp_access.php
    index 1e41360..cc4b82a 100644
    --- a/wp-content/plugins/advanced-access-manager/mvb_wp_access.php
    +++ b/wp-content/plugins/advanced-access-manager/mvb_wp_access.php
    @@ -49,7 +49,7 @@ class mvb_WPAccess extends mvb_corePlugin {
    
             if (is_admin()) {
    
    -            if ($_GET['page'] == 'wp_access') {
    +            if (@$_GET['page'] == 'wp_access') {
                     parent::__construct(WPACCESS_BASE_URL, WP_PLUGIN_DIR);
                     //css
                     wp_enqueue_style('jquery-ui', WPACCESS_CSS_URL . 'ui/jquery.ui.all.css');
    @@ -380,7 +380,7 @@ class mvb_WPAccess extends mvb_corePlugin {
          */
    
         function wp_print_scripts() {
    -        if ($_GET['page'] == 'wp_access') {
    +        if (@$_GET['page'] == 'wp_access') {
                 parent::scripts();
                 wp_enqueue_script('jquery-ui', WPACCESS_JS_URL . 'ui/jquery-ui.min.js');
                 wp_enqueue_script('wpaccess-admin', WPACCESS_JS_URL . 'admin-options.js');
    @@ -609,4 +609,4 @@ class mvb_WPAccess extends mvb_corePlugin {
     register_activation_hook(__FILE__, array('mvb_WPAccess', 'activate'));
     register_deactivation_hook(__FILE__, array('mvb_WPAccess', 'deactivate'));
     add_action('init', 'init_wpaccess');
    -?>
    \ No newline at end of file
    +?>
    Thread Starter llucax

    (@llucax)

    OK, thank you a bunch!

    Thread Starter llucax

    (@llucax)

    Yes, I have 1.0.

    Since I’ve used the URL + &grab=metaboxes manually, now if I enter the URL again it seems to work and re-grab the metaboxes correctly. I have no idea of what was going on. I have a VCS and nothing in the code changed =/

    Thread Starter llucax

    (@llucax)

    You are very very welcome ??

    Thread Starter llucax

    (@llucax)

    OK, going to the URL of the post and adding &grab=metaboxes to the end of the URL, does grab the metaboxes correctly, so I guess the bug is somewhere there.

    Thread Starter llucax

    (@llucax)

    OK, thanks for the info.

    dumping $wp_meta_boxes there, show all metaboxes (DCF and custom taxonomies metaboxes appear). Weird. I’ll keep investigating…

    Thread Starter llucax

    (@llucax)

    About DCF, if you are scanning for metaboxes looking for the text class=”postbox” in the URL, maybe it’s failing because DCF uses this:

    class=”postbox hide-if-js”

    Custom taxonomies boxes appear as:

    class=”postbox ”

    Thread Starter llucax

    (@llucax)

    Yes, I’ve tried that. BTW, the custom taxonomy metaboxes are not shown in the Advanced Access Manager and they are not even conditional, so that’s even more weird.

    Thread Starter llucax

    (@llucax)

    BTW, it looks like DCF add metaboxes with this action hook:
    add_action( ‘add_meta_boxes’, ‘slt_cf_display_post’, 10, 2 );

    AFAIK 10 is the default priority. One particularity about DCF is that you can show fields only for post with a particular taxonomy term, so fields are conditional to a particular post. But I guess that’s why you can scan for metaboxes using a custom URL, right? How are the metaboxes scanned?

    Thanks again for your time!

    Thread Starter llucax

    (@llucax)

    Right now I’m using custom fields for regular post types. I understand you can’t debug its interaction with your plug-in but for now I’m not a position where I can switch.

    About custom taxonomies, I’m using WP API directly, I’m registering the new taxonomies using an “init” action in my theme, without using an explicit priority. Should I change the priority? Should I register them in another action hook?

    Thanks!

Viewing 15 replies - 1 through 15 (of 23 total)