Submitting comments navigate to blank page in WordPress - wordpress

On my single.php, I have cuustom code for comments, when I submit a comment, it goes to a blank page with url "https://mosquitojoefranchise.com/wp-comments-post.php". However if I use <?php comments_template(); ?>, then it's working fine. My code is as follows:
<div id="comments">
<ol>
<?php
$pId = $post->ID;
$args = array(
'number' => '5',
'post_id' => $pId, // use post_id, not post_ID
);
$comments = get_comments($args);
foreach($comments as $comment) :
?>
<li>
<div class="avatar"><?php echo get_avatar( $comment, 68 ); ?></div>
<div class="comment_right">
<div class="comment_info">
<?php echo($comment->comment_author);?> <span> </span><?php comment_date('F-j-Y'); ?>
</div>
<?php echo ($comment->comment_content);?><br>
<ul class="comment-links">
<li style="list-style:none !important;"><a aria-label="Reply to Mr WordPress" onclick="return addComment.moveForm( "div-comment-1", "1", "respond", "1" )" href="<?php echo esc_url( get_permalink() ); ?>?replytocom=<?php echo ($comment->comment_ID); ?>#respond" class="comment-reply-link">Reply</a></li>
</ul></div>
<div class="clear"></div>
</li>
<?php
endforeach;
?>
</ol>
</div>
<?php
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) {
//comments_template();
//$file='/short-comments.php';
//comments_template($file);
if ('open' == $post->comment_status) : ?>
<div id="respond">
<h3><?php comment_form_title( 'Post Comments', 'Post Comments to %s' ); ?>.</h3>
<div class="cancel-comment-reply">
<small><?php cancel_comment_reply_link(); ?></small>
</div>
<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
<p>You must be logged in to post a comment.</p>
<?php else : ?>
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform" class="commentform">
<?php if ( $user_ID ) : ?>
<p>Logged in as <?php echo $user_identity; ?>. Log out »</p>
<?php else : ?>
<input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" placeholder="First Name" aria-label="First Name" />
<input type="text" name="last_name" id="last_name" size="22" tabindex="2" placeholder="Last Name" aria-label="Last Name" />
<input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" placeholder="Email" aria-label="Email" />
<input type="text" name="phone" id="phone" size="22" tabindex="4" placeholder="Phone" aria-label="Phone" />
<?php endif; ?>
<textarea onBlur="if (this.value == '') this.value = 'Your Comment';" onFocus="if (this.value == 'Your Comment') this.value = '';" name="comment" id="comment" cols="100" rows="10" tabindex="4" aria-label="Your Comment">Your Comment</textarea> <br>
<fieldset id="submit">
<legend style="display: none;">Comment Submit</legend>
<input name="submit" type="submit" tabindex="5" value="Submit" class="btn btn-blue mahi" />
</fieldset>
<input type="reset" value="Clear" class="btn">
<?php comment_id_fields(); ?>
<?php do_action('comment_form', $post->ID); ?>
</form>
<?php endif; // If registration required and not logged in ?>
</div>
<?php endif; // if you delete this the sky will fall on your head
}
endwhile;
?>
</div>
I do not understand why it is going to blank page, I have given correct form action, still it's not working. Please have a look on the custom code and help me in this case.

Related

Concrete5 add sub page (page not found)

