Foros del Web » Creando para Internet » Sistemas de gestión de contenidos »

Ayuda con mostrar ultimos mensajes.

Estas en el tema de Ayuda con mostrar ultimos mensajes. en el foro de Sistemas de gestión de contenidos en Foros del Web. Buenas, ante todo perdón si no va esto aqui pero no sabia si ponerlo en el apartado de wordpress o en este. He instalado un ...
  #1 (permalink)  
Antiguo 02/12/2008, 10:54
 
Fecha de Ingreso: diciembre-2008
Mensajes: 1
Antigüedad: 15 años, 4 meses
Puntos: 0
Ayuda con mostrar ultimos mensajes.

Buenas, ante todo perdón si no va esto aqui pero no sabia si ponerlo en el apartado de wordpress o en este.

He instalado un plugin en wordpress para mostrar los últimos topics de un foro phpbb. Hasta ahí todo bien, me los muestra. Me gustaría que cada vez que alguien contestase el tema subiera al primero de todos.

Soy un negado en php si alguien sabe como se puede hacer se lo agradecería en el alma. Adjunto el código del plugin:

Código:
// The path to the plugin 

define('PRTPLUGINPATH', (DIRECTORY_SEPARATOR != '/') ? str_replace(DIRECTORY_SEPARATOR, '/', dirname(__FILE__)) : dirname(__FILE__));
 /* * The base class */
 	class phpbbRecentTopics { 
	/* * The boostrap function */
 		function bootstrap() { 
			// Add the installation and uninstallation hooks 
			$file = PRTPLUGINPATH . '/' . basename(__FILE__);
 			register_activation_hook($file, array('phpbbRecentTopics', 'install'));
 			register_deactivation_hook($file, array('phpbbRecentTopics', 'uninstall'));
 			// Add the actions 
			add_action('wp_head', array('phpbbRecentTopics', 'DisplayPRTHeader'));
			add_action('admin_head', array('phpbbRecentTopics','PRT_add_admin_options'));
 			} 
			/* * The installation function */
 			function install() { } 
			/* * The uninstallation function */
 			function uninstall() { } 
			/* * The function to check for the presence of a contact form and link to it's CSS if required */
 			function DisplayPRTHeader() { 
				global $post;
 				
					// Add the content filter 
					add_filter('the_content', array('phpbbRecentTopics', 'DisplayPRTMagicFilter'));
			} 
			/* * The function to display the contact form */
	 		function DisplayPRTMagicFilter($content) { 
				return str_replace('{phpbb_recent_topics}', phpbbRecentTopics::DisplayPRT(), $content);
 			} 
			/* * The function to get the contact form's markup */
 			function DisplayPRT() { 
				
			// Start the cache 
				ob_start();
 			// Add the contact form 
				require(PRTPLUGINPATH . '/display/display.php');
 			// Get the markup 
				$PRT_html = ob_get_contents();
 			// Cleanup 
				ob_end_clean();
 				return $PRT_html;
 			} 

			function PRT_add_admin_options() {
    			
			add_options_page('phpBB Recent Topics Options', 'phpBB Recent Topics', 'manage_options', 'phpbb-recent-topics/display/admin-options.php');


			}

} 

 
phpbbRecentTopics::bootstrap();

// legacy sidebar function
function phpbb_topics($LIMIT) {
	require(PRTPLUGINPATH . '/display/display.php');
}


// Wiget functions...

function wiget_options_phpbb_recent_topics() {

	$options = $newoptions = get_option('prt_widget');
	if ( $_POST["prt-submit"] ) {
		$newoptions['title'] = strip_tags(stripslashes($_POST["prt-title"]));
	}
	if ( $options != $newoptions ) {
		$options = $newoptions;
		update_option('prt_widget', $options);
	}
	$title = attribute_escape($options['title']);
?>
			<p><label for="prt-title"><?php _e('Title:'); ?> <input class="widefat" id="prt-title" name="prt-title" type="text" value="<?php echo $title; ?>" /></label></p>
			<input type="hidden" id="prt-submit" name="prt-submit" value="1" />
<?php
}

	function widget_phpbb_recent_topics($args) {

		# Credits to http://toni.uebernickel.info/entwicklung/wordpress/phpbb-recent-topics-widget/
		# for pointing out my mistake!!

		// get variables
		extract($args);
		// retrieve title
		$options = get_option('prt_widget');
		$title = stripslashes($options['title']);
 
		echo $before_widget, $before_title, $title, $after_title;
 
		require(PRTPLUGINPATH . '/display/display.php');
 
		echo $after_widget;
	}

                        function phpbb_recent_topics_init_widget() {
                                if (!function_exists('register_sidebar_widget'))
                                        return;
                                register_sidebar_widget('phpBB Recent Topics','widget_phpbb_recent_topics');
				register_widget_control('phpBB Recent Topics', 'wiget_options_phpbb_recent_topics', 300, 100);
                        }


# Delay plugin execution until sidebar is loaded
add_action('widgets_init', 'phpbb_recent_topics_init_widget');

?>
Saludos.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 03:56.