Support » Plugin: WP Dev Dashboard » No longer working with new support forums

  • Resolved Greg Ross

    (@gregross)


    Since the support forums on wordpress.org were upgraded a while ago, WP Dev Dashboard no longer works.

    This is because it parses the HTML DOM of the support pages and support.wordpress.org moved from <table>s to <div>/<li>/<ul>s which breaks the parser.

    To fix it again, edit the following file:

    “[your WP plugins dir]/wp-dev-dashboard/admin/class-wp-dev-dashboard-admin.php”

    Line 948 will be the following function:

    
    	public function get_unresolved_tickets_for_page( $plugin_theme_slug, $ticket_type = 'plugins', $page_num ) {
    
    		$html = $this->get_page_html( $plugin_theme_slug, $page_num, $ticket_type );
    
    		$html = str_get_html( $html );
    
    		$table = $html->find( 'table#latest', 0 );
    
    		// Return false if no table is found.
    		if ( empty ( $table ) ) {
    			return false;
    		}
    
    		// Remove thead row.
    		$table->find( 'tr', 0 )->outertext = '';
    
    		// Generate array of row data.
    		$rows = $table->find( 'tr' );
    		$rows_data = array();
    
    		foreach ( $rows as $row ) {
    
    			/**
    			 * Make sure not to include any empty rows, which can also
    			 * arise as a result of manually omitting a row via the
    			 * following code: $row->outertext = '';
    			 */
    			if ( empty ( $row->outertext ) ) {
    				continue;
    			}
    
    			// Get row attributes.
    			$link = $row->find( 'a', 0 );
    			$time = $row->find( 'small', 0 );
    
    			$row_data['href'] = $link->href;
    			$row_data['text'] = $link->innertext;
    			$row_data['time'] = $time->innertext;
    			$row_data['status'] = ( strpos( $row->class, 'resolved') !== false ) ? 'resolved' : 'unresolved';
    
    			$rows_data[] = $row_data;
    
    		}
    
    		return $rows_data;
    
    	}
    

    Replace it with:

    
    	public function get_unresolved_tickets_for_page( $plugin_theme_slug, $ticket_type = 'plugins', $page_num ) {
    
    		$html = $this->get_page_html( $plugin_theme_slug, $page_num, $ticket_type );
    
    		$html = str_get_html( $html );
    			
    		$table = $html->find( 'li[class=bbp-body]', 0 );
    
    		// Return false if no table is found.
    		if ( empty ( $table ) ) {
    			return false;
    		}
    
    		// Generate array of row data.
    		$rows = $table->find( 'ul[class=topic]' );
    		$rows_data = array();
    
    		foreach ( $rows as $row ) {
    			// Get row attributes.
    			$link = $row->find( 'li[class=bbp-topic-title]', 0 )->find( 'a', 0 );
    			$time = $row->find( 'li[class=bbp-topic-freshness]', 0 )->find( 'a', 0 );
    
    			$row_data['href'] = $link->href;
    			$row_data['text'] = $link->innertext;
    			$row_data['time'] = $time->innertext;
    			$row_data['status'] = ( strpos( $link->innertext, '[Resolved]') === 0 ) ? 'resolved' : 'unresolved';
    
    			$rows_data[] = $row_data;
    
    		}
    
    		return $rows_data;
    
    	}
    
Viewing 3 replies - 1 through 3 (of 3 total)
  • I’ve also created a fork on GitHub with the updates baked in:

    https://github.com/toolstack/wp-dev-dashboard

    Plugin Author Mickey Kay

    (@mcguive7)

    Fixed! Thanks for the help Greg. So sorry for the delay, I thought I had subscribed to this support forum but apparently I had not ¯\_(ツ)_/¯

    I think this is the line it finds the resolved or not , [Resolved] text is not longer added in the topic listing, but there is a class called “resolved”

    //$row_data[‘status’] = ( strpos( $link->innertext, ‘[Resolved]’) === 0 ) ? ‘resolved’ : ‘unresolved’;

    $row_data[‘status’] = ( strpos( $link->innertext, ‘<span class=”resolved’) === false ) ? ‘unresolved’: ‘resolved’;

    Note: plugin author will understand where to change or look,

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘No longer working with new support forums’ is closed to new replies.