I try to add sub page of home page. After i clicked add page button, it redirects to page not found. This happened also when I tried to log in via custom login page, but then I created new controller, and it works. I guess they are a similar problem.
This is the form to add page. The action value is http://rc.bappenas.go.id/index.php?cID=5023&ccm_token=1441182812:061784e9bfe5b07adb7e5c876e010d09
<form method="post" action="<?php echo $c->getCollectionAction()?>" id="ccmAddPage" onsubmit="jQuery.fn.dialog.showLoader()" class="dialog-form">
<input type="hidden" name="rel" value="<?php echo $_REQUEST['rel']?>" />
<input type="hidden" name="ctID" value="<?php echo $_REQUEST['ctID']?>" />
<div id="ccm-add-page-information">
<h4><?php echo t('Standard Properties')?></h4>
<?php $form = Loader::helper('form'); ?>
<div class="clearfix">
<?php echo $form->label('cName', t('Name'))?>
<div class="input"><input type="text" name="cName" value="" class="text span6" onKeyUp="ccm_updateAddPageHandle()" ></div>
</div>
<div class="clearfix">
<?php echo $form->label('cHandle', t('URL Slug'))?>
<div class="input"><input type="text" name="cHandle" class="span3" value="" id="cHandle">
<img src="<?php echo ASSETS_URL_IMAGES?>/loader_intelligent_search.gif" width="43" height="11" id="ccm-url-slug-loader" style="display: none" />
</div>
</div>
<div class="clearfix">
<?php echo $form->label('cDatePublic', t('Public Date/Time'))?>
<div class="input">
<?php
$dt = Loader::helper('form/date_time');
echo $dt->datetime('cDatePublic' );
?>
</div>
</div>
<div class="clearfix">
<?php echo $form->label('cDescription', t('Description'))?>
<div class="input">
<textarea name="cDescription" rows="4" class="span6"></textarea>
</div>
</div>
<?php
$attribs = $ct->getAvailableAttributeKeys();
$mc = $ct->getMasterTemplate();
?>
<?php if (count($attribs) > 0) { ?>
<h4><?php echo t('Custom Attributes')?></h4>
<?php
ob_start();
foreach($attribs as $ak) {
if (is_object($mc)) {
$caValue = $mc->getAttributeValueObject($ak);
}
?>
<div class="clearfix">
<label><?php echo $ak->getAttributeKeyName()?></label>
<div class="input">
<?php echo $ak->render('composer', $caValue); ?>
</div>
</div>
<?php }
$contents = ob_get_contents();
ob_end_clean(); ?>
<script type="text/javascript">
<?php
$v = View::getInstance();
$headerItems = $v->getHeaderItems();
foreach($headerItems as $item) {
if ($item instanceof CSSOutputObject) {
$type = 'CSS';
} else {
$type = 'JAVASCRIPT';
} ?>
ccm_addHeaderItem("<?php echo $item->file?>", '<?php echo $type?>');
<?php
}
?>
</script>
<?php print $contents; ?>
<?php } ?>
</div>
<div class="dialog-buttons">
<?php echo t('Cancel')?>
<input type="submit" onclick="$('#ccmAddPage').submit()" class="btn primary ccm-button-right" value="<?php echo t('Add Page')?>" />
</div>
<input type="hidden" name="add" value="1" />
<input type="hidden" name="processCollection" value="1">
</form>

How to hide the "Username" - "Password" text fields in login screen in WordPress

