0

Hi,

I'm trying to add pagination to the Wordpress plugin, FV Community News. You can see it functioning (without pagination and in its early stages - released it yesterday) here - http://www.siiimple.com/news. I looked back in the php that would likely involve alterations, and here is the section I believe I would have to work with:

function fvCommunityNewsSubmit() {
	global	$fvCommunityNewsSubmited,
			$fvCommunityNewsSubmitError,
			$fvCommunityNewsFieldValues,
			$fvCommunityNewsAwaitingModeration,
			$fvCommunityNewsErrorFields,
			$wpdb;
	
	$fvCommunityNewsSubmited = true;
	
	if (get_option('fvcn_loggedIn') && !is_user_logged_in()) {
		$fvCommunityNewsSubmitError = get_option('fvcn_responseLoggedIn');
		return false;
	}
	
	if (isset($_SESSION['fvCommunityNewsLastPost']) && $_SESSION['fvCommunityNewsLastPost'] > current_time('timestamp')) {
		$fvCommunityNewsSubmitError = get_option('fvcn_responseBumping');
		return false;
	}
	
	if (!empty($_POST['fvCommunityNewsPhone']) || !check_admin_referer('fvCommunityNews_addSubmission')) {
		$fvCommunityNewsSubmitError = 'Spambots are not allowed!';
		return false;
	}
	
	$fields = array('fvCommunityNewsName',
					'fvCommunityNewsEmail',
					'fvCommunityNewsTitle',
					'fvCommunityNewsDescription');
	if (get_option('fvcn_captchaEnabled') && !(get_option('fvcn_hideCaptchaLoggedIn') && is_user_logged_in()))
		$fields[] = 'fvCommunityNewsCaptcha';
	
	
	foreach ($fields as $field) {
		if (empty($_POST[ $field ]) || $_POST[ $field ] == $fvCommunityNewsFieldValues[ $field ]) {
			$fvCommunityNewsErrorFields[] = $field;
			$fvCommunityNewsSubmitError = get_option('fvcn_responseEmpty');
		}
	}
	if (false != $fvCommunityNewsSubmitError)
		return false;
	
	if (get_option('fvcn_captchaEnabled') && !(get_option('fvcn_hideCaptchaLoggedIn') && is_user_logged_in())) {
		if (sha1($_POST['fvCommunityNewsCaptcha']) != $_SESSION['fvCommunityNewsCaptcha']) {
			$fvCommunityNewsSubmitError = get_option('fvcn_responseInvalidCaptcha');
			$fvCommunityNewsErrorFields[] = 'fvCommunityNewsCaptcha';
			return false;
		}
		
		unset($_SESSION['fvCommunityNewsCaptcha']);
	}
	
	if (!is_email($_POST['fvCommunityNewsEmail'])) {
		$fvCommunityNewsSubmitError = get_option('fvcn_responseInvalidEmail');
		$fvCommunityNewsErrorFields[] = 'fvCommunityNewsEmail';
		return false;
	}
	
	if (get_option('fvcn_uploadImage') && isset($_FILES['fvCommunityNewsImage'], $_POST['fvCommunityNewsImageCheck']) && !empty($_FILES['fvCommunityNewsImage']['name'])) {
		if (!fvCommunityNewsCheckImageUpload($_FILES['fvCommunityNewsImage'])) {
			$fvCommunityNewsErrorFields[] = 'fvCommunityNewsImage';
			return false;
		}
	}
	
	
	$name			= apply_filters('pre_comment_author_name', $_POST['fvCommunityNewsName']);
	$title			= apply_filters('pre_comment_author_name', $_POST['fvCommunityNewsTitle']);
	$description	= wp_filter_kses( apply_filters('pre_comment_content', $_POST['fvCommunityNewsDescription']) );
	$ip				= apply_filters('pre_comment_user_ip', $_SERVER['REMOTE_ADDR']);
	$location		= apply_filters('pre_comment_author_url', $_POST['fvCommunityNewsLocation']);
	$email			= apply_filters('pre_comment_author_email', $_POST['fvCommunityNewsEmail']);
	
	if (get_option('fvcn_alwaysAdmin')) {
		$fvCommunityNewsAwaitingModeration = true;
		if (get_option('fvcn_mailOnModeration')) {
			$modmail = true;
		}
		$approved = '0';
	} elseif (get_option('fvcn_previousApproved') && !($wpdb->query("SELECT Id FROM " . get_option('fvcn_dbname') . " WHERE Email = '" . $wpdb->escape($email) ."' AND Approved = '1'") > 0)) {
		$fvCommunityNewsAwaitingModeration = true;
		if (get_option('fvcn_mailOnModeration')) {
			$modmail = true;
		}
		$approved = '0';
	} else {
		$approved = '1';
	}
	
	// Die in hell spambitches
	if (get_option('fvcn_akismetEnabled') && file_exists( dirname(__FILE__) . '/fvCommunityNewsAkismet.php') && get_option('fvcn_akismetApiKey')) {
		@include_once dirname(__FILE__) . '/fvCommunityNewsAkismet.php';
		
		$submission = array(
		   'comment_author'			=> $_POST['fvCommunityNewsName'],
		   'comment_author_email'	=> $_POST['fvCommunityNewsEmail'],
		   'comment_content'		=> $_POST['fvCommunityNewsDescription'],
		   'user_ip'				=> $_SERVER['REMOTE_ADDR'],
		   'user_agent'				=> $_SERVER['HTTP_USER_AGENT']
		);
		
		foreach ($_SERVER as $key=>$val) {
			$submission[ $key ] = $val;
		}
		
		$GLOBALS['akismet_key']		= get_option('fvcn_akismetApiKey');
		$GLOBALS['akismet_home']	= get_option('home');
		$GLOBALS['akismet_ua']		= $_SERVER['HTTP_USER_AGENT'];
	
		if(akismet_check($submission)) {
			$approved = 'spam';
		}
	}
	
	if (get_option('fvcn_mailOnSubmission'))
		$postmail = true;
	
	if ($postmail && 'spam' != $approved) {
		wp_mail(
			get_option('admin_email'),
			'[' . get_option('blogname') . '] Submission: "' . $title . '"',
			'New submission.' . "\n" .
			'Author:' . $name . ' (Ip: ' . $ip . ")\n" .
			'E-mail: ' . $email . "\n" .
			'URL: ' . $location . "\n" .
			'Whois: http://ws.arin.net/cgi-bin/whois.pl?queryinput=' . $ip . "\n" .
			'Description:' . "\n" . $description . "\n\n" .
			'Moderation Page: ' . get_option('home') . '/wp-admin/admin.php?page=fv-community-news&submission_status=moderation'
			);
	} elseif ($modmail && 'spam' != $approved) {
		wp_mail(
			get_option('admin_email'),
			'[' . get_option('blogname') . '] Please Moderate: "' . $title . '"',
			'A new submission is waiting for your approval.' . "\n" .
			'Author:' . $name . ' (Ip: ' . $ip . ")\n" .
			'E-mail: ' . $email . "\n" .
			'URL: ' . $location . "\n" .
			'Whois: http://ws.arin.net/cgi-bin/whois.pl?queryinput=' . $ip . "\n" .
			'Description:' . "\n" . $description . "\n\n" .
			'Moderation Page: ' . get_option('home') . '/wp-admin/admin.php?page=fv-community-news&submission_status=moderation'
			);
	}
	
	$sql = "INSERT INTO " . get_option('fvcn_dbname') . "
			(
				Name,
				Email,
				Title,
				Location,
				Description,
				Date,
				Ip,
				Host,
				Approved
			)
			VALUES
			(
				'" . $wpdb->escape($name) . "',
				'" . $wpdb->escape($email) . "',
				'" . $wpdb->escape($title) . "',
				'" . $wpdb->escape($location) . "',
				'" . $wpdb->escape($description) . "',
				'" . $wpdb->escape( current_time('mysql', 1) ) . "',
				'" . $wpdb->escape($ip) . "',
				'" . $wpdb->escape( @gethostbyaddr($ip) ) . "',
				'" . (int)$approved . "'
			)";
	$result = $wpdb->query($sql);
	if (!$result) {
		$fvNewPosterSubmitError = get_option('fvcn_responseFailure');
		return false;
	}
	
	if (get_option('fvcn_uploadImage') && isset($_FILES['fvCommunityNewsImage'], $_POST['fvCommunityNewsImageCheck']) && !empty($_FILES['fvCommunityNewsImage']['name'])) {
		$ext = explode('.', $_FILES['fvCommunityNewsImage']['name']);
		$ext = strtolower( $ext[ count($ext)-1 ] );
		$name = $wpdb->insert_id . '.' . $ext;
		
		move_uploaded_file($_FILES['fvCommunityNewsImage']['tmp_name'], ABSPATH . 'wp-fvcn-images/' . $name);
		
		$wpdb->query("UPDATE " . get_option('fvcn_dbname') . " SET Image = '" . $wpdb->escape($name) . "' WHERE Id = '" . $wpdb->insert_id . "'");
	}
	
	$_SESSION['fvCommunityNewsLastPost'] = (current_time('timestamp')+120);
	
	return true;
}

I asked the developer but haven't heard back. Thanks for any advice.

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by coolizard
0

I have the same problem as you. I have a plugin that creates a string with real estates. I tried to use the tag <! - NextPage ->. I put him every tenth realty. But it does not work. In the source code of the resulting page is <!--NextPage--> only like a commented text. You can try something like me, but it does not work for me. Maybe you will have more lucky :)).

Edited by coolizard: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.