Custom Fields
Re-Envisioned
Support MB Admin Columns Version 1.50 removed MB_Admin_Columns_User and MB_Admin_Columns_Post classes

  • Creator
    Topic
  • #18716
    Resolved realj42
    Participant

    Hi

    I have been using the recomended technique to extend MB_ADMIN_COLUMNS with my own columns. This has been working fine but has completerly stopped with 1.50 – the following code throws fatal errors now.

       class SHS_Member_Link_Columns extends MB_Admin_Columns_Post {
            public function columns( $columns ) {
                $columns  = parent::columns( $columns );
                $this->add( $columns, 'member', 'Member', 'after', 'title' );
                $this->add( $columns, 'subscription', 'Subscription', 'replace', 'date' );
                // Add more if you want
                return $columns;
            }
            public function show( $column, $post_id ) {
                switch ( $column ) {
                    case 'member':
    

    MB_Admin_Columns_Post is no longer declared, nor MB_Admin_Columns_User
    OK OK I spotted it – now need to extend \MBAC\Post or \MBAC\User and it all works fine – I suggest you update the docs and add something to thje update notes

    Cheers
    Hywel

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #18724
    Brian
    Participant

    This happened to me as well after update. How did you get it working again?

    Thanks in advance

    #18725
    realj42
    Participant

    Brian – just switch to

    class Your_Class extends \MBAC\Post {

    which works fine. If you need to support upgraded and non upgraded environments this should work with 1.50 and pre 1.50

    `if (class_exists('MB_ADMIN_COLUMNS_POST')) {
        class SHS_MBAC extends  MB_ADMIN_COLUMNS_POST {
        }
    } elseif (class_exists('\MBAC\Post')) {
        class SHS_MBAC extends  \MBAC\Post {
        }
    }
    class SHS_Member_Link_Columns extends SHS_MBAC {
        public function columns( $columns ) { `
    
    #18734
    Anh Tran
    Keymaster

    Hi, sorry for this issue. I’ve updated the docs and added to the plugin changelog.

    #18735
    Brian
    Participant

    Hi Anh & realj42 – thanks for providing the fix!

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.