I'm using the social connect plugin for wordpress and want to make the social logins (fb, twitter, stack exchange...) the only option. I looked at various plugins to customize the login page but none of them offered the ability to remove the username and password textfields along with "remember me" checkbox and "forgot your password?" label. Any ideas?
If you want to remove password and username text field you must modify the wp-login.php (in your wordpress directory) and remove or comment (comment with <!-- and --> ) this part (line 671 to 708 ):
<form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post">
<p>
<label for="user_login"><?php _e('Username') ?><br />
<input type="text" name="log" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" tabindex="10" /></label>
</p>
<p>
<label for="user_pass"><?php _e('Password') ?><br />
<input type="password" name="pwd" id="user_pass" class="input" value="" size="20" tabindex="20" /></label>
</p>
<?php do_action('login_form'); ?>
<p class="forgetmenot"><label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90"<?php checked( $rememberme ); ?> /> <?php esc_attr_e('Remember Me'); ?></label></p>
<p class="submit">
<input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="<?php esc_attr_e('Log In'); ?>" tabindex="100" />
<?php if ( $interim_login ) { ?>
<input type="hidden" name="interim-login" value="1" />
<?php } else { ?>
<input type="hidden" name="redirect_to" value="<?php echo esc_attr($redirect_to); ?>" />
<?php } ?>
<?php if ( $customize_login ) : ?>
<input type="hidden" name="customize-login" value="1" />
<?php endif; ?>
<input type="hidden" name="testcookie" value="1" />
</p>
</form>
<?php if ( !$interim_login ) { ?>
<p id="nav">
<?php if ( isset($_GET['checkemail']) && in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?>
<?php elseif ( get_option('users_can_register') ) : ?>
<?php _e( 'Register' ); ?> |
<?php _e( 'Lost your password?' ); ?>
<?php else : ?>
<?php _e( 'Lost your password?' ); ?>
<?php endif; ?>
</p>
<?php } ?>
After that you should have only the Wordpress logo and the back link.

Wordpress Custom Search by post_type

I've tried a couple of methods but I cannot seem to filter custom post_types from my search results and was hoping someone could help.
I have installed "Job Manager" and created 4 jobs which have a custom post_type = 'jobman_job'
I tried to create a manual search form and set a hidden value of post_type = jobman_job but it still returned all posts.
<form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
<input type="text" name="s" id="s" value=""/>
<input type="hidden" name="post_type" value="jobman_job" />
<input type="submit" id="searchsubmit" value="Search" />
</form>
I then tried creating a custom search page and redirecting the search to this page as follows (i.e added page_id hidden field):
<form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
<input type="text" name="s" id="s" value=""/>
<input type="hidden" name="page_id" value="123" />
<input type="hidden" name="post_type" value="jobman_job" />
<input type="submit" id="searchsubmit" value="Search" />
</form>
And then in the custom search page, I added the following code (as per wordpress guide - http://codex.wordpress.org/Creating_a_Search_Page) and I added the post_type of jobman_job to the query array:
global $query_string;
$query_args = explode("&", $query_string);
$search_query = array('post_type' => 'jobman_job');
foreach($query_args as $key => $string) {
$query_split = explode("=", $string);
$search_query[$query_split[0]] = urldecode($query_split[1]);
} // foreach
$search = new WP_Query($search_query);
And it still displays all posts...
What am I doing wrong? I have checked the post_type column in the wp_posts table and I have 4 unique entries...so they are there...
Any Insight?
As codex explains, after getting new data you need to replace the loop with your new data, like in this example
<?php if ($pageposts): ?>
<?php global $post; ?>
<?php foreach ($pageposts as $post): ?>
<?php setup_postdata($post); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
<?php the_title(); ?></a></h2>
<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
<div class="entry">
<?php the_content('Read the rest of this entry »'); ?>
</div>
<p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>
<?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
</div>
<?php endforeach; ?>
<?php else : ?>
<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn't here.</p>
<?php include (TEMPLATEPATH . "/searchform.php"); ?>
<?php endif; ?>
Displaying posts from custom query
I simply left the html as is:
<form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
<input type="text" name="s" id="s" value=""/>
<input type="hidden" name="post_type" value="jobman_job" />
<input type="submit" id="searchsubmit" value="Search" />
</form>
and added the following to my functions.php
function mySearchFilter($query) {
if (isset($_GET['post_type']) && $_GET['post_type'] == 'jobman_job') {
$post_type = 'jobman_job';
} else {
$post_type = 'any';
}
if ($query->is_search) {
$query->set('post_type', $post_type);
};
return $query;
};
add_filter('pre_get_posts','mySearchFilter');

Can we display Joomla Login Module in WordPress?

Hi I am using Joomla and WordPress both and I use a single sign-on plugin which is Joomla based. Now the issue is that it is kind of one-way login management.
What I mean is When a user logs into Joomla he automatically gets logged into WordPress and similarly when a user registers into Joomla his details are automatically replicated into WordPress. This activity does not happen when a user logs into or registers from WordPress.
So I wanted to know Is there a way to display the Joomla Login module in the WordPress pages so that when a user logs in from a WordPress page he gets his credentials checked from the Joomla database and the rest is handled by my Joomla Single-signon plugin.
Or is there a better way around?
Kindly suggest.
The code for my Joomla Login Module is somewhat like this:
<?php
defined('_JEXEC') or die('Restricted access'); ?>
<?php if($type == 'logout') : ?>
<form action="index.php" method="post" name="login" id="form-login">
<?php if ($params->get('greeting')) : ?>
<div class="user-greeting">
<?php if ($params->get('name')) : {
echo JText::sprintf( 'HINAME', $user->get('name') );
} else : {
echo JText::sprintf( 'HINAME', $user->get('username') );
} endif; ?>
</div>
<?php endif; ?>
<div class="readon"><input type="submit" name="Submit" class="button" value="<?php echo JText::_( 'BUTTON_LOGOUT'); ?>" /></div>
<input type="hidden" name="option" value="com_user" />
<input type="hidden" name="task" value="logout" />
<input type="hidden" name="return" value="<?php echo $return; ?>" />
</form>
<?php else : ?>
<?php if(JPluginHelper::isEnabled('authentication', 'openid')) :
$lang->load( 'plg_authentication_openid', JPATH_ADMINISTRATOR );
$langScript = 'var JLanguage = {};'.
' JLanguage.WHAT_IS_OPENID = \''.JText::_( 'WHAT_IS_OPENID' ).'\';'.
' JLanguage.LOGIN_WITH_OPENID = \''.JText::_( 'LOGIN_WITH_OPENID' ).'\';'.
' JLanguage.NORMAL_LOGIN = \''.JText::_( 'NORMAL_LOGIN' ).'\';'.
' var modlogin = 1;';
$document = &JFactory::getDocument();
$document->addScriptDeclaration( $langScript );
JHTML::_('script', 'openid.js');
endif; ?>
<form action="<?php echo JRoute::_( 'index.php', true, $params->get('usesecure')); ?>" method="post" name="login" id="form-login" >
<?php echo $params->get('pretext'); ?>
<fieldset class="input">
<p id="form-login-username">
<label for="modlgn_username"><?php echo JText::_('Username') ?></label><br />
<input id="modlgn_username" type="text" name="username" class="inputbox" alt="username" size="18" />
</p>
<p id="form-login-password">
<label for="modlgn_passwd"><?php echo JText::_('Password') ?></label><br />
<input id="modlgn_passwd" type="password" name="passwd" class="inputbox" size="18" alt="password" />
</p>
<?php if(JPluginHelper::isEnabled('system', 'remember')) : ?>
<p id="form-login-remember">
<input type="checkbox" name="remember" class="checkbox" value="yes" alt="<?php echo JText::_('Remember me'); ?>" />
<label class="remember">
<?php echo JText::_('Remember me'); ?>
</label>
</p>
<?php endif; ?>
<div class="readon"><input type="submit" name="Submit" class="button" value="<?php echo JText::_('LOGIN') ?>" /></div>
</fieldset>
<ul>
<li>
<a href="<?php echo JRoute::_( 'index.php?option=com_user&view=reset' ); ?>">
<?php echo JText::_('FORGOT_YOUR_PASSWORD'); ?></a>
</li>
<li>
<a href="<?php echo JRoute::_( 'index.php?option=com_user&view=remind' ); ?>">
<?php echo JText::_('FORGOT_YOUR_USERNAME'); ?></a>
</li>
<?php
$usersConfig = &JComponentHelper::getParams( 'com_users' );
if ($usersConfig->get('allowUserRegistration')) : ?>
<li>
<a href="<?php echo JRoute::_( 'index.php?option=com_user&view=register' ); ?>">
<?php echo JText::_('REGISTER'); ?></a>
</li>
<?php endif; ?>
</ul>
<?php echo $params->get('posttext'); ?>
<input type="hidden" name="option" value="com_user" />
<input type="hidden" name="task" value="login" />
<input type="hidden" name="return" value="<?php echo $return; ?>" />
<?php echo JHTML::_( 'form.token' ); ?>
</form>
<?php endif; ?>
Take a look at JFusion. It was written specifically to handle single sign on/login/registration for Joomla and many other popular projects. Here is the WP specific info -
http://www.jfusion.org/docs/doku.php?id=start#wordpress_3

Wordpress Comment Pagination

Here is a post with 12 comments :
http://test1.zomghentai.com/kateikyoushi-no-onee-san-2-h-no-hensachi-agechaimasu-episode-1
In my wordpress Discussion Settings, I have set it to
"Break Comments into Pages with 5 comments each"
As you can see, at the bottom of comments I have links to Page 1, 2, and 3.
The problem?
1) Page 1 (default page) is showing all 12 comments at once, instead of showing just 5
and
2) Page 2, and 3, are all the same as Page 1
My comments.php file is as followed :
<div id="comments">
<?php // Do not delete these lines
if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');
if (!empty($post->post_password)) { // if there's a password
if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
?>
<h3>This post is password protected. Enter the password to view comments.</h3>
<?php
return;
}
}
/* This variable is for alternating comment background */
$oddcomment = 'alt';
?>
<?php if ($comments) : ?>
<span style="font-size: 13px;"><strong>Comments</strong></span>
<ul>
<?php foreach ($comments as $comment) : ?>
<li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
<div class="cauthor"><strong><?php comment_author_link() ?></strong> says on <?php comment_date('M jS, Y') ?> at <?php comment_time() ?><?php if ($comment->comment_approved == '0') : ?> (Your comment is awaiting moderation)<?php endif; ?></div>
<div class="cbox">
<?php comment_text() ?>
</div>
<div style="clear: both;"></div>
</li>
<?php /* Changes every other comment to a different class */
if ('alt' == $oddcomment) $oddcomment = '';
else $oddcomment = 'alt';
?>
<?php endforeach; /* end for each comment */ ?>
</ul>
<?php paginate_comments_links() ?>
<?php else : // this is displayed if there are no comments so far ?>
<?php if ('open' == $post-> comment_status) : ?>
<!-- If comments are open, but there are no comments. -->
<?php else : // comments are closed ?>
<!-- If comments are closed. -->
<p>Comments are closed.</p>
<?php endif; ?>
<?php endif; ?>
<?php if ('open' == $post-> comment_status) : ?>
<div class="postinput">
<span style="font-size: 13px;padding: 10px 0 0 0;"><strong>Leave a Comment</strong></span>
<?php if ( get_option('comment_registration') && !$user_ID ) : ?>
<p>You must be logged in to post a comment.</p>
<?php else : ?>
<form action="http://www.hentaidreaming.com/wp-comments-post.php" method="post" id="commentform">
<?php if ( $user_ID ) : ?>
<p>Logged in as <?php echo $user_identity; ?>. Logout »</p>
<?php else : ?>
<p>
<input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="20" tabindex="1" />
<label for="author"><small>Name <?php if ($req) _e('<strong>(required)</strong>'); ?></small></label>
</p>
<p>
<input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="20" tabindex="2" />
<label for="email"><small>Mail <?php if ($req) _e('<strong>(required, will not be published)</strong>'); ?></small></label>
</p>
<?php endif; ?>
<p>
<textarea name="comment" id="comment" tabindex="4" rows="10" cols="50" ></textarea>
</p>
<p>
<input name="submit" type="image" id="submit" class="input-submit" tabindex="5" value="Submit Comment" title="Please review your comment before submitting" alt="Submit Comment" src="http://www.hentaidreaming.com/wp-content/themes/hdreamwp/images/submit.gif" />
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
</p>
<?php do_action('comment_form', $post->ID); ?>
</form>
<?php endif; // If registration required and not logged in ?>
<?php endif; // if you delete this the sky will fall on your head ?>
</div> <!-- End "postinput" -->
</div> <!-- End "comments" -->
paginate_comments_links()
This is what you should have posted, what you posted tells nothing.

Resources