public function restore()
    {
        if (!userHasPermission('admin:blog:post:' . $this->blog->id . ':restore')) {

            unauthorised();
        }

        // --------------------------------------------------------------------------

        //  Fetch and check post
        $iPostId = (int) $this->uri->segment(6);

        // --------------------------------------------------------------------------

        if ($this->blog_post_model->restore($iPostId)) {

            $oPost = $this->blog_post_model->getById($iPostId);

            $this->session->set_flashdata('success', ucfirst($this->data['postName']) . ' was restored successfully.');

            //  Update admin changelog
            $this->oChangeLogModel->add(
                'restored',
                'a',
                'blog post',
                $iPostId,
                $oPost->title,
                'admin/blog/post/create/' . $this->blog->id . '/' . $iPostId
            );

        } else {

            $sStatus   = 'error';
            $sMessage  = 'I failed to restore that ' . $this->data['postName'] . '. ';
            $sMessage .= $this->blog_post_model->lastError();
            $this->session->set_flashdata($sStatus, $sMessage);
        }

        redirect('admin/blog/post/index/' . $this->blog->id);
    }
public function restore()
    {
        if (!userHasPermission('admin:blog:post:' . $this->blog->id . ':restore')) {

            unauthorised();
        }

        // --------------------------------------------------------------------------

        //  Fetch and check post
        $iPostId = (int) $this->uri->segment(6);

        // --------------------------------------------------------------------------

        if ($this->blog_post_model->restore($iPostId)) {

            $oPost = $this->blog_post_model->getById($iPostId);

            $this->session->set_flashdata('success', ucfirst($this->data['postName']) . ' was restored successfully.');

            //  Update admin changelog
            $this->oChangeLogModel->add(
                'restored',
                'a',
                'blog post',
                $iPostId,
                $oPost->title,
                'admin/blog/post/create/' . $this->blog->id . '/' . $iPostId
            );

        } else {

            $sStatus   = 'error';
            $sMessage  = 'I failed to restore that ' . $this->data['postName'] . '. ';
            $sMessage .= $this->blog_post_model->lastError();
            $this->session->set_flashdata($sStatus, $sMessage);
        }

        redirect('admin/blog/post/index/' . $this->blog->id);
    }
public function restore ( ) { if ( ! userHasPermission ( 'admin:blog:post:' . $ this -> blog -> id . ':restore' ) ) { unauthorised ( ) ; } // -------------------------------------------------------------------------- //  Fetch and check post $ iPostId = ( int ) $ this -> uri -> segment ( 6 ) ; // -------------------------------------------------------------------------- if ( $ this -> blog_post_model -> restore ( $ iPostId ) ) { $ oPost = $ this -> blog_post_model -> getById ( $ iPostId ) ; $ this -> session -> set_flashdata ( 'success' , ucfirst ( $ this -> data [ 'postName' ] ) . ' was restored successfully.' ) ; //  Update admin changelog $ this -> oChangeLogModel -> add ( 'restored' , 'a' , 'blog post' , $ iPostId , $ oPost -> title , 'admin/blog/post/create/' . $ this -> blog -> id . '/' . $ iPostId ) ; } else { $ sStatus = 'error' ; $ sMessage = 'I failed to restore that ' . $ this -> data [ 'postName' ] . '. ' ; $ sMessage .= $ this -> blog_post_model -> lastError ( ) ; $ this -> session -> set_flashdata ( $ sStatus , $ sMessage ) ; } redirect ( 'admin/blog/post/index/' . $ this -> blog -> id ) ; }
Restore a blog post
@return void
Restore a blog post